Top Banner
[Topic 8-Random Parameters] 1/83 Topics in Microeconometrics William Greene Department of Economics Stern School of Business
83

Topics in Microeconometrics

Mar 24, 2016

Download

Documents

Minh

Topics in Microeconometrics. William Greene Department of Economics Stern School of Business. 8. Random Parameters and Hierarchical Linear Models. Heterogeneous Dynamic Model. “Fixed Effects” Approach. A Mixed/Fixed Approach. A Mixed Fixed Model Estimator. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Topics in Microeconometrics

[Topic 8-Random Parameters] 1/83

Topics in Microeconometrics

William GreeneDepartment of EconomicsStern School of Business

Page 2: Topics in Microeconometrics

[Topic 8-Random Parameters] 2/83

8. Random Parameters and Hierarchical Linear Models

Page 3: Topics in Microeconometrics

[Topic 8-Random Parameters] 3/83

Page 4: Topics in Microeconometrics

[Topic 8-Random Parameters] 4/83

Page 5: Topics in Microeconometrics

[Topic 8-Random Parameters] 5/83

Heterogeneous Dynamic Model

i,t i i i,t 1 i it i,t

ii

i

logY logY x

Long run effect of interest is 1

Average (over countries) effect: or 1

Page 6: Topics in Microeconometrics

[Topic 8-Random Parameters] 6/83

“Fixed Effects” Approachi,t i i i,t 1 i it i,t

ii

i

i i i

N Nii 1 i 1 i

iNi 1 i

Ni 1

logY logY x

, = 1 1ˆ ˆ(1) Separate regressions; , ,ˆ

ˆ1 1ˆ ˆ(2) Average estimates = orˆN N1ˆ(1/ N)ˆ Function of averages: =

1 (1/ N)

i

iN

ii=1

ˆIn each case, each term i has variance O(1/T)Each average has variance O(1/N) (1/N)O(1/T)Expect consistency of estimates of long run effects.

Page 7: Topics in Microeconometrics

[Topic 8-Random Parameters] 7/83

A Mixed/Fixed Approach

Ni,t i i 1 i i,t i,t 1 i i,t i,t

i,t

i i i

logy d logy xd = country specific dummy variable.Treat and as random, is a 'fixed effect.'This model can be fit consistently by OLS andefficiently by GLS.

Page 8: Topics in Microeconometrics

[Topic 8-Random Parameters] 8/83

A Mixed Fixed Model Estimator

Ni,t i i 1 i i,t i,t 1 i i,t i,t

i iN

i,t i i 1 i i,t i,t 1 i i,t i i,t i,t2 2 2

i i,t i,t w i,t

logy d logy x wlogy d logy x (wx )Heteroscedastic : Var[wx ]= xUse two step least squares.(1) Linear regressi

i,t

i,t-1 i,t2i,t

2 2w

on of logy on dummy variables, dummy variables times logy and x .(2) Regress squares of OLS residuals on x and 1 to estimate and .(3) Return to (1) but now use weighted least squares.

Page 9: Topics in Microeconometrics

[Topic 8-Random Parameters] 9/83

Baltagi and Griffin’s Gasoline DataWorld Gasoline Demand Data, 18 OECD Countries, 19 yearsVariables in the file are

COUNTRY = name of country YEAR = year, 1960-1978LGASPCAR = log of consumption per carLINCOMEP = log of per capita incomeLRPMG = log of real price of gasoline LCARPCAP = log of per capita number of cars

See Baltagi (2001, p. 24) for analysis of these data. The article on which the analysis is based is Baltagi, B. and Griffin, J., "Gasoline Demand in the OECD: An Application of Pooling and Testing Procedures," European Economic Review, 22, 1983, pp. 117-137.  The data were downloaded from the website for Baltagi's text.

Page 10: Topics in Microeconometrics

[Topic 8-Random Parameters] 10/83

Baltagi and Griffin’s Gasoline MarketCOUNTRY = name of country YEAR = year, 1960-1978LGASPCAR = log of consumption per car yLINCOMEP = log of per capita income zLRPMG = log of real price of gasoline x1LCARPCAP = log of per capita number of cars x2

yit = 1i + 2i zit + 3i x1it + 4i x2it + it.

Page 11: Topics in Microeconometrics

[Topic 8-Random Parameters] 11/83

FIXED EFFECTS

Page 12: Topics in Microeconometrics

[Topic 8-Random Parameters] 12/83

Parameter Heterogeneity

it i it

it i it

i i

i i

i i

X i i

i i

y cy

u , E[u | ] 0 --> Random effects E[u | ] 0 --> Fixed effects E E[u | ] 0. Var[u | ] not yet defined -

it

it

Unobserved Effects Random C x β

on

x β

XX

st

X

a

X

nts

so far, constant.

Page 13: Topics in Microeconometrics

[Topic 8-Random Parameters] 13/83

Parameter Heterogeneity

it it

i

i i

X i i

i i

y

E[ | ] zero or nonzero - to be definedE [E[ | ]] = Var[ | ] to be defined, constant or variable

it i

i

Generalize to x β

β β uu X

u X

Random Sl

0u X

opes

Page 14: Topics in Microeconometrics

[Topic 8-Random Parameters] 14/83

Fixed Effects (Hildreth, Houck, Hsiao, Swamy)

it it

i i

i

i

i i i

i i i i

X i i X i i

i

y , each observation, T observations

Assume (temporarily) T > K.E[ | ] =g( ) (conditional mean)P[ | ] =( -E[ ]) (projection)E [E[ | ]] = E [P[ | ]] =Var[ |

it i

i i i

i

x βy Xβ εβ β u

u X Xu X X X θ

u X u X 0u Xi] constant but nonzeroΓ

Page 15: Topics in Microeconometrics

[Topic 8-Random Parameters] 15/83

OLS and GLS Are Inconsistent

i i

i

i i i i

i i

i i i i i i

, T observations

, T observations

E[ | ] E[ | ] E[ | ]

i i i

i

i i

i

i

y Xβ εβ β uy Xβ Xu εy Xβ w

w X X u X ε X 0

Page 16: Topics in Microeconometrics

[Topic 8-Random Parameters] 16/83

Estimating the Fixed Effects Model

Ni 1

Estimator: Equation by equation OLS or (F)GLS1 ˆEstimate ? is consistent inN

1 1 1 1

2 2 2 2

N N N N

i

y X 0 ... 0 β εy 0 X ... 0 β ε... ... ... ... ... ... ...y 0 0 ... X β ε

β β N for E[ ].iβ

Page 17: Topics in Microeconometrics

[Topic 8-Random Parameters] 17/83

Random Effects and Random Parameters

it it

i i

i

i

i i

i i

Random Parameters Modely , each observation

, T observations

Assume (temporarily) T > K.E[ | ] =Var[ | ] constant but nonzero

it i

i i i

i

THEx β

y Xβ εβ β u

u X 0u X Γ

Page 18: Topics in Microeconometrics

[Topic 8-Random Parameters] 18/83

Estimating the Random Parameters Model

i i

i

i i i i

i i

i i i i i i2 2

i i i i ,i ,i2,i

, T observations

, T observations

E[ | ] E[ | ] E[ | ]Var[ | ] Should vary by i?

,

i i i

i

i i

i

i

y Xβ εβ β uy Xβ Xu εy Xβ w

w X X u X ε X 0w X XΓX I <==

Objects of estimation: β, ΓSecond le ivel estimation: β

Page 19: Topics in Microeconometrics

[Topic 8-Random Parameters] 19/83

Estimating the Random Parameters Model by OLS

i i

i

i i i i

i iN 1 Ni 1 i i i 1 i i

N 1 Ni 1 i i i 1 i i

N 1 Ni 1 i i i 1 i i

, T observations

, T observations

= [ ] [ ] = [ ] [ ]

[ ]= [ ] [ (

i i i

i

i i

i

y Xβ εβ β uy Xβ Xu εy Xβ wb XX Xy

β XX XwVar b| X XX X XΓ

2 N 1i i 1 i i

2 N 1 N 1 N N 1i 1 i i i 1 i i i 1 i i i i 1 i i

) ][ ] = [ ] [ ] [ ( ) ( )][ ] = the usual + the variation due to the random parametersRobust estimatorE

X I X XXXX XX XX Γ XX XX

N 1 N N 1i 1 i i i 1 i i i i i 1 i iˆ ˆst.Var[ ] [ ] [ ][ ]b XX Xw w X XX

Page 20: Topics in Microeconometrics

[Topic 8-Random Parameters] 20/83

Estimating the Random Parameters Model by GLS

i i

i

i i i i2

i i i i i i ,iN 1 Ni 1 i i i 1 i i

2,i

, T observations

, T observations, Var[ | ] = =( )

ˆ [ ] [ ]ˆFor FGLS, we need and .ˆ

i i i

i

i i

i i

-1 -1i i

y Xβ εβ β uy Xβ Xu εy Xβ w w X Ω XΓX Iβ XΩ X XΩ y

Γ

Page 21: Topics in Microeconometrics

[Topic 8-Random Parameters] 21/83

Estimating the RPM

i

1

1

2 1,i

T 22 t 1 it,i

i

i

( ) , = + = ( )Var[ | ]= + ( )

(y ) is unbiasedˆ T K(but not consistent because T is fixed).

i i i i i i i i i

i i i i i

i i i i

it i

b β X X X w w Xu εβ u X X Xεb X Γ X X

x b

Page 22: Topics in Microeconometrics

[Topic 8-Random Parameters] 22/83

An Estimator for Γ

2 1,i

X X2 1

X ,i2 1

X ,i

i

E[ | ]Var[ | ]= + ( )Var[ ] Var E[ | ] E Var[ | ] = 0 E [ + ( ) ] +E [ ( ) ]

1Estimate Var[ ] with N

i i

i i i i

i i i i i

i i

i i

i

b X βb X Γ X Xb b X b X

Γ X XΓ X X

b

N1

2 1 N 2 1X ,i i 1 ,i

N N 2 1i 1 i 1 ,i

( )( )1EstimateE [ ( ) ] with ( )ˆN

1 1ˆ= ( )( ) ( )ˆN N

i i

i i i i

i i i i

b b b b '

X X X X

Γ b b b b ' - X X

Page 23: Topics in Microeconometrics

[Topic 8-Random Parameters] 23/83

A Positive Definite Estimator for Γ

N N 2 1i 1 i 1 ,i

i

1 1ˆ= ( )( ) - ( )ˆN NMay not be positive definite. What to do?(1) The second term converges (in theory) to 0 in T. Drop it.(2) Various Bayesian "shrinkage" estimators,(3)

i i i iΓ b b b b ' X X

An ML estimator

Page 24: Topics in Microeconometrics

[Topic 8-Random Parameters] 24/83

Estimating βi

Ni 1

N 2 1 1 2 1i 1 ,i ,i

2 1 1 1,i

ˆ{ [ ( ) ]} [ ( ) ]

Best linear unbiased predictor based on GLS isˆ ˆ ˆ + ( - ) ( )

{ [ ( ) ] }

GLS i i,OLS

i i i i i

i i GLS i i,OLS i,OLS i GLS i,OLS-1

i i i

β WbW Γ X X Γ X X

β Aβ I A b b A β bA Γ X X Γ

ˆ ˆVar[ | all data]= Var[ ]ˆVar[ ] Var[ ] [ ( - )] ( - )Var[ ] Var[ ]

-1

i i GLS i

GLS i,OLS i ii i

ii,OLS i i,OLS

β A β Aβ b W AA I A I AW b b

Page 25: Topics in Microeconometrics

[Topic 8-Random Parameters] 25/83

OLS and FGLS Estimates+----------------------------------------------------+| Overall OLS results for pooled sample. || Residuals Sum of squares = 14.90436 || Standard error of e = .2099898 || Fit R-squared = .8549355 |+----------------------------------------------------++---------+--------------+----------------+--------+---------+|Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] |+---------+--------------+----------------+--------+---------+ Constant 2.39132562 .11693429 20.450 .0000 LINCOMEP .88996166 .03580581 24.855 .0000 LRPMG -.89179791 .03031474 -29.418 .0000 LCARPCAP -.76337275 .01860830 -41.023 .0000+------------------------------------------------+| Random Coefficients Model || Residual standard deviation = .3498 || R squared = .5976 || Chi-squared for homogeneity test = 22202.43 || Degrees of freedom = 68 || Probability value for chi-squared= .000000 |+------------------------------------------------++---------+--------------+----------------+--------+---------+|Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] |+---------+--------------+----------------+--------+---------+ CONSTANT 2.40548802 .55014979 4.372 .0000 LINCOMEP .39314902 .11729448 3.352 .0008 LRPMG -.24988767 .04372201 -5.715 .0000 LCARPCAP -.44820927 .05416460 -8.275 .0000

Page 26: Topics in Microeconometrics

[Topic 8-Random Parameters] 26/83

Best Linear Unbiased Country Specific Estimates

Page 27: Topics in Microeconometrics

[Topic 8-Random Parameters] 27/83

Estimated Price Elasticities

Est imated Country Specific Price E last icit ies

CN TRY

-.40

-.30

-.20

-.10

.00

-.502 4 6 8 10 12 14 16 180

ELAS

T

Page 28: Topics in Microeconometrics

[Topic 8-Random Parameters] 28/83

Estimated Γ

Page 29: Topics in Microeconometrics

[Topic 8-Random Parameters] 29/83

Two Step Estimation (Saxonhouse)

it i it

i

i

it it

A Fixed Effects Model ySecondary Model Two approaches(1) Reduced form is a linear model with time constant z y(2) Two step (a) FEM at step 1

it

i

it i

x β

x β zδ

i i i i i

2 1i i

i

i

(b) a (a ) v1 Var[v ] ( )T

Use weighted least squares regression of a on

i

ii D i i

i

x XM X x

z

Page 30: Topics in Microeconometrics

[Topic 8-Random Parameters] 30/83

A Hierarchical Model

it i it

i i i

i

it i it

Fixed Effects ModelySecondary Model

u <======== (No u in Saxonhouse)Two approaches(1) Reduced form is an REM with time constant zy u(2) Two step (a) FE

it

i

it i

x β

x β zδ

i i i i i i

2 2 1i i u i

i

M at step 1 (b) a (a ) u v

1 Var[u v ] ( )T

i

ii D i i

x XM X x

Page 31: Topics in Microeconometrics

[Topic 8-Random Parameters] 31/83

Analysis of Fannie Mae• Fannie Mae• The Funding Advantage• The Pass Through

Passmore, W., Sherlund, S., Burgess, G., “The Effect of Housing Government-Sponsored Enterprises on Mortgage Rates,” 2005, Real Estate Economics

Page 32: Topics in Microeconometrics

[Topic 8-Random Parameters] 32/83

Two Step Analysis of Fannie-Mae

0 1 2 3i,s,t s,t s,t s,t i,s,t s,t i,s,t

4 5s,t i,s,t s,t i,s,t s,t i,s,t i,s,t

Fannie Mae's GSE Funding Advantage and Pass ThroughRM ( LTV) Small Fees New MtgCo Ji,s, t individual,state,month

1,036,252 observations in 370 state,months.

RM mortgageLTV= 3 dummy variables for loan to valueSmall = dummy variable for small loanFees = dummy variable for whether fees paid up frontNew = dummy varia

ble for new homeMtgCo = dummy variable for mortgage companyJ = dummy variable for whether this is a JUMBO loan THIS IS THE COEFFICIENT OF INTEREST.

Page 33: Topics in Microeconometrics

[Topic 8-Random Parameters] 33/83

Average of 370 First Step RegressionsSymbol Variable Mean S.D. Coeff S.E.RM Rate % 7.23 0.79J Jumbo 0.06 0.23 0.16 0.05LTV1 75%-80% 0.36 0.48 0.04 0.04LTV2 81%-90% 0.15 0.35 0.17 0.05LTV3 >90% 0.22 0.41 0.15 0.04New New

Home0.17 0.38 0.05 0.04

Small < $100,000

0.27 0.44 0.14 0.04

Fees Fees paid 0.62 0.52 0.06 0.03MtgCo Mtg. Co. 0.67 0.47 0.12 0.05

R2 = 0.77

Page 34: Topics in Microeconometrics

[Topic 8-Random Parameters] 34/83

Second Step Uses 370 Estimates of st

s,t 0

1 s,t

2 s,t

3 s,t

4 s,t

5 s,t

6

GSE Funding Advantage - estimated separately Risk free cost of credit Corporate debt spreads - estimated 4 different ways Prepayment spread Maturity mismatch risk A

s,t

7 s,t

8 s,t

9 s,t

10-13 s,t

14-16 s,t

ggregate Demand Long term interest rate Market Capacity Time trend

4 dummy variables for CA, NJ , MD, VA 3 dummy variables for calendar quarters

Page 35: Topics in Microeconometrics

[Topic 8-Random Parameters] 35/83

Estimates of β1

Second step based on 370 observations. Corrected for"heteroscedasticity, autocorrelation, and monthly clustering."Four estimates based on different estimates of corporatecredit spread:0.07 (0.11) 0

11 121 11 2 3 4

1 1 1 1 1 1 1 1 31 141 1

.31 (0.11) 017 (0.10) 0.10 (0.11)Reconcile the 4 estimates with a minimum distance estimator

ˆ( - )ˆ( - )ˆˆ ˆ ˆ ˆMinimize [( - ),( - ),( - ),( - )]' ˆ( - )ˆ( - )

-1Ω

Estimated mortgage rate reduction: About 7 basis points. .07%.

Page 36: Topics in Microeconometrics

[Topic 8-Random Parameters] 36/83

RANDOM EFFECTS - CONTINUOUS

Page 37: Topics in Microeconometrics

[Topic 8-Random Parameters] 37/83

Continuous Parameter Variation (The Random Parameters Model)

it it

i i

i

i i

i i

i i i

i

y , each observation, T observations

E[ | ] = Var[ | ] constant but nonzerof( | )= g( , ), a density that does not involve

it i

i i i

i

x βy Xβ εβ β u

u X 0u X Γ

u X u ΓX

Page 38: Topics in Microeconometrics

[Topic 8-Random Parameters] 38/83

OLS and GLS Are Consistent

i i

i

i i i i

i i

i i i i i i2

i i i i

, T observations

, T observations

E[ | ] E[ | ] E[ | ]Var[ | ](Discussed earlier - two step GLS)

i i i

i

i i

i

i

y Xβ εβ β uy Xβ Xu εy Xβ w

w X X u X ε X 0w X I XΓX

Page 39: Topics in Microeconometrics

[Topic 8-Random Parameters] 39/83

ML Estimation of the RPM

i

i

i,t i,t

Ti1 iT itt 1

it

Sample data generationyIndividual heterogeneity

Conditional log likelihoodlog f(y ,..., y | , , ) log f(y | , , )Unconditional log likelihoodlogL( , ) log f(y |

i,t i

i i

i i it i

x β

β =β u

X β x β

β,Γ

iTt 1

i

, , )g( | , )d(1) Using simulated ML or quadrature, maximize to estimate , .(2) Using data and estimated structural parameters, compute E[ | data, , ]

iit i i iβ

i

x β β β Γ β

β,Γ

β β,Γ

Page 40: Topics in Microeconometrics

[Topic 8-Random Parameters] 40/83

RP Gasoline Market

Page 41: Topics in Microeconometrics

[Topic 8-Random Parameters] 41/83

Parameter Covariance matrix

Page 42: Topics in Microeconometrics

[Topic 8-Random Parameters] 42/83

RP vs. Gen1

Page 43: Topics in Microeconometrics

[Topic 8-Random Parameters] 43/83

Modeling Parameter Heterogeneity

i,t i,t

i,k i k

Conditional Linear RegressionyIndividual heterogeneity in the means of the parameters

+ E[ | , ]Heterogeneity in the variances of the parametersVar[u | data] exp(

i,t i

i i i

i i i

i

x β

β =β Δz uu X z

h )Estimation by maximum simulated likelihood

Page 44: Topics in Microeconometrics

[Topic 8-Random Parameters] 44/83

Hierarchical Linear ModelCOUNTRY = name of country YEAR = year, 1960-1978LGASPCAR = log of consumption per car yLINCOMEP = log of per capita income zLRPMG = log of real price of gasoline x1LCARPCAP = log of per capita number of cars x2

yit = 1i + 2i x1it + 3i x2it + it.

1i=1+1 zi + u1i 2i=2+2 zi + u2i 3i=3+3 zi + u3i

Page 45: Topics in Microeconometrics

[Topic 8-Random Parameters] 45/83

Estimated HLM

Page 46: Topics in Microeconometrics

[Topic 8-Random Parameters] 46/83

RP vs. HLM

Page 47: Topics in Microeconometrics

[Topic 8-Random Parameters] 47/83

Hierarchical Bayesian Estimation2

i,t i,t i,t

i

Sample data generation: y , ~ N[0, ]Individual heterogeneity: , u ~N[ ]What information exists about 'the model?'

p(log )= uni

i,t i

i i

x ββ =β u 0,Γ

Prior densities for structural parameters :0

0 0

form density with (large) parameter A p( ) = N[ , ], e.g., and (large) vp( ) = Inverse Wishart[...]

p( )= N[ , ]p( ) = as above.

0

i

β β Σ 0 IΓ

Priors for parameters of interest :β β Γ

Page 48: Topics in Microeconometrics

[Topic 8-Random Parameters] 48/83

Estimation of Hierarchical Bayes Models

(1) Analyze 'posteriors' for hyperparameters ,(2) Analyze posterior for group level parameters, Estimators are Means and Variances of posterior distributions. Algorithm: Generally,

i

β,Γβ

Gibbs sampling from posteriors with resort to laws of large numbers

Page 49: Topics in Microeconometrics

[Topic 8-Random Parameters] 49/83

A Hierarchical Linear ModelGerman Health Care DataHsat = β1 + β2AGEit + γi EDUCit + β4 MARRIEDit + εit

γi = α1 + α2FEMALEi + ui

Sample ; all $Setpanel ; Group = id ; Pds = ti $Regress ; For [ti = 7] ; Lhs = newhsat ; Rhs = one,age,educ,married ; RPM = female ; Fcn = educ(n) ; pts = 25 ; halton ; panel ; Parameters$Sample ; 1 – 887 $Create ; betaeduc = beta_i $Dstat ; rhs = betaeduc $Histogram ; Rhs = betaeduc $

Page 50: Topics in Microeconometrics

[Topic 8-Random Parameters] 50/83

OLS ResultsOLS Starting values for random parameters model...Ordinary least squares regression ............LHS=NEWHSAT Mean = 6.69641 Standard deviation = 2.26003 Number of observs. = 6209Model size Parameters = 4 Degrees of freedom = 6205Residuals Sum of squares = 29671.89461 Standard error of e = 2.18676Fit R-squared = .06424 Adjusted R-squared = .06378Model test F[ 3, 6205] (prob) = 142.0(.0000)--------+--------------------------------------------------------- | Standard Prob. Mean NEWHSAT| Coefficient Error z z>|Z| of X--------+---------------------------------------------------------Constant| 7.02769*** .22099 31.80 .0000 AGE| -.04882*** .00307 -15.90 .0000 44.3352 MARRIED| .29664*** .07701 3.85 .0001 .84539 EDUC| .14464*** .01331 10.87 .0000 10.9409--------+---------------------------------------------------------

Page 51: Topics in Microeconometrics

[Topic 8-Random Parameters] 51/83

Maximum Simulated LikelihoodNormal exit: 27 iterations. Status=0. F= 12584.28------------------------------------------------------------------Random Coefficients LinearRg ModelDependent variable NEWHSATLog likelihood function -12583.74717Estimation based on N = 6209, K = 7Unbalanced panel has 887 individualsLINEAR regression modelSimulation based on 25 Halton draws--------+--------------------------------------------------------- | Standard Prob. Mean NEWHSAT| Coefficient Error z z>|Z| of X--------+--------------------------------------------------------- |Nonrandom parametersConstant| 7.34576*** .15415 47.65 .0000 AGE| -.05878*** .00206 -28.56 .0000 44.3352 MARRIED| .23427*** .05034 4.65 .0000 .84539 |Means for random parameters EDUC| .16580*** .00951 17.43 .0000 10.9409 |Scale parameters for dists. of random parameters EDUC| 1.86831*** .00179 1044.68 .0000 |Heterogeneity in the means of random parameterscEDU_FEM| -.03493*** .00379 -9.21 .0000 |Variance parameter given is sigmaStd.Dev.| 1.58877*** .00954 166.45 .0000--------+---------------------------------------------------------

Page 52: Topics in Microeconometrics

[Topic 8-Random Parameters] 52/83

Simulating Conditional Means for Individual Parameters

,,1 1

,1 1

1

ˆ ˆ( )1 1ˆ ˆ( )ˆ ˆ

ˆ ( | , )ˆ ˆ( )1 1

ˆ ˆ

1 ˆˆ =

i

i

TR it i r iti rr t

i i iTR it i r it

r t

Rir irr

yR

Ey

R

WeightR

Lw xLw

y XLw x

Posterior estimates of E[parameters(i) | Data(i)]

Page 53: Topics in Microeconometrics

[Topic 8-Random Parameters] 53/83

“Individual Coefficients”--> Sample ; 1 - 887 $--> create ; betaeduc = beta_i $--> dstat ; rhs = betaeduc $Descriptive StatisticsAll results based on nonmissing observations.==============================================================================Variable Mean Std.Dev. Minimum Maximum Cases Missing==============================================================================All observations in current sample--------+---------------------------------------------------------------------BETAEDUC| .161184 .132334 -.268006 .506677 887 0

Freq

uenc

y

BETAEDUC -.268 -.157 -.047 .064 .175 .285 .396 .507

Page 54: Topics in Microeconometrics

[Topic 8-Random Parameters] 54/83

A Hierarchical Linear Model• A hedonic model of house values• Beron, K., Murdoch, J., Thayer, M.,

“Hierarchical Linear Models with Application to Air Pollution in the South Coast Air Basin,” American Journal of Agricultural Economics, 81, 5, 1999.

Page 55: Topics in Microeconometrics

[Topic 8-Random Parameters] 55/83

Three Level HLMijk

M m mijk jk ijk ijkm 1mijk

y log of home sale price i, neighborhood j, community k.y x (linear regression model)x sq.ft, #baths, lot size, central heat, AC, pool, good view, age, distance to b

m

qm

Qm q qjk j jk jkq 1qjk

Sq s qmj j js 1qmj

eachRandom coefficients

N wN %population poor, race mix, avg age, avg. travel to work, FBI crime index, school avg. CA achievement test score

E vE air qu

ality measure, visibility

Page 56: Topics in Microeconometrics

[Topic 8-Random Parameters] 56/83

Mixed Model Estimation

• WinBUGS: • MCMC • User specifies the model – constructs the Gibbs Sampler/Metropolis Hastings

• MLWin:• Linear and some nonlinear – logit, Poisson, etc.• Uses MCMC for MLE (noninformative priors)

• SAS: Proc Mixed. • Classical• Uses primarily a kind of GLS/GMM (method of moments algorithm for loglinear models)

• Stata: Classical• Several loglinear models – GLAMM. Mixing done by quadrature.• Maximum simulated likelihood for multinomial choice (Arne Hole, user provided)

• LIMDEP/NLOGIT• Classical• Mixing done by Monte Carlo integration – maximum simulated likelihood• Numerous linear, nonlinear, loglinear models

• Ken Train’s Gauss Code• Monte Carlo integration• Mixed Logit (mixed multinomial logit) model only (but free!)

• Biogeme• Multinomial choice models• Many experimental models (developer’s hobby)

Programs differ on the models fitted, the algorithms, the paradigm, and the extensions provided to the simplest RPM, i = +wi.

Page 57: Topics in Microeconometrics

[Topic 8-Random Parameters] 57/83

GEN 2.1 – RANDOM EFFECTS - DISCRETE

Page 58: Topics in Microeconometrics

[Topic 8-Random Parameters] 58/83

Heterogeneous Production Model

i,t i i i,t i i,t i,tHealth HEXP EDUCi country, t=yearHealth = health care outcome, e.g., life expectancyHEXP = health care expenditureEDUC = educationParameter heterogeneity: Discrete? Aids domin

ated vs. QOL dominated Continuous? Cross cultural heterogeneityWorld Health Organization, "The 2000 World Health Report"

Page 59: Topics in Microeconometrics

[Topic 8-Random Parameters] 59/83

Parameter Heterogeneity• Fixed and Random Effects Models

• Latent common time invariant “effects”• Heterogeneity in level parameter – constant term –

in the model• General Parameter Heterogeneity in Models

• Discrete: There is more than one time of individual in the population – parameters differ across types. Produces a Latent Class Model

• Continuous; Parameters vary randomly across individuals: Produces a Random Parameters Model or a Mixed Model. (Synonyms)

Page 60: Topics in Microeconometrics

[Topic 8-Random Parameters] 60/83

Parameter Heterogeneity

i,t it

it i,t

(1) Regression model y ε(2) Conditional probability model f(y | x , )(3) Heterogeneity - how are parameters distributed across individuals? (a) Discrete - the populatio

i,t i

i

x β

β

n contains a mixture of J types of individuals. (b) Continuous. Parameters are part of the stochastic structure of the population.

Page 61: Topics in Microeconometrics

[Topic 8-Random Parameters] 61/83

Discrete Parameter Variation

q ,q

The Latent Class Model(1) Population is a (finite) mixture of Q types of individuals. q = 1,...,Q. Q 'classes' differentiated by ( , ) (a) Analyst does not know class memberships. ('latent

β

Q1 Q q=1 q

i,t it i,t q ,q

.') (b) 'Mixing probabilities' (from the point of view of the analyst) are ,..., , with 1(2) Conditional density is P(y | class q) f(y | x , , )β

Page 62: Topics in Microeconometrics

[Topic 8-Random Parameters] 62/83

Example: Mixture of Normals

q q

2it q it q

itq j qq

Q normal populations each with a mean and standard deviation For each individual in each class at each period,

y y1 1 1f(y | class q) exp = .22Panel data,

T 2it qT

i1 iT t 1qq

T 2N Q it qT

q t 1i 1 q 1qq

T observations on each individual i,y1 1f(y ,..., y | class q) exp 22

Log Likelihood

y1 1logL log exp 22

Page 63: Topics in Microeconometrics

[Topic 8-Random Parameters] 63/83

An Extended Latent Class Model

it itx ,x βit it q

q

(1) There are Q classes, unobservable to the analyst(2) Class specific model: f(y | ,class q) g(y , )(3) Conditional class probabilities Common multinomial logit form for prior class

δ

Qqq=1

qq QJ

qj 1

q

probabilities to constrain all probabilities to (0,1) and ensure 1; multinomial logit form for class probabilities;

exp( ) P(class=q| ) , = 0exp( )

Note, = log( q Q/ ).

Page 64: Topics in Microeconometrics

[Topic 8-Random Parameters] 64/83

Log Likelihood for an LC Model

i

x x β

X ,β x βi

i

i,t i,t it i,t q

iT

i1 i2 i,T q it i,t qt 1

i

Conditional density for each observation is P(y | ,class q) f(y | , )Joint conditional density for T observations isf(y ,y ,...,y | ) f(y | , )(T may be 1. This is not

iX x βi

i

TQi1 i2 i,T q it i,t qq 1 t 1

only a 'panel data' model.)Maximize this for each class if the classes are known. They aren't. Unconditional density for individual i isf(y ,y ,...,y | ) f(y | , )Log Likelihoo

1β β x βiTN Q

Q 1 Q q it i,t qi 1 q 1 t 1

dLogL( ,..., ,δ ,...,δ ) log f(y | , )

Page 65: Topics in Microeconometrics

[Topic 8-Random Parameters] 65/83

Unmixing a Mixed SampleN[1,1] and N[5,1]

Sample ; 1 – 1000$Calc ; Ran(123457)$Create ; lc1=rnn(1,1) ; lc2=rnn(5,1)$ Create ; class=rnu(0,1)$Create ; if(class<.3)ylc=lc1 ; (else)ylc=lc2$ Kernel ; rhs=ylc $Regress ; lhs=ylc;rhs=one;lcm;pts=2;pds=1$

YLC

.045

.090

.135

.180

.224

.000-2 0 2 4 6 8 10-4

Kernel dens ity es timate for YLC

Dens

ity

Page 66: Topics in Microeconometrics

[Topic 8-Random Parameters] 66/83

Mixture of Normals+---------------------------------------------+| Latent Class / Panel LinearRg Model || Dependent variable YLC || Number of observations 1000 || Log likelihood function -1960.443 || Info. Criterion: AIC = 3.93089 || LINEAR regression model || Model fit with 2 latent classes. |+---------------------------------------------++--------+--------------+----------------+--------+--------+----------+|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|+--------+--------------+----------------+--------+--------+----------++--------+Model parameters for latent class 1 ||Constant| 4.97029*** .04511814 110.162 .0000 ||Sigma | 1.00214*** .03317650 30.206 .0000 |+--------+Model parameters for latent class 2 ||Constant| 1.05522*** .07347646 14.361 .0000 ||Sigma | .95746*** .05456724 17.546 .0000 |+--------+Estimated prior probabilities for class membership ||Class1Pr| .70003*** .01659777 42.176 .0000 ||Class2Pr| .29997*** .01659777 18.073 .0000 |+--------+------------------------------------------------------------+| Note: ***, **, * = Significance at 1%, 5%, 10% level. |+---------------------------------------------------------------------+

Page 67: Topics in Microeconometrics

[Topic 8-Random Parameters] 67/83

Estimating Which Class

i

i

q

iT

i1 i2 i,T it i,t q ,qt 1

i1 i2 i

Prob[class=q]= for T observations is

P(y ,y ,..., y | class q) f(y | x , , ) membership is

P(y ,y ,..., y

Prior probability Joint conditional density

βJoint density for data and class

i

i

i ii

i

T,T q it i,t q ,qt 1

i1 i2 i,T i1 i2 i,Ti1 i2 i,T

i1 i2 i,T i1

,class q) f(y | x , , )

P(y ,y ,...,y ,class q) P(y ,y ,...,y ,class q)P(class q| y ,y ,...,y ) P(y ,y ,...,y ) P(y ,y

βPosterior probability for class, given the data

i

i

i i

Ji2 i,Tj 1

Tq it i,t q ,qt 1

i i1 i2 i,T TQq it i,t q ,qq 1 t 1

,...,y ,class q)Use Bayes Theorem to compute the

f(y | x , , )w(q| data) P(class q| y ,y ,...,y )f(y | x , , )

posterior probabilityβ

βBest guess = the class with the largest posterior probability.

Page 68: Topics in Microeconometrics

[Topic 8-Random Parameters] 68/83

Posterior for Normal Mixture

i

i

T it qq t 1

q qi

TQ it qqq 1 t 1

q q

iq qQ

iq qq 1

y ˆ1ˆ ˆ ˆˆ ˆw(q| data) w(q| i)y ˆ1ˆ ˆ ˆ

c ˆ = c ˆ

Page 69: Topics in Microeconometrics

[Topic 8-Random Parameters] 69/83

Estimated Posterior Probabilities

Page 70: Topics in Microeconometrics

[Topic 8-Random Parameters] 70/83

More Difficult When the Populations are Close Together

Page 71: Topics in Microeconometrics

[Topic 8-Random Parameters] 71/83

The Technique Still Works----------------------------------------------------------------------Latent Class / Panel LinearRg ModelDependent variable YLCSample is 1 pds and 1000 individualsLINEAR regression modelModel fit with 2 latent classes.--------+-------------------------------------------------------------Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Mean of X--------+------------------------------------------------------------- |Model parameters for latent class 1Constant| 2.93611*** .15813 18.568 .0000 Sigma| 1.00326*** .07370 13.613 .0000 |Model parameters for latent class 2Constant| .90156*** .28767 3.134 .0017 Sigma| .86951*** .10808 8.045 .0000 |Estimated prior probabilities for class membershipClass1Pr| .73447*** .09076 8.092 .0000Class2Pr| .26553*** .09076 2.926 .0034--------+-------------------------------------------------------------

Page 72: Topics in Microeconometrics

[Topic 8-Random Parameters] 72/83

Estimating E[βi |Xi,yi, β1…, βQ]

q

Qi qq=1

ˆ(1) Use from the class with the largest estimated probability(2) Probabilistic

ˆ ˆ = Posterior Prob[class=q|data]i

β

β β

Page 73: Topics in Microeconometrics

[Topic 8-Random Parameters] 73/83

How Many Classes?β(1) Q is not a 'parameter' - can't 'estimate' Q with and

(2) Can't 'test' down or 'up' to Q by comparing log likelihoods. Degrees of freedom for Q+1 vs. Q classes is not well define

1

2

3

d.(3) Use AKAIKE IC; AIC = -2 logL + 2#Parameters. For our mixture of normals problem, AIC 10827.88 AIC 9954.268 AIC 9958.756

Page 74: Topics in Microeconometrics

[Topic 8-Random Parameters] 74/83

Latent Class Regression

it qit

,q ,q

q itq

Assume normally distributed disturbancesy1f(y | class q)

.

it

it

x β

Mixture of normals sets x β = μ

Page 75: Topics in Microeconometrics

[Topic 8-Random Parameters] 75/83

Baltagi and Griffin’s Gasoline DataWorld Gasoline Demand Data, 18 OECD Countries, 19 yearsVariables in the file are

COUNTRY = name of country YEAR = year, 1960-1978LGASPCAR = log of consumption per carLINCOMEP = log of per capita incomeLRPMG = log of real price of gasoline LCARPCAP = log of per capita number of cars

See Baltagi (2001, p. 24) for analysis of these data. The article on which the analysis is based is Baltagi, B. and Griffin, J., "Gasoline Demand in the OECD: An Application of Pooling and Testing Procedures," European Economic Review, 22, 1983, pp. 117-137.  The data were downloaded from the website for Baltagi's text.

Page 76: Topics in Microeconometrics

[Topic 8-Random Parameters] 76/83

3 Class Linear Gasoline Model

Page 77: Topics in Microeconometrics

[Topic 8-Random Parameters] 77/83

Estimated Parameters LCM vs. Gen1 RPM

Page 78: Topics in Microeconometrics

[Topic 8-Random Parameters] 78/83

An Extended Latent Class Model

it

Class probabilities relate to observable variables (usuallydemographic factors such as age and sex).(1) There are Q classes, unobservable to the analyst(2) Class specific model: f(y | ,class q) g(itx

it q

qiq qQ

qq 1

y , )(3) Conditional class probabilities given some information, ) Common multinomial logit form for prior class probabilities

exp( ) P(class=q| , ) , = exp( )

it

i

ii

i

,x βz

zδz δ δ 0zδ

Page 79: Topics in Microeconometrics

[Topic 8-Random Parameters] 79/83

LC Poisson Regression for Doctor Visits

Page 80: Topics in Microeconometrics

[Topic 8-Random Parameters] 80/83

Heckman and Singer’s RE Model• Random Effects Model• Random Constants with Discrete Distribution

it it q

q

(1) There are Q classes, unobservable to the analyst(2) Class specific model: f(y | ,class q) g(y , )(3) Conditional class probabilities Common multinomial logit form for prior clas

it itx ,x ,β

Qqq=1

qq QJ

qj 1

s probabilities to constrain all probabilities to (0,1) and ensure 1; multinomial logit form for class probabilities;

exp( ) P(class=q| ) , = 0exp( )

δ

Page 81: Topics in Microeconometrics

[Topic 8-Random Parameters] 81/83

3 Class Heckman-Singer Form

Page 82: Topics in Microeconometrics

[Topic 8-Random Parameters] 82/83

The EM Algorithm

i

i,q

i,qTN Q

c i,q i,t i,ti 1 q 1 t 1

Latent Class is a ' ' modeld 1 if individual i is a member of class qIf d were observed, the complete data log likelihood would be

logL log d f(y | data ,class q)

missing data

(Only one of the Q terms would be nonzero.)Expectation - Maximization algorithm has two steps(1) Expectation Step: Form the 'Expected log likelihood' given the data and a prior guess of the parameters.(2) Maximize the expected log likelihood to obtain a new guess for the model parameters.(E.g., http://crow.ee.washington.edu/people/bulyko/papers/em.pdf)

Page 83: Topics in Microeconometrics

[Topic 8-Random Parameters] 83/83

Implementing EM for LC Models

, β β β ββ

β

0 0 0 0 0 0 0 0q 1 2 Q q 1 2 Q

q

q

q

Given initial guesses , ,..., , ,...,E.g., use 1/Q for each and the MLE of from a one classmodel. (Must perturb each one slightly, as if all are equaland all are

0β δβ

β

0

q

q iq it

the same, the model will satisfy the FOC.)ˆ ˆˆ(1) Compute F(q|i) = posterior class probabilities, using ,

Reestimate each using a weighted log likelihood ˆ Maximize wrt F log f(y |

itx βδ

β

iN Tqi=1 t=1

qN

q i=1

, )(2) Reestimate by reestimating

ˆ =(1/N) F(q|i) using old and new ˆ ˆ Now, return to step 1.Iterate until convergence.