Professional Documents
Culture Documents
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
https://drive.google.com/open?
id=0B5lNKqneWZwhYWlUQy04NFRKNXc
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)
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
SAEEDK8KHAN@GMAIL.COM
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
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
SAEEDK8KHAN@GMAIL.COM
estat sbsingle
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
Step#2
= 31
This is error
correction term
= .91635127
Adj R-squared
= .87452691
Root MSE
= 83070.046
D.P
Coef.
Std. Err.
P>|t|
ADJ
P
L1.
-.0059958
.0017579
-3.41
0.003
-.0096627
-.0023289
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
LR
SR
YU
D1.
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
SAEEDK8KHAN@GMAIL.COM
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
SAEEDK8KHAN@GMAIL.COM
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)
1992 - 2013
lag
LL
LR
Number of obs
df
FPE
AIC
HQIC
22
SBIC
-165.706
3.77983
15.5187
15.5772
15.7667
-53.6883
224.04
25
0.000
.001488
7.60803
7.95851
9.09582
-15.9819
75.413
25
0.000
.000715
6.4529
7.09544
9.1805
68.8475
169.66
25
0.000
.000013
1.01387
1.94847
4.98129
1703.49
3269.3
25
0.000
5.6e-66* -145.318
-144.091
-140.11
3236.36
3065.7
25
0.000
-284.214
-282.929
-278.759
3336.8
200.88
25
0.000
-293.345
-292.06
-287.89
3297.68 -78.245
25
-289.789
-288.504
-284.333
3354.19
25
0.000
Endogenous:
Exogenous:
113.04*
Or
Step#1
Step#2
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
Step#2
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
And ok
Step#2
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
Add here
maximum
lags or
optimal
Step#3
Coef.
Std. Err.
P>|z|
D_P
_ce1
L1.
-.0002116
.0000693
-3.05
0.002
LD.
2.641314
L2D.
-2.631597
L3D.
-.0003474
-.0000758
.0914989
28.87
0.000
2.46198
2.820649
.1808343
-14.55
0.000
-2.986025
-2.277168
1.00195
.1026645
9.76
0.000
.8007314
1.203169
LD.
-17.44365
6.310434
-2.76
0.006
-29.81187
-5.075422
L2D.
-10.78266
4.202071
-2.57
0.010
-19.01857
-2.546755
L3D.
-2.692897
1.817526
-1.48
0.138
-6.255183
.8693891
LD.
-4.32e-06
9.15e-06
-0.47
0.637
-.0000222
.0000136
L2D.
-1.80e-06
9.17e-06
-0.20
0.845
-.0000198
.0000162
L3D.
.0000111
9.78e-06
1.13
0.257
-8.09e-06
.0000303
LD.
.0032082
.0011028
2.91
0.004
.0010467
.0053698
L2D.
.0011455
.0005591
2.05
0.040
.0000496
.0022414
L3D.
.0005969
.0003585
1.67
0.096
-.0001057
.0012996
_cons
-164710.4
57151.86
-2.88
0.004
-276726
-52694.85
YU
EX
HE
Step#4
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
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 shocks 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
SAEEDK8KHAN@GMAIL.COM
Step#2
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
Step#3
Equation
Parms
RMSE
R-sq
chi2
P>chi2
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.
P>|z|
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
-1.85
0.064
-.0028348
.00008
L2.
-.0078436
.0040739
-1.93
0.054
-.0158283
.000141
_cons
477355
214606.1
2.22
0.026
56734.76
897975.3
YU
EX
HDI
HE
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
Setp#
U have no need to
change anything just
click ok
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
. vargranger
Granger causality Wald tests
Equation
Excluded
chi2
YU
.17274
0.917
EX
21.011
0.000
HDI
5.4149
0.067
HE
5.7897
0.055
ALL
40.749
0.000
YU
9.9949
0.007
YU
EX
8.8705
0.012
YU
HDI
3.3333
0.189
YU
HE
51.299
0.000
YU
ALL
93.069
0.000
EX
8.7329
0.013
EX
YU
1.4657
0.481
EX
HDI
4.4102
0.110
EX
HE
5.1576
0.076
EX
ALL
15.527
0.050
HDI
12.807
0.002
HDI
YU
3.519
0.172
HDI
EX
7.3963
0.025
HDI
HE
1042.9
0.000
HDI
ALL
1346.5
0.000
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
Step#2
Select if u
need
suppose u
want to add
time trend
the check
first option
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
9. now the last thing what model is suitable random effect or fixed effect for this run Housman
test(note if you do not restore results of random effect and fixed effect may u face error prob)
hausman fe re
how to run pooled regression in stata
reg dep indep indep
10. Further u can double check either random /fixed effect /or polled appropriate. But note,
suppose hausaman verified random effect is appropriate, so we can double check for step 9,
suppose hausman test verified random effect model is appropriates so in step ten we will
conform either really random effect is appropriate or not so we will run test and verify
hypothesis between polled model and random effect actually we have already done with fixed
effect using hausman test.stepsstatisticslongitudinal /panel data---linear model--langrangian multiplier and null hypothesis is polled is appropriate. And alternative hypothesis is
random effect is appropriate.
How to run 2sls two stage least square
Statistics > Endogenous covariates > Single-equation instrumental-variables regression
Step#1
ivregress 2sls consumtion remetence (income = investment)
(note here income is my endogenous and investment instrumental is my instrumental
variables)
Step#2
As I have run 2sls model but now I have to conform that either in reality really endogeniety
problem was exist or not
estat endog
if probability value comes more than 5% then we say there is no endogeniety but if prob value
comes less than in this case we say there is endogeniety prob,, which is desirable;
setp#3
Now I have I have conform either endogeniety problem exist or not now I want to know either
my instruments are weak or strong
estat firststage
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
step#4
Now I want to know either my instruments are over identified or not?
estat overid
{ sargan and basman test is used to know about the over identification if probability value
comes of thesis test more than5% we say model is correct specified
Null hypothesis for over identified instruments: instrument set is valid and the model is correct
specified}
xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace full mg
here we shall Run PMG (average):
xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace pmg
here we shall Run PMG (individual):
(The main characteristic of PMG is that it allows short-run coefficients, including the
intercepts, the speed of adjustment to the long-run equilibrium values, and error
variances to be heterogeneous country by country, while the long-run slope coefficients
are restricted to be homogeneous across countries.)
xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace full pmg
here we shall Run Hausman test to choose between MG and PMG:
hausman mg pmg, sigmamore
now if our probability value comes more than 5% we run PMG
if our probability value comes less than 5% we run MG
Running DFE:
xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace dfe
* Running Hausman test to choose between MG and DFE:
hausman mg DFE, sigmamore
Note:
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
Suppose you want to run all these tests on your data, so simple just import your data into
stata and copy command from here into stata command bar and replace my variables
name with yours.
Good luck.
PANEL ARDL
Pooled Mean Group (PMG) model
The main characteristic of PMG is that it allows short-run coefficients, including the intercepts, the
speed of adjustment to the long-run equilibrium values, and error variances to be heterogeneous
country by country, while the long-run slope coefficients are restricted to be homogeneous across
countries. This is particularly useful when there are reasons to expect that the long-run equilibrium
relationship between the variables is similar across countries or, at least, a sub-set of them. The
shortrun adjustment is allowed to be country-specific, due to the widely different impact of the
vulnerability to financial crises and external shocks, stabilization policies, monetary policy and so on.
However, there are several requirements for the validity, consistency and efficiency of this
methodology. First, the existence of a long-run relationship among the variables of interest requires the
coefficient on the errorcorrection term to be negative and not lower than -2. Second, an important
assumption for the consistency of the ARDL model is that the resulting residual of the error-correction
model be serially uncorrelated and the explanatory variables can be treated as exogenous. Such
conditions can be fulfilled by including the ARDL (p,q) lags for the dependent (p) and independent
variables (q) in error correction form. Third, the relative size of T and N is crucial, since when both of
them are large this allows us to use the dynamic panel technique, which helps to avoid the bias in the
average estimators and resolves the issue of heterogeneity. Eberhardt and Teal (2010) argue that the
treatment of heterogeneity is central to understanding the growth process. Therefore, failing to fulfil
these conditions will produce inconsistent estimation in PMG.
The PMG estimator constrains the long term coefficients to be the same across countries and allows
only the short-term coefficients to vary.
Mean Group (MG) estimator
The second technique (MG) introduced by Pesaran and Smith, (1995) calls for estimating separate
regressions for each country and calculating the coefficients as unweight means of the estimated
coefficients for the individual countries. This does not impose any restrictions. It allows for all
coefficients to vary and be heterogeneous in the long-run and short-run. However, the necessary
condition for the consistency and validity of this approach is to have a sufficiently large time-series
dimension of the data. The cross-country dimension should also be large (to include about 20 to 30
countries). Additionally, for small N the average estimators (MG) in this approach are quite sensitive to
outliers and small model permutations (see Favara, 2003).
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
step#2
*suppose you want to know about correlation among variables
correlate cs1 cs2 cs3 cs4
step#3
*now you want to check reliability(cronbach alpha values) of items ,so first write alpha then all
items with space
alpha cs1 cs2 cs3 cs4
Step#4
*now we are going to run PCA and want to see egen values /component means from the items
how much component we can create
pca cs1 cs2 cs3 cs4
step#5
Now i also want to know about the KMO value of PCA
estat kmo, novar
step#6
*now i want to make a construct/variables from (4 items)cs1 cs2 cs3 cs4 and suppose i give
name to this new single variable like saeed1
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
In this you can see description about the null hypothesis of all tests so u can get rid of any
problem just click on help button
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES
SAEEDK8KHAN@GMAIL.COM