Panel Random-Coefficient Model (xtrc) 경제학과 박사과정 이민준 Contents 1. 2. 3. 4. Model & Methodology Literature Using This Model STATA Manual Estimation Example and Simulation 1. Model & Methodology • What is a random-coefficient model? • Fixed(constant)-coeff. Model : yi xi ui • Here, (i) The marginal effect of x on y is assumed to be constant over all i. (ii) The effect of unobservable factors is captured by the error-term. 1. Model & Methodology • We, instead, may want to assume that the parameters of the equation is not constant. • Random Coeff. Model : yi i i xi ui • Some structures should be imposed on the parameters, since otherwise this is not estimable (and is also meaningless). • Based on the assumptions on the structure, this model can be further classified. 1. Model & Methodology • The Usual assumption is that, i i , i i ,i ~ (0,2 ), i ~ (0,2 ) , where i , i are independent of x. 2 2 ˆ ˆ , , , • Then the main goal is to estimate and then to predict the values ˆ i , ˆi for each i using this. • cf. Under the above assumption, estimating ˆ , ˆ is not different from estimating a fixed-coeff. model with hetero-skedasticity. 1. Model & Methodology • Random Coefficient models with panel data • Why we use R.C. model of panel data? “(Conventional models) does not allow the interaction of the individual specific and/or time varying differences with the included explanatory variables.” (Hsiao and Pesaran (2004)) • The general form of the model is, : yit xit it uit • Again, we need to assume some structures of it 1. Model & Methodology • Hsiao(1974) Model : it it i t where, ' E ( ) E ( ) 0 , E ( (i) i t i t) 0 (ii) E(i x'it ) 0, E(t x'it ) 0 (iii) and 1. Model & Methodology • Swamy(1970) Model : it i where, (i) E ( i ) 0 (ii) E ( i x'it ) 0 (iii) • This is what STATA runs with ‘xtrc’ command. 1. Model & Methodology • But in this case, why do not we estimate separate equations for each i ? • According to Hsiao et al. (1989), (i) By reducing the # of parameters to be estimated, this improves efficiency. (ii) It reduces the multicollinearity problem due to the co-movement over time among the explanatory variables, by appealing to the panel-specific differences. 1. Model & Methodology • In addition, when the assumption that the individual differences( i ) are randomly distributed is true, there is no aggregation bias. 1. Model & Methodology • Estimation method of the Swamy(1970) model : yi xi i i xi ( i ) i xi ( xi vi i ) xi wi Then, E (wi ) xi E (vi ) E ( i ) 0 E ( wi w'i ) E ( i 'i ) xi E (vi v'i ) x'i i2 I xi x'i i Stacking the equations, we have y x w where E (ww' ) is a block diagonal matrix with i along the main diagonal. 1. Model & Methodology • GLS estimator of ˆ m 1 1 1 : ̂ (i x'i i xi ) i x'i i yi Wibi i 1 where m Wi { ( Vi ) 1}1 ( Vi ) 1 , bi ( x'i xi ) 1 x'i yi , Vi i2 ( x'i xi ) 1 i 1 m and Var (ˆ ) ( Vi ) 1 i 1 • Here we can see that ˆ is a matrix-weighted average of the panel-specific OLS estimator( bi ). (The weight is inversely proportional to their covariant matrix.) 1. Model & Methodology • To estimate the above, we have to know ,Vi . For this, we use two-step approach, following Swamy(1970). • Here, bi OLS Panel specific estimator ˆi ' ˆi , ˆ 2 ˆ i Vi ˆ i2 ( xi ' xi )1 ni k m m 1 1 ( bi bi 'mb b ' ) Vˆi Finally, ˆ m 1 i 1 m i 1 1 m where b bi m i 1 1. Model & Methodology • Prediction of ̂i (Swamy and Mehta(1975)) : ˆi ˆ ˆ xi ' ( xi ˆ xi 'ˆ i2 I )1 ( yi xi ˆ ) 1 1 (ˆ 1 Vˆi ) 1 (ˆ 1ˆ Vˆi bi ) : This is reported by the option, betas • Test of parameter constancy (Swamy(1970)) H0: i , i 1,..., m m 2 (bi *)'Vˆi 1 (bi *) Test statistic: k ( m1) i 1 m m where * (Vˆi 1 ) 1 Vˆi 1bi i 1 i 1 2. Literature Using This Model • Swamy(1970) • Revisits Grunfeld(1958)’s firm investment function yit 0i 1i x1i ,t 1 2i x2i ,t 1 uit where y is gross invest., x1 is value of share and x2 is capital stock. • Test of parameter constancy: rejected. • Estimation result: 1 0.0843(0.0104), 2 0.1961(0.0412) • We will return to this example in section 4. 2. Literature Using This Model • Hendricks et al. (1979) • Goal: to estimate the level and shape of the electricity demand function. • Data: control/test individuals during Connecticut Peak Load pricing experiment. (for 3 months) • Individual demand function (daily/periodical) : q jt X jt j jt where X includes time-variable (knot variable) and dummy for the experiment group. 2. Literature Using This Model • As a result, we get an estimate of each consumer’s demand function 2. Literature Using This Model • But what determines j ? • This paper assumes that j is a function of exogenous variables related to each j. 8 ki Z kji ij i j i k 1 where Z includes ownership of some appliances, # of people, climate factors, etc. • In general, Z explains very well! • With this estimation result, we can reconstruct the demand function for each profile-group. 2. Literature Using This Model 2. Literature Using This Model • Hsiao et al. (1989) • Goal: to estimate the regional electricity demand in the state of Ontario • Model: log-adjustment structure ln yit i ln yi ,t 1 i ' ln xit i ' ln wit i ' ln zi uit where x is the set of economic factors, w of climate factors and z of regional & seasonal specific factors. (the unit is municipality) 2. Literature Using This Model • The parameter constancy test rejects H0. • Using pure random coeff. model: cannot represent the difference in parameters which results from the region-specific factors. • Hence this paper uses a mixed fixed-random coeff. model (assuming that the coeff. of z are fixed and others are randomly distributed). • Using the root mean square error of the predicted values, we can show that this model performs well. 2. Literature Using This Model 2. Literature Using This Model • It is interesting to see that the mixed model outperforms the region-specific estimations in predicting regional demand behaviors. • Also note that the pure random-coeff. model is the worst in prediction. • Conclusion: “Neither should we pool the data w/o taking account of heterogeneity across units, nor should we simply treat all regional heterogeneity as random draws from a common population.” 3. STATA Manual 4. Estimation Example and Simulation • Estimation example: revisit Grunfeld(1958) • Data: invest2 data (invest. data for 5 firms) . use "D:\work\¹ÎÁØ\¼ö¾÷\¼ö¾÷-2010³â 1Çбâ\°è·®°æÁ¦ÇÐ ¼¼¹Ì³ª\panel random coeff\invest2.dta", clear . xtset company time panel variable: time variable: delta: company (strongly balanced) time, 1 to 20 1 unit . xtrc invest market stock, betas Random-coefficients regression Group variable: company Number of obs Number of groups = = 100 5 Obs per group: min = avg = max = 20 20.0 20 Wald chi2(2) Prob > chi2 invest Coef. market stock _cons .0807646 .2839885 -23.58361 Test of parameter constancy: Std. Err. .0250829 .0677899 34.55547 z 3.22 4.19 -0.68 chi2(12) = P>|z| 0.001 0.000 0.495 603.99 = = 17.55 0.0002 [95% Conf. Interval] .0316031 .1511229 -91.31108 .1299261 .4168542 44.14386 Prob > chi2 = 0.0000 4. Estimation Example and Simulation j Group-specific coefficients Coef. Std. Err. z P>|z| [95% Conf. Interval] Group 1 market stock _cons .1027848 .3678493 -71.62927 .0108566 .0331352 37.46663 9.47 11.10 -1.91 0.000 0.000 0.056 .0815062 .3029055 -145.0625 .1240634 .4327931 1.803978 .084236 .3092167 -9.819343 .0155761 .0301806 14.07496 5.41 10.25 -0.70 0.000 0.000 0.485 .0537074 .2500638 -37.40575 .1147647 .3683695 17.76707 .0279384 .1508282 -12.03268 .013477 .0286904 29.58083 2.07 5.26 -0.41 0.038 0.000 0.684 .0015241 .0945961 -70.01004 .0543528 .2070603 45.94467 .0411089 .1407172 3.269523 .0118179 .0340279 9.510794 3.48 4.14 0.34 0.001 0.000 0.731 .0179461 .0740237 -15.37129 .0642717 .2074108 21.91034 .147755 .4513312 -27.70628 .0181902 .0569299 42.12524 8.12 7.93 -0.66 0.000 0.000 0.511 .1121028 .3397506 -110.2702 .1834072 .5629118 54.85766 Group 2 market stock _cons Group 3 market stock _cons Group 4 market stock _cons Group 5 market stock _cons 4. Estimation Example and Simulation • Seemingly Unrelated Regression (for comparison) . reshape wide invest market stock, i(time) j(company) (note: j = 1 2 3 4 5) Data Number of obs. Number of variables j variable (5 values) xij variables: long -> wide 100 5 company -> -> -> 20 16 (dropped) invest market stock -> -> -> invest1 invest2 ... invest5 market1 market2 ... market5 stock1 stock2 ... stock5 . sureg (invest1 market1 stock1) (invest2 market2 stock2) > 4) (invest5 market5 stock5) (invest3 market3 stock3) Seemingly unrelated regression Equation Obs Parms RMSE "R-sq" chi2 P invest1 invest2 invest3 invest4 invest5 20 20 20 20 20 2 2 2 2 2 84.94729 12.36322 26.46612 9.742303 95.85484 0.9207 0.9119 0.6876 0.7264 0.4220 261.32 207.21 46.88 59.15 14.97 0.0000 0.0000 0.0000 0.0000 0.0006 (invest4 market4 stock 4. Estimation Example and Simulation • d Coef. Std. Err. z P>|z| [95% Conf. Interval] invest1 market1 stock1 _cons .120493 .3827462 -162.3641 .0216291 .032768 89.45922 5.57 11.68 -1.81 0.000 0.000 0.070 .0781007 .318522 -337.7009 .1628853 .4469703 12.97279 invest2 market2 stock2 _cons .0695456 .3085445 .5043112 .0168975 .0258635 11.51283 4.12 11.93 0.04 0.000 0.000 0.965 .0364271 .2578529 -22.06042 .1026641 .3592362 23.06904 invest3 market3 stock3 _cons .0372914 .130783 -22.43892 .0122631 .0220497 25.51859 3.04 5.93 -0.88 0.002 0.000 0.379 .0132561 .0875663 -72.45443 .0613268 .1739997 27.57659 invest4 market4 stock4 _cons .0570091 .0415065 1.088878 .0113623 .0412016 6.258805 5.02 1.01 0.17 0.000 0.314 0.862 .0347395 -.0392472 -11.17815 .0792788 .1222602 13.35591 invest5 market5 stock5 _cons .1014782 .3999914 85.42324 .0547837 .1277946 111.8774 1.85 3.13 0.76 0.064 0.002 0.445 -.0058958 .1495186 -133.8525 .2088523 .6504642 304.6989 4. Estimation Example and Simulation • Simulation • N=5, T=20, Iteration=1000 • Generation: yit i xit it where i ~ N (3,1) and xit , it ~ N (0,1) • We will do: (i) xtrc regress (ii) prediction for each ̂i (iii) Pooled OLS (iv) parameter constancy test (reject %) (v) calculate ˆi i (vi) SUR for comparison 4. Estimation Example and Simulation • Result . su Variable Obs Mean b_rc b_po test b_pre1 b_pre2 1000 1000 1000 1000 1000 3.017712 3.015449 .967 3.002296 3.006243 b_pre3 b_pre4 b_pre5 err_pre1 err_pre2 1000 1000 1000 1000 1000 err_pre3 err_pre4 err_pre5 err_sur1 err_sur2 err_sur3 err_sur4 err_sur5 Std. Dev. Min Max .4522505 .4609577 .1787259 .9737398 .964548 1.390671 1.292617 0 -.3319063 -.0110268 4.638842 4.890881 1 6.029431 6.223836 3.025869 2.992999 3.061155 .0072867 .0112834 1.01018 .9496223 1.008083 .2316447 .2398169 -.5807662 .2628025 -.1997216 -.716162 -.8152806 5.976103 6.106585 6.570777 .7287912 1.272547 1000 1000 1000 1000 1000 -.0049967 .0067088 .0050713 .0046177 .0145143 .2396529 .2329368 .2404257 .2556837 .2653535 -.823391 -.8310407 -1.037565 -.9312465 -.8621137 .946359 .7822555 .9830741 .7962257 1.377899 1000 1000 1000 -.0003351 .0072393 .0064375 .2705998 .2564982 .2650744 -.8326595 -.8609526 -.9207019 1.070353 .8850923 .9107749 4. Estimation Example and Simulation • Result . su Variable Obs Mean b_rc b_po test b_pre1 b_pre2 1000 1000 1000 1000 1000 3.017712 3.015449 .967 3.002296 3.006243 b_pre3 b_pre4 b_pre5 err_pre1 err_pre2 1000 1000 1000 1000 1000 err_pre3 err_pre4 err_pre5 err_sur1 err_sur2 err_sur3 err_sur4 err_sur5 Std. Dev. Min Max .4522505 .4609577 .1787259 .9737398 .964548 1.390671 1.292617 0 -.3319063 -.0110268 4.638842 4.890881 1 6.029431 6.223836 3.025869 2.992999 3.061155 .0072867 .0112834 1.01018 .9496223 1.008083 .2316447 .2398169 -.5807662 .2628025 -.1997216 -.716162 -.8152806 5.976103 6.106585 6.570777 .7287912 1.272547 1000 1000 1000 1000 1000 -.0049967 .0067088 .0050713 .0046177 .0145143 .2396529 .2329368 .2404257 .2556837 .2653535 -.823391 -.8310407 -1.037565 -.9312465 -.8621137 .946359 .7822555 .9830741 .7962257 1.377899 1000 1000 1000 -.0003351 .0072393 .0064375 .2705998 .2564982 .2650744 -.8326595 -.8609526 -.9207019 1.070353 .8850923 .9107749 4. Estimation Example and Simulation • Result . su Variable Obs Mean b_rc b_po test b_pre1 b_pre2 1000 1000 1000 1000 1000 3.017712 3.015449 .967 3.002296 3.006243 b_pre3 b_pre4 b_pre5 err_pre1 err_pre2 1000 1000 1000 1000 1000 err_pre3 err_pre4 err_pre5 err_sur1 err_sur2 err_sur3 err_sur4 err_sur5 Std. Dev. Min Max .4522505 .4609577 .1787259 .9737398 .964548 1.390671 1.292617 0 -.3319063 -.0110268 4.638842 4.890881 1 6.029431 6.223836 3.025869 2.992999 3.061155 .0072867 .0112834 1.01018 .9496223 1.008083 .2316447 .2398169 -.5807662 .2628025 -.1997216 -.716162 -.8152806 5.976103 6.106585 6.570777 .7287912 1.272547 1000 1000 1000 1000 1000 -.0049967 .0067088 .0050713 .0046177 .0145143 .2396529 .2329368 .2404257 .2556837 .2653535 -.823391 -.8310407 -1.037565 -.9312465 -.8621137 .946359 .7822555 .9830741 .7962257 1.377899 1000 1000 1000 -.0003351 .0072393 .0064375 .2705998 .2564982 .2650744 -.8326595 -.8609526 -.9207019 1.070353 .8850923 .9107749 4. Estimation Example and Simulation • Result . su Variable Obs Mean b_rc b_po test b_pre1 b_pre2 1000 1000 1000 1000 1000 3.017712 3.015449 .967 3.002296 3.006243 b_pre3 b_pre4 b_pre5 err_pre1 err_pre2 1000 1000 1000 1000 1000 err_pre3 err_pre4 err_pre5 err_sur1 err_sur2 err_sur3 err_sur4 err_sur5 Std. Dev. Min Max .4522505 .4609577 .1787259 .9737398 .964548 1.390671 1.292617 0 -.3319063 -.0110268 4.638842 4.890881 1 6.029431 6.223836 3.025869 2.992999 3.061155 .0072867 .0112834 1.01018 .9496223 1.008083 .2316447 .2398169 -.5807662 .2628025 -.1997216 -.716162 -.8152806 5.976103 6.106585 6.570777 .7287912 1.272547 1000 1000 1000 1000 1000 -.0049967 .0067088 .0050713 .0046177 .0145143 .2396529 .2329368 .2404257 .2556837 .2653535 -.823391 -.8310407 -1.037565 -.9312465 -.8621137 .946359 .7822555 .9830741 .7962257 1.377899 1000 1000 1000 -.0003351 .0072393 .0064375 .2705998 .2564982 .2650744 -.8326595 -.8609526 -.9207019 1.070353 .8850923 .9107749 5. References • • • • • • • • Grunfeld, Y. (1958), “The Determinants of Corporate Investment” Unpublished Ph.D. Thesis, University of Chicago. Grunfeld, Y. and Z. Griliches (1960), “Is Aggregation Necessarily Bad?” The Review of Economics and Statistics Vol. 42 No.1 Hendricks, W., R. Koenker and D. Poirier (1979), “Residentia Demand for Electricity” Journal of Econometrics (9) Hsiao, C., D. Mountain, M. Chan and K. Tsui (1989), “Modeling Ontario Regional Electricity System Demand Using a Mixed Fixed and Random Coefficients Approach” Regional Science and Urban Economics (19) Hsiao, C. and M, Pesaran (2004), “Random Coefficient Panel Data Models” CESifo Working Paper No. 1233 Swamy, P. (1970), “Efficient Inference in a Random Coefficient Regression Model” Econometrica Vol.38, No.2 Swamy, P. and J. Mehta (1975), “Bayesian and Non-Bayesian Analysis of Switching Regressions and of Random Coefficient Regression Models” Journal of American Statistical Association (70) Wooldridge, J. (2006) Introductory Econometrics 313-315