Title | TIME Sereis Analysis Using Stata |
---|---|
Author | Sikandar Khattak |
Course | Econometric |
Institution | Quaid-i-Azam University |
Pages | 26 |
File Size | 1.8 MB |
File Type | |
Total Downloads | 96 |
Total Views | 143 |
Download TIME Sereis Analysis Using Stata PDF
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
TIME SEREIS ANALYSIS USING STATA How to run regression using stata
PLEASE DONT EDIT THIS FILE OR MY NAME , THANKS.
Step #1: Import data into STATA Setp#2: At first step, always set time otherwise u may get error, set time with the help of following command tsset years, yearly step#3: If u need to see summary of variables type in stata command bar summarize CO2 GDP OIL fdi PP or simpley write sum these are my variables)
(CO2 GDP OIL fdi PP
For detail of data give this command describe or list or br
(these are three different commands)
step #4: If u wishes to run correlation test then u may run by typing following command correlate CO2 GDP OIL fdi step#5: If u wishes to run regression then u can with the help of following command regress CO2 GDP OIL fdi {note: CO2 GDP OIL fdi are my variables first I wrote my dependent variable then all Independent variables} step#6 If u wants to check normality then u has to perform two steps after regression means run two commands consecutively predict myResiduals, r sktest myResiduals
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
step#7 If u have run regression now, if u wish to check serial correlation then apply following command dwstat or estat bgodfrey step#7 Suppose now u want to test heteroskedasticity estat hettest, fstat or estat hettest step#8 Suppose u now want to test multicollenearity estat vif Setep#8 Suppose now u want to see either model is miss specified or not /either we have omitted variables or not/Ramsey RESET test estat ovtest Note all diagnostic tests can be run from post estimation option (statistics-----post estimation) How to test about structural breaks in data? Statistics > Postestimation
Step#1 At first step run simple regression, normally we check structural break individually in each variable, so run one by one regression like this, suppose I want to check structural breaks in my dependent variable co2. So first I should run simple regression with only co2 regress co2 step#2 Now set time with following command tsset year
(if u have monthly data then write month )
step#3 Run following command to know about structural breaks. PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
estat sbsingle
Few old commands with new names Out-of-date commands These commands continue to work but are out-of-date as of Stata 9. Their replacements are Old command New command -----------------------------hettest estat hottest for HSK(HETEROSCADESTICITY) imtest estat imtest (meron & Trivedi's decomposition of IM-test) ovtest estat ovtest (Ramsey RESET test using powers of the fitted values of CO2 Ho: model has no omitted variables) szroeter estat szroeter vif estat vif -----------------------------See regress postestimation. Old command New command -----------------------------archlm estat archlm bgodfrey estat bgodfrey durbina estat durbinalt (FOR SERIAL CORRELATION ALTERNATIVE TO DURBINWATSON TEST) dwstat estat dwatson (DURBINWATSON TEST FOR S.C) -----------------------------How to run time series ARDL MODEL? Step#1 Import data into stata Step#2 set times first otherwise u will get error message for time write the following command.(if u have annually data otherwise u can change frequency like monthly etc. tsset years, yearly
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Step#2
First install following package
net install ardl, from(http://www.kripfganz.de/stata/) Write following command into command bar ardl P YU EX HE, lag(1 1 2 3) ec . ardl P YU EX HE, lag(1 1 2 3) ec ARDL regression Model: ec Sample: 1983 - 2013 Number of obs
= 31
This is error correction term
Log likelihood = -388.34477 R-squared
= .91635127
Adj R-squared
=
Root MSE
=
D.P
Conf. Interval]
ADJ P L1.
-
627
-.0023289
LR YU
1797.459
14701.89
0.12
0.904
-28870.14
32465.06
EX
.0646155
.0122439
5.28
0.000
.0390751
.0901558
HE
.6086697
1.082744
0.56
0.580
-1.649894
2.867234
30.83755
26.00734
1.19
0.250
-23.41281
85.08792
D1.
-.0001549
.0000722
-2.14
0.045
-.0003056
-4.17e-06
LD.
-.0002417
.0000773
-3.13
0.005
-.000403
-.0000804
D1.
-.0011703
.0065507
-0.18
0.860
-.0148348
.0124942
LD.
-.0027493
.002675
-1.03
0.316
-.0083294
.0028307
L2D.
.0003703
.0015138
0.24
0.809
-.0027874
.003528
_cons
3314510
169730.1
19.53
0.000
2960459
3668561
Long run results
SR YU D1.
Short run results
EX
HE
.
(not p,yu ex and he I have my variable first p is dependent variable while remaining are independent variables , further I have space between all variables, and after comma I have also space and after bracket close I have also space good luck,,, lags 1,1,2,3 indicating for dependent variable there must be one lag and after dependendent variable for the first independent variable also must be lag 1 and so one ) Step#4 If u wants to conform long run relationship to the help of bound test then write following command in command box. estat btest PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
second method of running ardl model step#1 import data into STATA Step#2 ardl CO2 GDP OIL fdi , lags(. . . 3) maxlag(3 3 3 3) (note: here co2 is my dependent variable while other are independent variables, while lags(. . . 3) is showing that for the first three variables means one dependent and other two independent variable’s I am saying to stata that ,it’s all up to stata ,program itself can select optimal lags but 3 indicating that for last independent variable I’m limiting program that there must be lag 3 for last variable, maxlag (3 3 3 3) showing we can add maximum lags 3333 for all variable’s but it is ignorable Step#3 If want to see how stata chose optimal lags then run following command matrix list e(lags) step#4 Suppose now you want to see error correction term, long run as well as short run results then apply follow owing command ardl CO2 GDP OIL fdi , ec now you want to see bound test, estat btest Third Method of running ARDL in STATA Step#1 first of all install package again command is here “net install ardl, from(http://www.kripfganz.de/stata/)” Step#2 or search ARDL package through stata command box using “help ardl” or “findit ardl” Setp#3 here we are going to run simple ardl like in eviews we get ardl results before bounds tests and long run and short run , run following command in comamd bar first write your dependent variable then all independent variables “ardl co2 he pop , aic”
Step#3 As before going to long run and short run we go for bound tests values to conform long run cointegration. PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
“ardl, noctable btest” Step#4 as in step 3 we conform about long run cointegration now we are going to run long run and short run results with error correction term(ADJ) here first I wrote my dependent variables then all independent . “ardl co2 he pop , aic ec regstore(ecreg)” Step#5 as now we have generate all results but we have need now of diagnostic test for the store your step#4 results with this command “estimates restore ecreg” Step#6 after restoring your results in step 5 ,,, now run “regres” command you will see your step 4 results will appear and after this you may run following diagnostic test, Step#7 Frequently ask question about ARDL USING STATA , it is acknowledge that i have copied this post from Aymen Ammari time line “estat dwatson” (Durbin Watson statistics, at 1st order autocorrelation). “estat archlm” (ARCH LM test for higher order autocorrelation) “estat bgodfrey” (Breusch Godfrey LM test for higher order autocorrelation) “estat hottest” (Breusch Pagan Heteroscedasticity test) “estat ovtest” (Ramsey RESET test) “estat vif” (Test for the Multicollinearity)
And finally run after ARDL for the parameters stability .CUSUM TEST Now If you want to run cusum test (parameters stability test) then run following command
first install this package “ssc install cusum6” (note: internet is necessary for installation) now type this command “cusum6 variable1 variable2 variable3,cs(cusum) lw(lower) uw(upper)
How to select optimal lags Statistics > Multivariate time series > VAR diagnostics and tests > Lag-order selection statistics (preestimation) Or select optimal lags through following command varsoc LOGFDI LOGGDP LOGDD LOGINF LOGEXCHRT, maxlag(8) PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan . tsset year, yearly time variable: delta:
year, 1984 to 2013 1 year
. varsoc LOGFDIGDP LOGGDP LOGDD LOGINF LOGEXCHRT, maxlag(8) Selection-order criteria Sample:
1992 - 2013
lag
LL
LR
Number of obs df
p
FPE
AIC
HQIC
=
22 SBIC
0
-165.706
3.77983
15.5187
15.5772
15.7667
1
-53.6883
224.04
25
0.000
.001488
7.60803
7.95851
9.09582
2
-15.9819
75.413
25
0.000
.000715
6.4529
7.09544
9.1805
3
68.8475
169.66
25
0.000
.000013
1.01387
1.94847
4.98129
4
1703.49
3269.3
25
0.000
5.6e-66* -145.318
-144.091
-140.11
5
3236.36
3065.7
25
0.000
.
-284.214
-282.929
-278.759
3336.8
6
200.88
25
0.000
.
-293.345
-292.06
-287.89
7
3297.68 -78.245
25
.
.
-289.789
-288.504
-284.333
8
3354.19
25
0.000
.
-294.927* -293.642* -289.471*
Endogenous: Exogenous:
113.04*
LOGFDIGDP LOGGDP LOGDD LOGINF LOGEXCHRT _cons
Or Step#1
Step#2
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Set time first otherwise u may get error Write ur all variables
Chose maximum lags Normally use in between 5-10 and keep all thing unchanged
How to test cointegration Statistics > Multivariate time series > Cointegrating rank of a VECM Step#1
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Step#2
Write ur variables, like first dependent then all indep Chose optimal lags, which u deicide form lag length criteria and ok
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
How to run VECM MODEL? Statistics > Multivariate time series > Vector error-correction model (VECM) Step#1
And ok
Step#2
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Write your variabels,first dependent then all independent variables Write here number of cointegration equations which u finds from Johansson test but I would like to suggest u add all the time 1 for simplisticity
Add here maximum lags or optimal
Step#3
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
D_P _ce1 L1.
.000211
P LD.
2.64131
L2D.
-2.63159
L3D.
1.0019
Long run causality value must be negative and in between 01..which indicate error correction term ,speed of adjustment
YU LD.
-17.4436
L2D.
-10.7826
L3D.
-2.69289
.310434
-2.76
0.006
-29.81187
-5.075422
ort run causality
EX LD.
-4.32e-0
L2D.
-1.80e-0
L3D.
.000011
HE LD.
.003208
0011028
2.91
0.004
.0010467
.0053698
L2D.
.001145
0005591
2.05
0.040
.0000496
.0022414
L3D.
.000596
0003585
1.67
0.096
-.0001057
.0012996
_cons
-164710.
7151.86
-2.88
0.004
-276726
-52694.85
Step#4 PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Wald test for short run causalities if you want to see jointly impact of lags variabels on dependent variables Go to statistics----post estimation---test, contrast, and comparison of parameters,---linear test of parameters How to run IMPULSE RESPONSE FUNTION If u want to run through MANU,, follow these steps Statistics > Multivariate time series > IRF and FEVD analysis > Graphs by impulse or response Step#1 (actually impulse response functions used after VAR models) Run VECM model Step#2 Then use irf create to estimate the IRFs and FEVDs and save them in a file, and finally use irf graph or any of the other irf analysis commands to examine results:, like run following command irf create order1, step(10) set(myirf1) Step#3 now I want to see impulse response function, the following function will show over all impulse response function results irf graph irf, irf(order1) step#4 suppose you are not interest in all variables response function ,I mean to say I just want to see only independent variables shock’s effect on dependent then apply following command. irf graph irf, irf(order1) impulse(GDP OIL fdi) response(CO2) (note here GDP,OIL and fdi are my independent variables and co2 dependent . How to run var model? Statistics > Multivariate time series > Vector autoregression (VAR) Step#1
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Step#2
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC TECHNIQUES [email protected]
“Welcome to meo school of research” WWW.SAEEDMEO.BLOGSPOT.COM Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Step#3 Equation
Parms
RMSE
R-sq
chi2
P>chi2
P
11
43425.6
1.0000
2.14e+07
0.0000
YU
11
580.764
0.7792
112.9032
0.0000
EX
11
2.3e+08
0.9691
1003.692
0.0000
HDI
11
1.01628
0.9989
6665.462
0.0000
HE
11
9.9e+06
0.3616
18.12447
0.0529
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
P P L1.
1.859308
.0743769
25.00
0.000
1.713532
2.005084
L2.
-.8601668
.0746806
-11.52
0.000
-1.006538
-.7137955
L1.
4.900434
11.82905
0.41
0.679
-18.28407
28.08494
L2.
.6010501
6.50086
0.09
0.926
-12.1404
13.3425
L1.
.0000743
.0000315
2.36
0.018
.0000125
.000136
L2.
.0000507
.0000366
1.39
0.166
-.000021
.0001223
L1.
10483.9
7579.004
1.38
0.167
-4370.678
25338.47
L2.
-13216.11
7908.145
-1.67
0.095
-28715.79
2283.57
L1.
-.0013774
.0007436
...