Documente Academic
Documente Profesional
Documente Cultură
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
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 SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
estat sbsingle
Out-of-date commands
These commands continue to work but are out-of-date as of Stata 9. Their replacements
are
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
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/)
ARDL regression
Model: ec
ADJ
P
L1. -.0059958 .0017579 -3.41 0.003 -.0096627 -.0023289
LR
YU 1797.459 14701.89 0.12 0.904 -28870.14 32465.06
Long run results
EX .0646155 .0122439 5.28 0.000 .0390751 .0901558
HE .6086697 1.082744 0.56 0.580 -1.649894 2.867234
SR
YU
D1. 30.83755 26.00734 1.19 0.250 -23.41281 85.08792
Short run results
EX
D1. -.0001549 .0000722 -2.14 0.045 -.0003056 -4.17e-06
LD. -.0002417 .0000773 -3.13 0.005 -.000403 -.0000804
HE
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
(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
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 variables I am
saying to stata that ,its all up to stata ,program itself can select optimal lags but 3
indicating that for last independent variable Im 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 variables
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#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
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
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 SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
. tsset year, yearly
time variable: year, 1984 to 2013
delta: 1 year
Selection-order criteria
Sample: 1992 - 2013 Number of obs = 22
Or
Step#1
Step#2
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
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 SAEEDK8KHAN@GMAIL.COM
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 SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Step#3
Coef. Std. Err. z P>|z| [95% Conf. Interval] Long run causality value must be
D_P negative and in between 0-
_ce1
L1. -.0002116 .0000693 -3.05 0.002 -.0003474 -.0000758 1..which indicate error
P correction term ,speed of
LD. 2.641314 .0914989 28.87 0.000 2.46198 2.820649
L2D. -2.631597 .1808343 -14.55 0.000 -2.986025 -2.277168
adjustment
L3D. 1.00195 .1026645 9.76 0.000 .8007314 1.203169
YU
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 Short run causality
EX
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
HE
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
Step#4
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
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 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 .
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
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 SAEEDK8KHAN@GMAIL.COM
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
P
L1. 1.859308 .0743769 25.00 0.000 1.713532 2.005084
L2. -.8601668 .0746806 -11.52 0.000 -1.006538 -.7137955
YU
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
EX
L1. .0000743 .0000315 2.36 0.018 .0000125 .000136
L2. .0000507 .0000366 1.39 0.166 -.000021 .0001223
HDI
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
HE
L1. -.0013774 .0007436 -1.85 0.064 -.0028348 .00008
L2. -.0078436 .0040739 -1.93 0.054 -.0158283 .000141
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
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
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Step#6 and finally granger causality test
Here results showing that P is
. vargranger
dependent variables while YU,EX, HDI
Granger causality Wald tests
ETC INDEPENDNET VARIAELS,
Equation Excluded chi2 df Prob > chi2
P YU .17274 2 0.917
IN THE SECOND ROW OF RIGTHT SIDE
P
P
EX
HDI
21.011
5.4149
2
2
0.000
0.067
FIRST COLUM, SHOWING THT EX
P HE 5.7897 2 0.055 JOINTLY GRANGER CUSE P IN SHORT
P ALL 40.749 8 0.000
RUN . AS NULL HYPOTHESIS WAS NO
YU P 9.9949 2 0.007
YU EX 8.8705 2 0.012 GRANGER CASUE AS PROBABLITY VALUE
YU HDI 3.3333 2 0.189
YU HE 51.299 2 0.000 IS LEST THAN 5% SO I CAN SAY HERE
YU ALL 93.069 8 0.000
THAT I HAVE TO ACCEPT ALTERNATIVE
EX P 8.7329 2 0.013
EX YU 1.4657 2 0.481
HYPOTHESIS
EX HDI 4.4102 2 0.110
EX HE 5.1576 2 0.076
EX ALL 15.527 8 0.050
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
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 SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
now store result of fixed effect from this command
8. estimate store re
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
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
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}
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
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
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
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.
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
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
Dynamic Fixed Effects (DFE) model
Finally, the dynamic fixed effects estimator (DFE) is very similar to the PMG estimator and imposes
restrictions on the slope coefficient and error variances to be equal across all countries in the long run.
The DFE model further restricts the speed of adjustment coefficient and the short-run coefficient to be
equal too. However, the model features country-specific intercepts. DFE has cluster option to estimate
intra-group correlation with the standard error (Blackburne and Frank, 2007). Nevertheless, Baltagi, Gri,
and Xiong (2000) point out that this model is subject to a simultaneous equation bias due to the
endogeneity between the error term and the lagged dependent variable in case of small sample size.
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
predict saeed1, score
Step#6
Actually I have converted my all items into variables now I want to run regressions between
these variables
regress cs1 cs2 cs3 cs4 (suppose cs1,2,3 and 4 are my variables which are made after
PCA)
Last tips and tricks
Finally how to generate new variables
1. Suppose you want to generate a series of square of any variable
gen cs1sqrt=sqrt( cs1) (note cs1 is my variabel)
2. Suppose you want to take log
gen cs1log=log( cs1)
3. Suppose u want to add two variables
gen cs1pluscs3 = cs1+cs3
4. Suppose you want to generate series with first difference
5. generate fdpop = d.pop
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
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
Welcome to meo school of research
WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan
PRAY FOR MY TEACHERS AND FAMILY VISIT MY BLOG FOR RESEAR TIPS AND ECONOMETRIC
TECHNIQUES SAEEDK8KHAN@GMAIL.COM