You are on page 1of 26

Welcome to meo school of research

WWW.SAEEDMEO.BLOGSPOT.COM
Muhammad saeed AAS Khan Meo, Superior university Lahore Pakistan

TIME SEREIS ANALYSIS USING STATA


PLEASE DONT EDIT THIS FILE
OR MY NAME , THANKS. if you want to
download this file search following link.

How to run regression using stata


Step #1:
Import data into STATA

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)

(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
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

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
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/)


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

= .87452691

Root MSE

= 83070.046

D.P

Coef.

Std. Err.

P>|t|

[95% Conf. Interval]

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

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
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#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
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
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
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:
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

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

-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
SAEEDK8KHAN@GMAIL.COM

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
SAEEDK8KHAN@GMAIL.COM

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
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

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.

P>|z|

[95% Conf. Interval]

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

Long run causality value must be


negative and in between 01..which indicate error
correction term ,speed of
adjustment

YU

Short run causality

EX

HE

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 .
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

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

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|

[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

-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

Step#4 for short run granger causality/wald test


Statistics > Multivariate time series > VAR diagnostics and tests > Granger causality tests

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


dependent variables while YU,EX, HDI
ETC INDEPENDNET VARIAELS,

. vargranger
Granger causality Wald tests
Equation

Excluded

chi2

df Prob > 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

IN THE SECOND ROW OF RIGTHT SIDE


FIRST COLUM, SHOWING THT EX
JOINTLY GRANGER CUSE P IN SHORT
RUN . AS NULL HYPOTHESIS WAS NO
GRANGER CASUE AS PROBABLITY VALUE
IS LEST THAN 5% SO I CAN SAY HERE
THAT I HAVE TO ACCEPT ALTERNATIVE
HYPOTHESIS

Panel data Models


How to take panel unit root
Statistics > Longitudinal/panel data > Linear models > Linear regression (FE, RE, PA, BE)
Setep#1
Give first id with following command..
egen country1=group( country) (note: if you have countries data)
egen Company1=group( Company)
panel

(note: if you have companies data) means declare data

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

Click on unit root test

Step#2

Select variables to which u


want to take unit root

Select if u
need
suppose u
want to add
time trend
the check
first option

Select test type


Set time and give panel
id to cross sections

Select optimal lags ,suppose


one

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

Panel data analysis from start to end..


Polled, random ,fixed effect ,hausman test.
1.import your data file into stata
2.now create a pool or simple stata give codes to each cross section or entity like if you have
different countries data or companies the u have to give specific code all countries or
companies, further if you have assign code by yourself suppose u did not write company name
like nestles but you indicated nestle with 111 now u see you have already given the code but
if you have simple right the name of company then u need to give also code
egen country1=group( country) (note: if you have countries data)
egen Company1=group( Company)

(note: if you have companies data)

3.now set time which is most important


xtset Company1 year, yearly (note: hear I have yearly data and company1 is new variable
which I genrate in step 2)
4.now look at descriptive statistics
Xtsum variable1 variabel2
xtsum ENVC EPS ROA ROE ROC
4.1 suppose u want to make a graph
xtline CO2 energy gdp gi
4.2 for description of data
xtdescribe
5. Now run fixed effect model
Xtreg dependent variable1 independent variable 1234456,fe
xtreg ENVC EPS ROA ROE,fe
Now store result of fixed effect from this command
6.estimate store fe

( if u want to run by Manu Statistics > Postestimation )

7. Now run random effect model


xtreg dep indep1 indep2 indep3, re

(replace with your variables name)

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}

PANEL ARDL USING STATA


1) First of all install this package to run PANEL ARDL ssc install xtpmg, replace
2) Suppose you think you have installed this package but still you are not sure then type in
command bar type xtpmg
3) If u see message of no found then install otherwise you have already install it.
here we shall Run MG (average):
xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace mg
here we shall Run MG (individual):
(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.)

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

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
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

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.

How to run DOLS model


Setpe# import data
Step#2 install following package
ssc install ltimbimata, replace
Step#3 Before beginning the estimations, we use the set more off instruction to tell Stata not to
pause when displaying the output.
set more off
Step#4 now run dols model, we regress iskr (dependent variable) on the regressors (gdskr
irxmap1 defigd2 ltinflcd opins2 totwdct ltdgdpd).
xtdolshm iskr gdskr irxmap1 defigd2 ltinflcd opins2 totwdct ltdgdpd
Step#5 if you want to increase lags and leads
xtdolshm iskr gdskr irxmap1 defigd2 ltinflcd opins2 totwdct, nla(3) nle(4)
step#6 if you want estimation at 10 % level of significance
xtdolshm iskr gdskr irxmap1 defigd2 ltinflcd opins2 totwdct, nla(3) nle(4) level(90)

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

Primary data analysis


Step#1
Suppose I want to see descriptive statistics of my variables
summarize cs1 cs2 cs3 cs4

(cs1,2,3 and 4 are my variables)

step#2
*suppose you want to know about correlation among variables
correlate cs1 cs2 cs3 cs4

(cs1,2,3 and 4 are my variables)

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

( cs1 cs2 cs3 cs4 are my items)

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

( cs1 cs2 cs3 cs4 are my items)

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

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
PCA)

(suppose cs1,2,3 and 4 are my variables which are made after


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

How to get help from stata


Suppose you are running any test but at some points you got confused/ stuck so how u can
precede now, suppose I was running panel unit root but I was not sure about null hypothesis
of different test how I can precede now? So to get rid of this problem see following pics and
enjoy.

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

You might also like