17
Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User Group Meeting in Berlin 8. April 2005 Fred Ramb and Markus Reitzig

Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Embed Size (px)

Citation preview

Page 1: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Non Linear Functions in Panel Data Models-

Algorithm Using Stata

Presentation at the Stata User Group Meeting in Berlin

8. April 2005

Fred Ramb and Markus Reitzig

Page 2: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

• Theoretical models often are nonlinear e.g. in economics the well known q-model

• Micro panel data• NLLS estimator is biased• Fixed effects estimator is efficient

• Standard software package is not available

Overview

Page 3: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

• Motivation• Theory

• q Model• Linearized Fixed Effects Estimator

• Stata Code• Pooled Cross Sectional Nonlinear Least Squares• Panel Data Random Effects and Fixed Effects

• Empirical Results• Summary

Overview

Page 4: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Cobb-Douglas Production function

Theory (I): q Model

V i , t q t Ait γ i K it

Logarithmic transformation

With for small x:

logV i , tAi . t

logQi , t log q t log 1 γ i

K itAit

log 1 x x

logQi , t

α log qtβ 1 γ

i

Kit

Aitε

i , t

Page 5: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Theory (II): Algorithm

y it yit f x it β0

α i

f xit β0

β0

β β0δ control variables η i τ t υ it

f x it β0

β0

K itAit

1 γit

0K it

Ait

with:

Logarithmic transformation

With for larger x, linearized version is estimated:

logV i , tAi . t

logQi , t log q t log 1 γ i

K itAit

log 1 x x

Page 6: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

• program nlacc• if "`1'" =="?" { • global S_1 "B_0 X1 C1 C2 C3 T1 T2 T3 T4 T5"• global B_0= 0 • global X1= 0• global C1= 0• global C2= 0• global C3= 0• global T1= 0• global T2= 0• global T3= 0• global T4= 0• global T5= 0• exit• }• replace `1'=$B_0 + ln(1+($X1*x2)) + $C1*control1+$C2*control2 + $C3*control3 /*•*/ + $T1*dyear1 + $T3*dyear2 + $T3*dyear3 + $T4*dyear4 + $T5*dyear5 • end• nl acc y

Stata Code: NLLS

Page 7: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

• xtreg y x control1 control2 time*, fe

Stata Code: Fixed Effects

• gen ex = _b[x]• gen y_s = y - (log(1+ex*x))• gen x_s = x / (1+ (ex*x))

• log off• local i=1• while `i' < 50 {• quietly xtreg y_s x_s control1 control2 time*, fe• quietly replace ex = ex + _b[x_s]• quietly replace y_s = y - (log(1+ex*x))• quietly replace x_s = x2 / (1+ (ex*x))• local i = `i' + 1•}

• log on• replace y_s = y - (log(1+ex*x)) + (ex*(x / (1+ (ex*x))))• xtreg y_s x_s control1 control2 time*, fe

Page 8: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

• xtreg y x control1 control2 time*, re• gen exr = _b[x]• gen y_sr = y - (log(1+exr*x))• gen x_sr = x / (1+ (exr*x)• log off• local i=1• while `i' < 50 {• quietly replace exr = exr + _b[x_sr]• quietly replace y_sr = y-(log(1+exr*x))• quietly replace x_sr = x / (1+ (exr*x))• quietly xtreg y_sr x_sr control1 control2 time*, re• local i = `i' + 1•}• log on• replace y_sr = y-(log(1+exr*x)) + (exr*(x / (1+ (exr*x))))• xtreg y_sr x_sr control1 control2 time*, re• xttest0

Stata Code: Random Effects

Page 9: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

• xtreg y_s x_s control1 control2 time*, fe• est store fixed• xtreg y_sr x_sr control1 control2 time*, re• hausman fixed

Stata Code: Hausman Test

Page 10: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Empirical Results: Dataset

• Sources • Hoppenstedt: accounting data• Datastream: stock market data

• Sample• 1997-2003• Consolidated financial statements• Manufacturing sector

• Estimation Sample• 2,786 observations / 676 firms (Overall)

• 1,463 observations / 325 firms (HGB) • 532 observations / 139 firms (IAS)• 791 observations / 212 firms ( US-GAAP)

Page 11: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Empirical Results: Example 1

Example 1

Pooled Cross Sectional Non Linear

Least Squared

Panel Random Effects

Panel Fixed Effects

Constant 0.12 0.79 11.89 (0.06)** (0.07)*** (1.56)*** X1 4.40 0.72 -0.10 (0.45)*** (0.16)*** (0.04)** Mills Ratio -0.95 -0.86 -0.77 (0.17)*** (0.11)*** (0.11)*** Control Dummy 1 7.08 6.16 6.14 (1.07)*** (0.70)*** (0.89)*** Control Dummy 2 14.13 12.69 11.13 (2.48)*** (1.60)*** (1.54)*** Observations 2011 2011 2011 R-squared 0.37 0.29 0.23 Number of ID 442 442 442

Page 12: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Empirical Results: Example 2

Example 2

Pooled Cross Sectional Non Linear

Least Squared

Panel Random Effects

Panel Fixed Effects

Constant 0.12 13.78 0.75 (0.06)* (1.61)*** (0.05)*** X1 4.79 0.54 -0.02 (0.72)*** (0.21)** (0.12) X2 0.51 -0.01 -0.33 (0.20)*** (0.09) (0.03)*** X3 3.17 0.53 -0.10 (0.50)*** (0.17)*** (0.03)*** Mills Ratio -0.98 -0.88 -0.79 (0.17)*** (0.11)*** (0.11)*** Control Dummy 1 7.73 6.53 5.24 (1.07)*** (0.92)*** (0.67)*** Control Dummy 2 14.63 12.98 11.49 (2.48)*** (1.61)*** (1.53)*** Observations 2007 2007 2000 R-squared 0.36 0.28 0.27 Number of ID 441 441 440

Page 13: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

• Pros• Different results by estimating pooled cross sectional nonlinear least squares on the one hand and by estimating fixed effects using the algorithm on the other hand. • Results using the algorithm are more efficient

Summary

• Cons• Do-File is limited to the q-model• Heteroskedasticity? Robust estimation is necessary• Local or global maximum? Bootstrap is necessary• Dynamics? GMM is necessary

Page 14: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Thank you for your attention

Page 15: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Appendix (I)

Page 16: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Page 17: Ramb&Reitzig – Non Linear Functions in Panel Data Models Non Linear Functions in Panel Data Models - Algorithm Using Stata Presentation at the Stata User

Ramb&Reitzig – Non Linear Functions in Panel Data Models

Appendix (III)