Vous êtes sur la page 1sur 21

Pham Thi Bich Ngoc, Ph.D.

(University of Kiel, Germany)


FEC/Hoa Sen University
ngoc.phamthibich@hoasen.edu.vn

UNIVERSITY OF ECONOMICS HOCHIMINHCITY, Aug 2014

Aug14 - Dr. Pham Thi Bich Ngoc 1


Learn and use STATA?
http://www.ats.ucla.edu/stat/stata/

Economic Analysis of Cross section and


Panel data - Jeffrey M. Wooldridge (2010)

Aug14 - Dr. Pham Thi Bich Ngoc 2


These are Models that Combine Cross-
section and Time-Series Data
In panel data the same cross-sectional unit
(industry, firm, country) is surveyed over
time, so we have data which is pooled over
space as well as time.

Aug14 - Dr. Pham Thi Bich Ngoc 3


1. Panel data can take explicit account of
individual-specific heterogeneity (individual
here means related to the microunit)
2. By combining data in two dimensions, panel
data gives more data variation, less collinearity
and more degrees of freedom.
3. Panel data is better suited than cross-
sectional data for studying the dynamics of
change. For example it is well suited to
understanding transition behaviour for
example company bankruptcy or merger.

Aug14 - Dr. Pham Thi Bich Ngoc 4


4. Panel data is better at detecting and
measuring effects that cannot be observed
in either cross-section or time-series data.
5. Panel data enables the study of more
complex behavioural models for example
the effects of technological change, or
economic cycles.
6. Panel data can minimise the effects of
aggregation bias, from aggregating firms
into broad groups.

Aug14 - Dr. Pham Thi Bich Ngoc 5


If all the cross-sectional units have the same number of time
series observations the panel is balanced, if not it is
unbalanced.
Cross section
y 11 y 21 y i 1 y N 1
y y 22 y i 2 y N 2
12
Time
series y y 2t y it

y Nt
1t


y 1T y 2T y iT y NT

- a matrix of balanced panel data observations on variable y,


N cross-sectional observations, T time series observations.

Aug14 - Dr. Pham Thi Bich Ngoc 6


Grunfeld and Griliches [1960]

Iit i Fit Cit it


i = 10 firms: GM, CH, GE, WE, US, AF, DM, GY, UN,
IBM; t = 20 years: 1935-1954
Iit = Gross investment
Fit = Market value
Cit = Value of the stock of plant and equipment

Aug14 - Dr. Pham Thi Bich Ngoc 7


yit t yit 1 ln(si ) ln(ni g d ) COM i OPECi it

yit = Real per capita GDP


si = Average saving rate (over 1960-1985)
ni = Average population growth rate (over 1960-1985)
g+d = 5%
COMi = 1 if communist, 0 otherwise
OPECi =1 if OPEC, 0 otherwise

Aug14 - Dr. Pham Thi Bich Ngoc 8


LWAGE = log of wage = dependent variable in regressions
EXP = work experience
WKS = weeks worked
OCC = occupation, 1 if blue collar,
IND = 1 if manufacturing industry
SOUTH = 1 if resides in south
SMSA = 1 if resides in a city (SMSA)
MS = 1 if married
FEM = 1 if female
UNION = 1 if wage set by union contract
ED = years of education
BLK = 1 if individual is black

Aug14 - Dr. Pham Thi Bich Ngoc 9


Two basic windows Other functions
Command Data browser/editor
Results Do file editor
Viewer (for log, help
Optional windows files, etc)
Variable list
History of commands

Aug14 - Dr. Pham Thi Bich Ngoc 10


The usual open, save, print
Log-file open/suspend/close
Do-file editor
Browse and Edit
Break

Aug14 - Dr. Pham Thi Bich Ngoc 11


Open draft-student.dta
Create .do file/.log file
A 3-factor Cobb- Douglas function (simple):
lnY = a0 + a1. lnK + a2. lnL + a3. lnM + ui
lnY: output
lnK: capital
lnL: labor
lnM: material

Aug14 - Dr. Pham Thi Bich Ngoc 12


Edited by Foxit Reader
Copyright(C) by Foxit Software Company,2005-2008
For Evaluation Only.

generate [varlist]
Create new variables

Replace if (==/ >/ </ >=/ <=)


drop if
keep if
count
count if

EG. gen D7=.


replace D7 =1 if year ==2007
replace D7=0 if year>2007

Aug14 - Dr. Pham Thi Bich Ngoc 13


summarize [varlist] [, detail]
# obs, mean, SD, range
, detail gets you more detail (median, etc)

Eg. sum lnY/lnK/lnL/lnM

ci [varlist]
Mean, standard error of mean, and confidence
intervals
Actually works for dichotomous variables, too.
Eg. ci lnY/lnK/lnL/lnM

Aug14 - Dr. Pham Thi Bich Ngoc 14


histogram varname
Simple histogram of your variable
Eg. histogram lnY
histogram lnY, frac
by(D7, title(Firm Sales in 2007 and the Rest")
subtitle("(in VND)")

qnorm varname
Quantile plot of your variable to check normality
Eg. qnorm lnY

Aug14 - Dr. Pham Thi Bich Ngoc 15


Edited by Foxit Reader
Copyright(C) by Foxit Software Company,2005-2008
For Evaluation Only.

tabulate [varname]
Counts and percentages
(see also, table - this is very different!)
tabulate [varname], missing

Eg. tab D7

Aug14 - Dr. Pham Thi Bich Ngoc 16


tabulate [var1] [var2]
Cross-tab
Descriptive options
, row (row percentages)
, col (column percentages)

Eg. tab D7 sectorcode if sectorcode<11

Aug14 - Dr. Pham Thi Bich Ngoc 17


Edited by Foxit Reader
Copyright(C) by Foxit Software Company,2005-2008
For Evaluation Only.

scatter [var1] [var2]


Scatterplot of the two variables
Extention:
twoway lfit[var1] [var2]
twoway scatter [var1] [var2]|| lfit [var1]
[var2]||, by(var3, total row(1))
twoway scatter [var1] [var2] || qfit [var1] [var2] ||,
by(var3, total row(1))
http://www.stata.com/support/faqs/graphics/gph/gr
aphdocs/twoway-linear-prediction-plot/index.html

Eg. Graph lnY to lnK (linear, scatter plots, quadratic), by D7

Aug14 - Dr. Pham Thi Bich Ngoc 18


Edited by Foxit Reader
Copyright(C) by Foxit Software Company,2005-2008
For Evaluation Only.

pwcorr [varlist] [, sig]


Pairwise correlations between variables
sig option gives p-values
spearman [varlist] [, stats(rho p)]
Eg: Correlation between lnY/lnK/lnL/lnM?

Aug14 - Dr. Pham Thi Bich Ngoc 19


Edited by Foxit Reader
Copyright(C) by Foxit Software Company,2005-2008
For Evaluation Only.

regress depvar [indepvars] [if] [in]


[weight] [, options]
regress fits a model of depvar on indepvars
using linear regression.
regress lnY lnK lnL lnM horizontal Bam Bch

Aug14 - Dr. Pham Thi Bich Ngoc 20


Edited by Foxit Reader
Copyright(C) by Foxit Software Company,2005-2008
For Evaluation Only.

regress lnY to lnK, lnL, lnM, horizontal, Bam, Bch


predict r, resid
kdensity r, normal

Checking Homoscedasticity of Residuals


rvfplot, yline(0)

Aug14 - Dr. Pham Thi Bich Ngoc 21

Vous aimerez peut-être aussi