Stationarity and Seasonality in Univariate Time Series.pdf

charlessmithshd 55 views 25 slides Sep 10, 2024
Slide 1
Slide 1 of 25
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25

About This Presentation

Econometrics has always been an important subject for many students in schools and universities. To help them understand the topics inside and do assignments, the Statistics Help Desk team offers comprehensive statistical solutions.


Slide Content

Stationarity and
Seasonality In
Univariate Time Series
A Comprehensive Guide For Econometrics Assignment Help

Atimeseriesanalysisisanessentialtechniqueofeconometricstoexaminehoweconomic
datachangesovertimetofinddiscoverpatternsandinsights.Thereareseveralareas
studentsgettoexploreinthecourseofeconometricsandoneofthemisthestationarity
andseasonalityinunivariatetimeseries.Analyzingsuchconceptsiscrucialinforecasting
dataandoutcomes.Thisguideaimstoprovidestudentswiththeknowledgeof
stationarityandseasonalityinunivariatetimeseriesincludingillustrations,samplecodes
andsomerecommendedsourcesusefulfordoingeconometricsassignments.

Introduction to Time Series Analysis
Theconceptoftimeseriesineconometricscanbedefinedasasetofobservationsthatare
observedandrecordedovertime.Thus,timeseriesdatacanbeeitherunivariateor
multivariate.Univariatetimeseriesobservingasinglevariableovertimewhichcanbe
GDP,inflationrate,stockspricesetc.Multivariatetimeseriesinvolvesexaminingmultiple
variables.
Timeseriesanalysisaimsatmodeling,analyzing,andforecastingtheseobservations,
andtwopreconditionswhichhavetobemetarestationarityandseasonality.Bothof
theseimpactthebehaviorofatimeseriesandtheextenttowhichitcanbeforecasted;
thus,itiscrucialtobeabletoidentifytheminordertomakeeffectiveeconometric
models.

What is Stationarity in Time Series?

Stationarityreferstoapropertyofatimeserieswhereitsstatisticalproperties,suchas
mean,variance,andautocorrelation,remainconstantovertime.Inotherwords,the
distributionoftheseriesdoesnotchangeastimeprogresses.
TypesofStationarity
1.StrictStationarity:Atimeseriesissaidtobestrictlystationaryifthejointprobability
distributionoftheseriesdoesnotvarywithtime.Generally,thisconditionisvery
difficulttoachieveandisusuallytoorestrictiveformostapplications.
2.WeakStationarity(Second-OrderStationarity):Aweaklystationarytimeserieshas
mean,varianceandautocovarianceremainingconstantwithtime.Thispractical
formofstationarityiscommonlyobservedineconometricmodels.

Why Stationarity is important?
Mostoftheforecastingmodelsusedineconometricsassumethattimeseriesisstationary.Thisis
thereasonwhystationarityofcrucial.Ifatimeseriesisnon-stationary,thenitmaygenerate
incorrectandunreliableoutputs.Forexample,trendsandfluctuationsintheeconomicdata
influenceresultsleadingtoinaccurateforecasting.
HowtoCheckforStationarity
Tocheckthestationarityoftimeseries,youcanusethefollowingtechniques:
•VisualInspection:Plottingthetimeseriesandassessingwhetherthemeanandvariancelook
constant.
•StatisticalTests:ThemostcommontestforstationarityistheAugmentedDickey-Fuller(ADF)
test.Ap-valuebelowacertainlimit(typically0.05)suggeststhattheseriesisstationary.

Pythoncode
#PythonExample:CheckingforStationarityusingADFtest
importpandasaspd
importnumpyasnp
importmatplotlib.pyplotasplt
fromstatsmodels.tsa.stattoolsimportadfuller
#SampleData(e.g.,stockprices)
data=pd.read_csv('stock_prices.csv')#Replacewithactualfilepath
time_series=data['Close']
#ADFTest
adf_result=adfuller(time_series)
print(f'ADFStatistic:{adf_result[0]}')
print(f'p-value:{adf_result[1]}')
ifadf_result[1]<0.05:
print("Thetimeseriesisstationary.")
else:
print("Thetimeseriesisnon-stationary.")
Ifthetimeseriesisnon-stationary,youcanmakeitstationarybydifferencing,de-trending,orapplying
atransformationlikelogarithms.

Differencing for Stationarity

Oneofthemostcommonmethodstoachievestationarityisdifferencing,whichinvolvessubtracting
consecutiveobservationsfromoneanother.
First-orderDifferencing
First-orderdifferencinginvolvessubtractingthevalueattimet-1fromthevalueattimet:
Thismethodremoveslineartrendsinthedata,makingtheseriesstationary.
Pythoncode
#PythonExample:DifferencingaTimeSeries
time_series_diff=time_series.diff().dropna()
#Plottingthedifferencedseries
plt.plot(time_series_diff)
plt.title("DifferencedTimeSeries")
plt.show()
Oncedifferenced,youcanrecheckforstationarityusingtheADFtest.

What is Seasonality in Time Series?

Seasonalityisareoccurringpatternwithinthetimeseriesthatrelatestotheeffectsoftheseasonincluding
weatherorholidayorbusinesscycles.Forinstance,thesalesofproductsinthestoretendtobehighintheholiday
seasonwhileenergyconsumptionisobservedtobehighinsummerseason.
WhySeasonalityisImportant
Exclusionofseasonalitymayaffectthemodelsignificantlyintermsofperformance.Amodelthatdoesnot
capturepatternsmaynotprovidevitalinsightsforfutureforecasting.
IdentifyingSeasonality
Seasonalitycanbevisualizedgraphicallybyplottingthedataorbyusingtheautocorrelationfunctionplots(ACF
plots)whichshowthecorrelationoftheobservationsmadeatgivenlagsoftime.Seasonalpatternsaredepictedin
anACFplotintheformofPeaksthatoccuratregularintervals.
Pythoncode
#PythonExample:PlottingACFtoIdentifySeasonality
fromstatsmodels.graphics.tsaplotsimportplot_acf
plot_acf(time_series)
plt.show()

Decomposing Time Series

Tobetterunderstandandmodelatimeseries,itcanbeusefultodecomposeitintothreecomponents:
1.Trend:Thelong-termupwardordownwardmovementinthedata.
2.Seasonality:Repeatingshort-termpatterns.
3.Residuals:Thenoiseorirregularvariationsinthedata.
Usingtoolsliketheseasonal_decomposefunctionfromPython’sstatsmodelslibrary,youcanbreak
downatimeseriesintothesecomponents.
Pythoncode
#PythonExample:DecomposingaTimeSeries
fromstatsmodels.tsa.seasonalimportseasonal_decompose
decomposition=seasonal_decompose(time_series,model='additive')
decomposition.plot()
plt.show()

Seasonality in ARIMA Models

ARIMAisoneofthemostpopularmodelsusedintimeseriesforecasting.But,ARIMAmodelslackthe
inherentcapabilityofmodelingseasonality.Hence,whendealingwithseasonaldatayouaresupposed
tousetheSeasonalARIMA(SARIMA)modelthatincludesseasonalcomponents.
TheSARIMAmodelistypicallywrittenas:
SARIMA(p,d,q)(P,D,Q)m
Where:
•p,d,qarethenon-seasonalparameters.
•P,D,Qaretheseasonalparameters.
•misthenumberoftimeperiodsperseason(e.g.,12formonthlydatawithyearlyseasonality).

Pythoncode
#PythonExample:FittingaSARIMAModel
fromstatsmodels.tsa.statespace.sarimaximportSARIMAX
#Example:SARIMA(1,1,1)(1,1,1,12)model
sarima_model=SARIMAX(time_series,order=(1,1,1),seasonal_order=(1,1,1,12))
sarima_result=sarima_model.fit()
#Summaryofthemodel
print(sarima_result.summary())

Expert Econometrics Assignment Help:
Comprehensive Solutions for Top Grades in
Any Software

Econometricsasanacademicsubjecthasalwaysbeenquitedemandingformanystudentsintermsof
solvingacademicassignmentsinvolvingnumerousstatisticalmodels,complexlargedatasets,and
employingadvancedsoftwareapplications.OurEconometricsAssignmentHelpserviceisaimedtohelp
studentsmasteradvancedeconometricsconceptsandachievethebestgradesbyproviding
comprehensivestatisticalsolutions.
Weoffereconometricshomeworkhelpinalltheleadingsoftwares:SAS,SPSS,R,Eviews,Stata,python,
JMPandMinitab.Ourqualifiedeconometricianswewillnotonlyprovideyouthesolution,butprovidea
step-by-stepguidanceonhowtosolvetheproblemusingtheabovesoftwaretools.

What We Offer

•DetailedSolutions:Weprovidecomprehensivesolutionswellsupportedbysoftwareoutputs,plots,
tablesandcodessothatthestudentscanreplicatetheresults.
•Step-by-StepGuidance:Webreakdowntheproblemintomanageablestepsandprovidedetailed
explanationofeachstepforeasyunderstanding.
•SoftwareExpertise:Weareproficientwithallleadingeconometricstools–Rforstatisticalcomputing,
Pythonformachinelearningmodels,andStataforpaneldataanalysis.
•ThoroughInterpretation:Apartfromsolutions,weprovideaccurateinterpretationsofresultstoaidin
theunderstandingofimplicationofthemodelsanddataanalysis.

Helpful Resources and Textbooks

Forstudentslookingtodivedeeperintotimeseriesanalysis,severalexcellentresourcesandtextbooksare
available:
•"TimeSeriesAnalysisandItsApplications"byShumway&Stoffer:Acomprehensivebookthatcovers
thefundamentalsoftimeseriesanalysis,includingstationarity,seasonality,andadvancedmodels.
•"IntroductiontoTimeSeriesandForecasting"byBrockwell&Davis:Thisbookisparticularlyusefulfor
students,asitoffersaclearandpracticalintroductiontotimeseriesmethods.

Conclusion

Stationarityandseasonalityareveryimportantconceptsineconometrictimeseries
analysisparticularlytostudentswhoareundertakingassignmentsusingeconomicdata.
Bylearningtheseconcepts,youwillbeinapositiontocreaterobustmodelsandmake
appropriatepredictions.MethodssuchasdifferencingforstationarityandSARIMAfor
seasonaldataarethemostbeneficialstrategiesfortimeserieseconometricanalysis.

Thank You
www.statisticshelpdesk.com
[email protected] ++44-166-626-0813