1. Descriptive Tools, Regression, Panel Data
Feb 23, 2016
1. Descriptive Tools, Regression, Panel Data
Model Building in Econometrics
• Parameterizing the model• Nonparametric analysis• Semiparametric analysis• Parametric analysis
• Sharpness of inferences follows from the strength of the assumptions
A Model Relating (Log)Wage to Gender and Experience
Cornwell and Rupert Panel DataCornwell and Rupert Returns to Schooling Data, 595 Individuals, 7 YearsVariables in the file areEXP = work experienceWKS = weeks workedOCC = occupation, 1 if blue collar, IND = 1 if manufacturing industrySOUTH = 1 if resides in southSMSA = 1 if resides in a city (SMSA)MS = 1 if marriedFEM = 1 if femaleUNION = 1 if wage set by union contractED = years of educationLWAGE = log of wage = dependent variable in regressionsThese data were analyzed in Cornwell, C. and Rupert, P., "Efficient Estimation with Panel Data: An Empirical Comparison of Instrumental Variable Estimators," Journal of Applied Econometrics, 3, 1988, pp. 149-155.
Nonparametric RegressionKernel regression of y on x
Semiparametric Regression: Least absolute deviations regression of y on x
Parametric Regression: Least squares – maximum likelihood – regression of y on x
Application: Is there a relationship between Log(wage) and Education?
A First Look at the DataDescriptive Statistics
• Basic Measures of Location and Dispersion
• Graphical Devices• Box Plots• Histogram• Kernel Density Estimator
Box Plots
From Jones and Schurer (2011)
Histogram for LWAGE
The kernel density estimator is ahistogram (of sorts).
n i mm mi 1
** *x x1 1f̂(x ) K , for a set of points x
n B B
B "bandwidth" chosen by the analystK the kernel function, such as the normal or logistic pdf (or one of several others)x* the point at which the density is approximated.This is essentially a histogram with small bins.
Kernel Density Estimator
n i mm mi 1
** *x x1 1f̂(x ) K , for a set of points x
n B B
B "bandwidth"K the kernel functionx* the point at which the density is approximated.
f̂(x*) is an estimator of f(x*)1
The curse of dimensionality
nii 1
3/5
Q(x | x*) Q(x*). n
1 1But, Var[Q(x*)] Something. Rather, Var[Q(x*)] * SomethingN N
ˆI.e.,f(x*) does not converge to f(x*) at the same rate as a meanconverges to a population mean.
Kernel Estimator for LWAGE
From Jones and Schurer (2011)
Objective: Impact of Education on (log) Wage
• Specification: What is the right model to use to analyze this association?
• Estimation• Inference• Analysis
Simple Linear RegressionLWAGE = 5.8388 + 0.0652*ED
Multiple Regression
Specification: Quadratic Effect of Experience
Partial Effects
Education: .05654Experience .04045 - 2*.00068*ExpFEM -.38922
Model Implication: Effect of Experience and Male vs. Female
Hypothesis Test About Coefficients• Hypothesis
• Null: Restriction on β: Rβ – q = 0• Alternative: Not the null
• Approaches• Fitting Criterion: R2 decrease under the null?• Wald: Rb – q close to 0 under the
alternative?
HypothesesAll Coefficients = 0?R = [ 0 | I ] q = [0]
ED Coefficient = 0?R = 0,1,0,0,0,0,0,0,0,0,0q = 0
No Experience effect?R = 0,0,1,0,0,0,0,0,0,0,0 0,0,0,1,0,0,0,0,0,0,0q = 0 0
Hypothesis Test Statistics
2
2 21 0
121 1
Subscript 0 = the model under the null hypothesisSubscript 1 = the model under the alternative hypothesis
1. Based on the Fitting Criterion R
(R -R ) / J F = =F[J,N-K ]
(1-R ) / (N-K )
2. Bas
-12 -1
1 1
ed on the Wald Distance : Note, for linear models, W = JF.
Chi Squared = ( - ) s ( ) ( - )Rb q R X X R Rb q
Hypothesis: All Coefficients Equal Zero
All Coefficients = 0?R = [0 | I] q = [0]R1
2 = .41826R0
2 = .00000F = 298.7 with [10,4154]Wald = b2-11[V2-11]-1b2-11
= 2988.3355Note that Wald = JF = 10(298.7)(some rounding error)
Hypothesis: Education Effect = 0ED Coefficient = 0?R = 0,1,0,0,0,0,0,0,0,0,0,0q = 0R1
2 = .41826R0
2 = .35265 (not shown)F = 468.29Wald = (.05654-0)2/(.00261)2
= 468.29Note F = t2 and Wald = FFor a single hypothesis about 1 coefficient.
Hypothesis: Experience Effect = 0No Experience effect?R = 0,0,1,0,0,0,0,0,0,0,0 0,0,0,1,0,0,0,0,0,0,0q = 0 0R0
2 = .33475, R12 = .41826
F = 298.15Wald = 596.3 (W* = 5.99)
Built In Test
Robust Covariance Matrix
• What does robustness mean?• Robust to: Heteroscedasticty• Not robust to:
• Autocorrelation• Individual heterogeneity• The wrong model specification
• ‘Robust inference’
-1 2 -1i i ii
The White Estimator
Est.Var[ ] = ( ) e ( )b X X x x X X
Robust Covariance Matrix
Uncorrected
Bootstrapping and Quantile Regresion
Estimating the Asymptotic Variance of an Estimator
• Known form of asymptotic variance: Compute from known results
• Unknown form, known generalities about properties: Use bootstrapping• Root N consistency• Sampling conditions amenable to central limit
theorems• Compute by resampling mechanism within the
sample.
BootstrappingMethod:
1. Estimate parameters using full sample: b2. Repeat R times:
Draw n observations from the n, with replacement
Estimate with b(r). 3. Estimate variance with
V = (1/R)r [b(r) - b][b(r) - b]’ (Some use mean of replications instead of b.
Advocated (without motivation) by original designers of the method.)
Application: Correlation between Age and Education
Bootstrap Regression - Replications
namelist;x=one,y,pg$ Define Xregress;lhs=g;rhs=x$ Compute and
display bproc Define
procedureregress;quietly;lhs=g;rhs=x$ … Regression
(silent)endproc Ends
procedureexecute;n=20;bootstrap=b$ 20 bootstrap repsmatrix;list;bootstrp $ Display replications
--------+-------------------------------------------------------------Variable| Coefficient Standard Error t-ratio P[|T|>t] Mean of X--------+-------------------------------------------------------------Constant| -79.7535*** 8.67255 -9.196 .0000 Y| .03692*** .00132 28.022 .0000 9232.86 PG| -15.1224*** 1.88034 -8.042 .0000 2.31661--------+-------------------------------------------------------------Completed 20 bootstrap iterations.----------------------------------------------------------------------Results of bootstrap estimation of model.Model has been reestimated 20 times.Means shown below are the means of thebootstrap estimates. Coefficients shownbelow are the original estimates basedon the full sample.bootstrap samples have 36 observations.--------+-------------------------------------------------------------Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Mean of X--------+------------------------------------------------------------- B001| -79.7535*** 8.35512 -9.545 .0000 -79.5329 B002| .03692*** .00133 27.773 .0000 .03682 B003| -15.1224*** 2.03503 -7.431 .0000 -14.7654--------+-------------------------------------------------------------
Results of Bootstrap Procedure
Bootstrap Replications
Full sample result
Bootstrapped sample results
Quantile Regression• Q(y|x,) = x, = quantile• Estimated by linear programming• Q(y|x,.50) = x, .50 median regression• Median regression estimated by LAD (estimates
same parameters as mean regression if symmetric conditional distribution)
• Why use quantile (median) regression?• Semiparametric• Robust to some extensions (heteroscedasticity?)• Complete characterization of conditional distribution
Estimated Variance for Quantile Regression
• Asymptotic Theory
• Bootstrap – an ideal application
1 1
Model : , ( | , ) , [ , ] 0ˆˆResiduals: u
1Asymptotic Variance:
= E[f (0) ] Estimated by
Asymptotic Theory Based Estimator of Variance of Q - REGx | x
A C A
A xx
i i i i i i i i
i i i
u
y u Q y Q u
y
N
βx βx-βx
1
.2
1 1 1 ˆ1 | | BB 2
Bandwidth B can be Silverman's Rule of Thumb: ˆ ˆ( | .75) ( | .25)1.06 ,
1.349(1- )(1- ) [ ] Estimated by
x x
C = xx
Ni i ii
i iu
uN
Q u Q uMin s
N
EN
12For =.5 and normally distributed u, this all simplifies to .2
But, this is an ideal application for bootstrapping
X
X
.
X
Xus
= .25
= .50
= .75
OLS vs. Least Absolute Deviations----------------------------------------------------------------------Least absolute deviations estimator...............Residuals Sum of squares = 1537.58603 Standard error of e = 6.82594Fit R-squared = .98284 Adjusted R-squared = .98180Sum of absolute deviations = 189.3973484--------+-------------------------------------------------------------Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Mean of X--------+------------------------------------------------------------- |Covariance matrix based on 50 replications.Constant| -84.0258*** 16.08614 -5.223 .0000 Y| .03784*** .00271 13.952 .0000 9232.86 PG| -17.0990*** 4.37160 -3.911 .0001 2.31661--------+-------------------------------------------------------------Ordinary least squares regression ............Residuals Sum of squares = 1472.79834 Standard error of e = 6.68059 Standard errors are based onFit R-squared = .98356 50 bootstrap replications Adjusted R-squared = .98256--------+-------------------------------------------------------------Variable| Coefficient Standard Error t-ratio P[|T|>t] Mean of X--------+-------------------------------------------------------------Constant| -79.7535*** 8.67255 -9.196 .0000 Y| .03692*** .00132 28.022 .0000 9232.86 PG| -15.1224*** 1.88034 -8.042 .0000 2.31661--------+-------------------------------------------------------------
Nonlinear Models
Nonlinear Models• Specifying the model
• Multinomial Choice• How do the covariates relate to the
outcome of interest• What are the implications of the
estimated model?
Unordered Choices of 210 Travelers
Data on Discrete Choices
Specifying the Probabilities• Choice specific attributes (X) vary by choices, multiply by generic coefficients. E.g., TTME=terminal time, GC=generalized cost of travel mode• Generic characteristics (Income, constants) must be interacted
with choice specific constants. • Estimation by maximum likelihood; dij = 1 if person i chooses j
],
itj it i,t,j i,t,k
j itj j itJ(i,t)
j itj j itj=1
N J(i)iji=1 j=1
P[choice = j | , ,i, t] = Prob[U U k = 1,...,J(i, t)
exp(α + + ' ) =
exp(α + ' + ' )
logL = d lo
x zβ'x γ z
β x γ z
ijgP
Estimated MNL Model
],
itj it i,t,j i,t,k
j itj j itJ(i,t)
j itj j itj=1
P[choice = j | , ,i,t] = Prob[U U k = 1,...,J(i, t)
exp(α + + ' ) =
exp(α + ' + ' )
x zβ'x γ z
β x γ z
Endogeneity
The Effect of Education on LWAGE
1 2 3 4 ... ε
What is ε? ,... + everything elAbil seity, Motivation
Ability, Motivation = f( , , , ,...)
LWAGE EDUC EXP
EDUC GENDER SMSA SOUTH
2EXP
What Influences LWAGE?
1 2
3 4
Ability, Motivation
Ability, Motivat
( , ,...)
... ε( )
Increased is associated with increases in
ion
AbilityAbility, Motivati( , ,on
LWAGE EDUC XEXP
EDUC X
2EXP
2
...) and ε( )What looks like an effect due to increase in maybe an increase in . The estimate of picks up the effect of and the hidden effect of .
Ability, Motivation
AbilityAbility
EDUC
EDUC
An Exogenous Influence
1 2
3 4
( , , ,...)
... ε( )
Increased is asso
Abili
ciate
ty, Motivation
Ability, Motivation
Ability, Motivad with increases in
( , , ,ti .n .o
LWAGE EDU Z
ZZ
C XEXP
EDUC X
2EXP
2
.) and not ε( )An effect due to the effect of an increase on willonly be an increase in . The estimate of picks up the effect of only.
Ability, Motiv
ationEDUC
EDUCED
Z
Z UCis an Instrumental Variable
Instrumental Variables• Structure
• LWAGE (ED,EXP,EXPSQ,WKS,OCC, SOUTH,SMSA,UNION)
• ED (MS, FEM)
• Reduced Form: LWAGE[ ED (MS, FEM), EXP,EXPSQ,WKS,OCC, SOUTH,SMSA,UNION ]
Two Stage Least Squares Strategy• Reduced Form:
LWAGE[ ED (MS, FEM,X), EXP,EXPSQ,WKS,OCC, SOUTH,SMSA,UNION ]
• Strategy • (1) Purge ED of the influence of everything but
MS, FEM (and the other variables). Predict ED using all exogenous information in the sample (X and Z).
• (2) Regress LWAGE on this prediction of ED and everything else.
• Standard errors must be adjusted for the predicted ED
The weird results for the coefficient on ED happened because the instruments, MS and FEM are dummy variables. There is not enough variation in these variables.
Source of Endogeneity• LWAGE = f(ED,
EXP,EXPSQ,WKS,OCC, SOUTH,SMSA,UNION) +
• ED = f(MS,FEM, EXP,EXPSQ,WKS,OCC, SOUTH,SMSA,UNION) + u
Remove the Endogeneity• LWAGE = f(ED,
EXP,EXPSQ,WKS,OCC, SOUTH,SMSA,UNION) + u +
• Strategy Estimate u Add u to the equation. ED is uncorrelated with
when u is in the equation.
Auxiliary Regression for ED to Obtain Residuals
OLS with Residual (Control Function) Added
2SLS
A Warning About Control Function
Endogenous Dummy Variable• Y = xβ + δT + ε (unobservable factors)• T = a dummy variable (treatment)• T = 0/1 depending on:
• x and z• The same unobservable factors
• T is endogenous – same as ED
Application: Health Care Panel DataGerman Health Care Usage Data,Variables in the file areData downloaded from Journal of Applied Econometrics Archive. This is an unbalanced panel with 7,293 individuals. They can be used for regression, count models, binary choice, ordered choice, and bivariate binary choice. This is a large data set. There are altogether 27,326 observations. The number of observations ranges from 1 to 7. (Frequencies are: 1=1525, 2=2158, 3=825, 4=926, 5=1051, 6=1000, 7=987). DOCTOR = 1(Number of doctor visits > 0) HOSPITAL = 1(Number of hospital visits > 0) HSAT = health satisfaction, coded 0 (low) - 10 (high) DOCVIS = number of doctor visits in last three months HOSPVIS = number of hospital visits in last calendar year PUBLIC = insured in public health insurance = 1; otherwise = 0 ADDON = insured by add-on insurance = 1; otherswise = 0 HHNINC = household nominal monthly net income in German marks / 10000. (4 observations with income=0 were dropped) HHKIDS = children under age 16 in the household = 1; otherwise = 0 EDUC = years of schooling AGE = age in years MARRIED = marital status EDUC = years of education
A study of moral hazardRiphahn, Wambach, Million: “Incentive Effects in the Demand for Healthcare”Journal of Applied Econometrics, 2003
Did the presence of the ADDON insurance influence the demand for health care – doctor visits and hospital visits?
For a simple example, we examine the PUBLIC insurance (89%) instead of ADDON insurance (2%).
Evidence of Moral Hazard?
Regression Study
Endogenous Dummy Variable
• Doctor Visits = f(Age, Educ, Health, Presence of Insurance, Other unobservables)
• Insurance = f(Expected Doctor Visits, Other unobservables)
Approaches• (Parametric) Control Function: Build a
structural model for the two variables (Heckman)
• (Semiparametric) Instrumental Variable: Create an instrumental variable for the dummy variable (Barnow/Cain/ Goldberger, Angrist, current generation of researchers)
• (?) Propensity Score Matching (Heckman et al., Becker/Ichino, Many recent researchers)
Heckman’s Control Function Approach• Y = xβ + δT + E[ε|T] + {ε - E[ε|T]}• λ = E[ε|T] , computed from a model for whether T = 0 or 1
Magnitude = 11.1200 is nonsensical in this context.
Instrumental Variable Approach• Construct a prediction for T using only the exogenous information• Use 2SLS using this instrumental variable.
Magnitude = 23.9012 is also nonsensical in this context.
Propensity Score Matching• Create a model for T that produces probabilities for T=1: “Propensity
Scores”• Find people with the same propensity score – some with T=1, some
with T=0• Compare number of doctor visits of those with T=1 to those with T=0.
Panel Data
Benefits of Panel Data• Time and individual variation in behavior
unobservable in cross sections or aggregate time series
• Observable and unobservable individual heterogeneity
• Rich hierarchical structures• More complicated models• Features that cannot be modeled with only
cross section or aggregate time series data alone
• Dynamics in economic behavior
Application: Health Care UsageGerman Health Care Usage Data This is an unbalanced panel with 7,293 individuals. There are altogether 27,326 observations. The number of observations ranges from 1 to 7. Frequencies are: 1=1525, 2=2158, 3=825, 4=926, 5=1051, 6=1000, 7=987. Downloaded from the JAE Archive.Variables in the file include DOCTOR = 1(Number of doctor visits > 0) HOSPITAL = 1(Number of hospital visits > 0) HSAT = health satisfaction, coded 0 (low) - 10 (high) DOCVIS = number of doctor visits in last three months HOSPVIS = number of hospital visits in last calendar year PUBLIC = insured in public health insurance = 1; otherwise = 0 ADDON = insured by add-on insurance = 1; otherswise = 0 INCOME = household nominal monthly net income in German marks / 10000. (4 observations with income=0 will sometimes be dropped) HHKIDS = children under age 16 in the household = 1; otherwise = 0 EDUC = years of schooling AGE = age in years MARRIED = marital status
Balanced and Unbalanced Panels• Distinction: Balanced vs. Unbalanced
Panels• A notation to help with mechanics
zi,t, i = 1,…,N; t = 1,…,Ti• The role of the assumption
• Mathematical and notational convenience: Balanced, n=NT Unbalanced:
• Is the fixed Ti assumption ever necessary? Almost never.
• Is unbalancedness due to nonrandom attrition from an otherwise balanced panel? This would require special considerations.
Nii=1n T
An Unbalanced Panel: RWM’s GSOEP Data on Health Care