ch05.pdf - STAT8007 Statistical Methods in Economics and Finance Chapter 5 Analysis of Panel Data Department of Statistics and Actuarial Science The

ch05.pdf - STAT8007 Statistical Methods in Economics and...

This preview shows page 1 out of 66 pages.

You've reached the end of your free preview.

Want to read all 66 pages?

Unformatted text preview: STAT8007 Statistical Methods in Economics and Finance Chapter 5 Analysis of Panel Data Department of Statistics and Actuarial Science The University of Hong Kong Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 1 / 66 Panel data Ÿ5.1 Panel Data Models Panel Data are data in which we observe repeated cross-sections of the same individuals. Examples: Annual unemployment rates of each province over several years. Annual incomes of some (selected and xed) families over several years. Quarterly sales of individual stores over several quarters. Wages for the same workers, working at several dierent jobs. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 2 / 66 Panel data The key feature of panel data is that we observe the same individual in more than one condition. By far the leading type of panel data is repeated cross-sections over time. For example, longitudinal surveys return year after year to the same individuals, raise valuable panel data sets in economics. Consequently, such panel data are also called Dr. Z.Q. Zhang ([email protected]) longitudinal data. STAT8007 2019-20 1st Semester 3 / 66 Panel data In general, observations in panel data will be recorded as or Xjit , where j , stands j = 1, 2, · · · , p, the rst subscript, variable, the second subscript, i = 1, 2, · · · , n, i, for the j -th stands for the (independent) i-th individual, and the last subscript, t-th Yit t, stands for the t-th repetition, i.e., the observation from the same individual, t = 1, 2, · · · , T . In a data frame, we usually use two (or more) variables, instead of the natural order of observations, to indicate the sub-indices, i and Dr. Z.Q. Zhang ([email protected]) t, for panel data. STAT8007 2019-20 1st Semester 4 / 66 Example 5.1: Beer tax Philip Cook investigated the relationship between the demand for beer and the level of taxes on beer, using a panel of state data for the years 1985-2000. See data set beertax.csv. Variables are tax: the state's tax rate on beer, sales: per capita beer sales in the state, income: state: per capita income, the federal numerical code for the state  individual index year: i, and the year of the observation  repetition index Dr. Z.Q. Zhang ([email protected]) STAT8007 t. 2019-20 1st Semester 5 / 66 Example 5.1: Beer tax Observations are ordered by state rst, and by year the next. YEAR INCOME STATE TAX SALES 1985 10749.07 1 13.29 1.06 1986 . . . 11098.54 . . . 1 . . . 13.05 . . . 1.09 . . . 2000 13802.56 1 11.23 1.19 1985 18885.69 2 10.33 1.68 1986 . . . 18072.08 . . . 2 . . . 10.14 . . . 1.68 . . . Table 5.1 Beer Taxes in US from year 1985 to 2000. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 6 / 66 Models for panel data A rst model for the beer tax data might be the following LIM for pooled data: salesit = β0 + β1 t + β2 taxit + β3 incomeit + εit , where disturbances (5.1) i.i.d. {εit } ∼ N (0, σε2 ). Doing this, we take it for granted that there are no signicant dierences in the relationships between beer sales and taxes, among all individuals/states and over time. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 7 / 66 Models for panel data We can do better: use dierent intercepts and/or dierent slopes for dierent individuals/states. salesit = β0i + β1 t + β2 taxit + β3 incomeit + εit . (5.2) salesit = β0i + β1 t + β2i taxit + β3 incomeit + εit . (5.3) For simplicity, we consider Model (5.2) only, which is referred to as a distinct intercepts model. Remark: Do not rewrite Dr. Z.Q. Zhang ([email protected]) βk into STAT8007 βki for all k = 0, 1, · · · , p. 2019-20 1st Semester 8 / 66 Models for panel data If we DO are interested in the dierent levels of beer consumptions in dierent states, then we use the distinct intercepts model (5.2). However, if we are interested in the intercept's variation among states instead of its values, we have a third choice: salesit = β0 + νi + β1 t + β2 taxit + β3 incomeit + µit , where νi (5.4) is a zero mean random variable which takes dierent values for dierent i, and is independent of disturbances {µit }. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 9 / 66 Models for panel data Model (5.4) separates the disturbances into two independent components, referred to as an {νi } {εit } and in Model (5.1) {µit }, and is thus error components model. In the error components model (5.4), we are not going to estimate values of {νi }. Instead, we estimate its variance by pre-assuming a certain type of distribution, e.g., i.i.d. {νi } ∼ N (0, σν2 ). Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 10 / 66 Fix Eects vs Random Eects In Models (5.1) and (5.2), eects of factors (including constant) are analyzed through unknown, but xed parameters βk or βki . These factors are called xed eects. While in the error components model (5.4), eect of the constant factor is analyzed by a random coecient Such a factor is called a β 0 + νi . random eect. If we want to model both constant and tax as random eects, we would re-specify Model (5.3) as salesit = β0 + ν0i + β1 t + (β2 + ν2i )taxit + β3 incomeit + εit . Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 11 / 66 Fix Eects vs Random Eects Models with only xed eect(s) are called xed eects models. Models with only random eect(s) are called eects models. random Models with both xed eect(s) and random eect(s) are called mixed eects models, or simply mixed models. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 12 / 66 Fix Eects vs Random Eects To simplify notations, we consider the following distinct intercepts (xed eect) model and error components (random eect) model: yit = β0i + β1 xit + εit , (5.5) yit = β0 + β1 xit + νi + µit . (5.6) We assume in these two models that i.i.d. {εi } ∼ N (0, σε2 ), Furthermore, {µit } predictors, while predictor i.i.d. {µi } ∼ N (0, σµ2 ), i.i.d. {νi } ∼ N (0, σν2 ). are assumed to be uncorrelated with {εit } and {νi } can be correlated with the {xit }. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 13 / 66 Fix Eects or Random Eects? General criteria for specifying the type of eect(s): (I) If the dierent values (or levels) of the eect(s) are of interests, then use xed eect(s); if only the variation of the eect(s) is (are) of interests, then use random eect(s). (II) If individuals are designedly sampled to emphasize dierences in eect(s), then use xed eect(s); otherwise, use random eect(s). (III) If the unobserved eect(s) is (are) considered as random variables (β0i + εit ) that are independent variable variables (νi ) variable X X, correlated with the observed then use xed eect(s); if as random uncorrelated with the observed independent (we assume that), then use random eect(s). Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 14 / 66 Example 5.2: Production Functions How capital K and labor L contribute to output Q is one of the long-standing questions in economics. One measure is the following Cobb-Douglas production function: Q = β0 Lβ1 K β2 . (5.7) Contributions (βk s) might be dierent in dierent countries, and for dierent industries. On the other hand, stable (constant) contributions are expected for dierent rms but belong to the same industry and in the same country. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 15 / 66 Example 5.2: Production Functions Contributions are also expected to be stable for a certain time period, say, in several years. Suppose that we have a sample {Qijkt , Lijkt , Kijkt } in which index i, 1 ≤ i ≤ I , index j, 1 ≤ j ≤ J , index k, 1 ≤ k ≤ K , index t, 1 ≤ t ≤ T , Dr. Z.Q. Zhang ([email protected]) stands for dierent countries, stands for dierent industries, stands for dierent rms, and stands for dierent years. STAT8007 2019-20 1st Semester 16 / 66 Example 5.2: Production Functions If we want to estimate an a specic country i0 , overall production function for we can pick up all observations with i = i0 . Because we are not interested in the dierences among industries or rms, we may treat rms (need to be re-indexed) as randomly selected individuals, while observations over dierent years as dierent repetitions. More importantly, a random eects (or an error components) model should be specied. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 17 / 66 Example 5.2: Production Functions If, in addition, we want to study the dierences in levels (intercepts) of the production functions for dierent industries in country the largest β0 i0 . For example, which industry has and which the smallest? Select data: i = i0 , all j and k, a specic t = t0 or all 1 ≤ t ≤ T. Index for individuals: j with 1 ≤ j ≤ J. Index for repetitions: k with 1≤k≤K if Alternatively, a new index for repetitions: 1 ≤ l ≤ KT if all 1≤t≤T t = t0 l is used. with are used. Model: xed eects and distinct intercepts models. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 2 18 / 66 Heterogeneity in panel data One advantage of panel data models is that we can eliminate some unobserved heterogeneities using panel data. As an example, consider the distinct intercepts model (5.2) for beer tax in Example 5.1. Average temperature might be an omitted variable which contributes on beer consumptions. Consequently, OLS estimates would suer OVB. However, average temperature would be almost the same (little variation) over dierent years but in the same state. Applying proper estimating methods (other than nding instrumental variables) to the panel data model, OVB can be eliminated. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 19 / 66 Models Ÿ5.2 Fixed Eects Estimation As an illustrative example, we consider a regression of one predictor 1 ≤ i ≤ n, xit yit as well as a constant, in which we use to index individuals, and t, 1 ≤ t ≤ T , on i, for repetitions. Total number of observations: N = nT . For the sake of comparison, we consider the following three models. The simple linear regression model (LIM): yit = β0 + β1 xit + εit . Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester (5.8) 20 / 66 Models The distinct intercepts model: yit = β0i + β1 xit + εit . (5.9) The error components model: yit = β0 + β1 xit + νi + µit . (5.10) We assume in the context of this chapter that {εit }, {νi }, {νi } and {µit } are all i.i.d. normal, and are independent of Dr. Z.Q. Zhang ([email protected]) {µit }. STAT8007 2019-20 1st Semester 21 / 66 OLS If xit is not troublesome, the OLS method can be applied to estimate Model (5.8). For Model (5.9), OLS with yit = n X n (or n − 1) dummy variables: β0i Ii + β1 xit + εit , i=1 where Ii is the indicator for the i-th individual. For Model (5.10), combine two error components together and apply OLS: yit = β0 + β1 xit + ξit , where ξit = νi + µit . Dr. Z.Q. Zhang ([email protected]) Note that {ξit } STAT8007 are NOT i.i.d. 2019-20 1st Semester 22 / 66 OLS Handling with possible heteroscedasticity or serial correlation in disturbances {εit } or {ξit } is very dicult since the data is neither a pure cross-sectional one nor a pure time series. Nevertheless, OLS estimators are still unbiased (though inecient) in these cases. If xit is a troublesome variable (E(xit εit ) 6= 0), we need an instrument, and then apply IVLS or 2SLS. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 23 / 66 Fixed Eects (FE) Estimation We introduce a new technique called Fixed Eects (FE) Estimation which can (partly) solve possible problems arisen from OVB, skipping over the diculties in nding valid instrument(s). Fixed eects estimation can be applied to all three panel data models, Models (5.8) through (5.10). The initial insight is: if we dierence observations for the same individual and between repetitions, the heterogeneity term, β0i in the distinct intercepts model, νi in the error components model, or possible omitted variables which take constant values over repetitions, can be cancelled out. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 24 / 66 Fixed Eects (FE) Estimation If there are two repetitions for each individual, t = 1, 2. Dierencing between two observations: yei = yi1 − yi2 , x ei = xi1 − xi2 , εei = εi1 − εi2 , µ ei = µi1 − µi2 . Then, OLS estimation for the transformed model yei = β1 x ei + εei or yei = β1 x ei + µ ei , will be ecient. If there are more than two repetitions, we use demeaning instead of dierence: remove individual sub-sample mean (over repetitions) from each individual observations. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 25 / 66 Fixed Eects (FE) Estimation Mathematically, for all 1≤i≤n and 1 ≤ t ≤ T, yeit = yit − y i , x eit = xit − xi , εeit = εit − εi , µ eit = µit − µi , dene that where T 1X yit , yi = T t=1 εi = Dr. Z.Q. Zhang ([email protected]) T 1X εit , T t=1 STAT8007 T 1X xit , xi = T t=1 µi = T 1X µit . T t=1 2019-20 1st Semester 26 / 66 Fixed Eects (FE) Estimation Then, Models (5.8) through (5.10) are transformed into: yeit = β1 x eit + ηit , where ηit = εeit (5.11) for Models (5.8) or (5.9), and ηit = µ eit for Model (5.10). In Model (5.11), all items xed over repetitions (β0 , νi ) β0i , and are cancelled out. Denote the OLS estimator of Dr. Z.Q. Zhang ([email protected]) β1 STAT8007 by βb1F E . 2019-20 1st Semester 27 / 66 Fixed Eects (FE) Estimation Intercepts are estimated using the un-transformed models: βb0F E = y − βb1F E x, βb0i = y i − βb1F E xi , 1 ≤ i ≤ n, where n T 1 XX yit , y= nT i=1 t=1 n T 1 XX xit . x= nT i=1 t=1 FE estimation for xed eects models are actually the same as OLS estimation, with necessary dummy variables. FE estimation, however estimated, discards all variation between individuals (β0i or νi ). It uses only variation over time within an individual. Therefore, it is sometimes called the within estimation. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 28 / 66 Remarks on FE estimation Though seldom done, it is possible to apply FE estimation to the model with x eects over time (or both): yit = β0t (or βit ) + β1 xit + εit . (5.12) The same argument applies to the error components model yit = β0 + β1 xit + νt + µit . An alternative to the within estimation is the between estimation, which estimates the following model: y i = β 0 + β 1 xi + εi . (5.13) It is inecient either. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 29 / 66 Test for Fixed Eects If xed eects in the distinct intercepts Model (5.9) are insignicant, we prefer the LIM model (5.8), or the error components model (5.10) if necessary. Hypotheses: H0 : Model (5.8) against Ha : Model (5.9). Equivalent null hypothesis: H00 : β0i ≡ β0 Apply the usual for all 1≤i≤n F -test, F ∼ F (n − 1, n(T − 1) − k) Dr. Z.Q. Zhang ([email protected]) in Model (5.9). STAT8007 under H0 . 2019-20 1st Semester 30 / 66 Using R R package plm: R function plm() in the following basic form: linear models for panel data. plm(formula, data, eect, model, index, ...) Arguments: formula: a symbolic description for the model to be estimated, e.g., y ∼ x, y ∼ x1 + x2 | z1 + z2, etc. data: a data.frame. eect: the eects introduced in the model, one of "individual", "time", "twoways", or "nested". model: one of "pooling", "within", "between", "random" "fd", or "ht". index: the indexes for individuals and repetitions. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 31 / 66 Using R R function xef(object, eect, type): extract xed eects. Arguments: object: any tted model object from which xed eects estimates can be extracted. E.g., a within estimate, or a twoways estimate. eect: one of "individual" or "time", only relevant in case of twoways eects models. type: one of "level", "drst", or "dmean". R function pFtest(x1, x2): test for xed eects, where x1 is the "within" object returned by plm, and x2 is the "pooling" object returned by plm, or the OLS object returned by lm. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 32 / 66 Example 5.3: FE estimation Example 5.3: Consider the beer tax data introduced in Example 5.1. Variables are renamed for convenience: Two basic models, which will be repeatedly used, are dened in R: beer.m <- log(sale) ∼ log(tax) + log(inc) + t, and beer.di <- log(sale) ∼ log(tax) + log(inc) + t + factor(st). Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 33 / 66 Example 5.3: FE estimation (a) R command beer.ols <- lm(beer.m, data = beer) gives the OLS estimate of the rst model. Note the degrees of freedom in the nal F -test: F (3, 812), and the sample size is N = 3 + 812 + 1 = 816 = 51 × 16 = nT . (a') R command beer.dols <- lm(beer.di, data = beer) beer.di using OLS estimates the distinct intercepts model together with 50 dummy variables (indicators). Coecients of dummies are dierences of corresponding intercepts compared with that for the rst individual (state). Pay attention to the changes in degrees of freedom. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 34 / 66 Example 5.3: FE estimation (b) Between estimation using averages for each individual, conducted by the following R command: Note that in the output results, variable t is cancelled due to averaging over time. Degrees of freedom: Dr. Z.Q. Zhang ([email protected]) F (2, 48), STAT8007 sample size n = 51. 2019-20 1st Semester 35 / 66 Example 5.3: FE estimation (c) Between estimation using averages of individuals for each year, conducted by the following R command: Degrees of freedom: F (3, 12), sample size Notice the change in the option T = 16. index in the equivalent command. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 36 / 66 Example 5.3: FE estimation (d) Within estimation using information within each individual, conducted by the following R commands: Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 37 / 66 Example 5.3: FE estimation Note that no (global) intercept is given in the summary. The same estimated slopes as those in summary(beer.dols), as well as their estimated standard errors. Dierent degrees of freedom: Sample size: 3 + 762 = 765 = 51 × 15 = n(T − 1). 51 intercepts are reported in Try replace Dr. Z.Q. Zhang ([email protected]) F (3, 762). summary(int.wt.in). "level" in xef() by "drst" or "dmean". STAT8007 2019-20 1st Semester 38 / 66 Example 5.3: FE estimation (e) Within estimation using information within each year, conducted by the following R commands: No intercept or variable Degrees of freedom: Sample size: t in summary(beer.wt.in). F (2, 798). 2 + 798 = 800 = 16 × 50 = T (n − 1). 16 intercepts, one for each year. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 39 / 66 Example 5.3: FE estimation (f ) Test for xed eects using the following R commands. Test results: The "pooling" estimates are the same as OLS ones. Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 40 / 66 Example 5.3: FE estimation (g) We end this example by estimating a two-way distinct intercepts using the following R commands. The intercepts are β0it = βi0 + β0t . Can you gure out the correct degrees of freedom? Dr. Z.Q. Zhang ([email protected]) STAT8007 2019-20 1st Semester 2 41 / 66 Eciency of FE and OLS Ÿ5.3 Random Eects Estimation Fixed Eects estimation discards a great deal of variation in the predictors, it is consistent but inecient. We would prefer OLS to FE if we could. On the other hand, in the error components model, we use FE estimation to handle with unobserved heterogeneities, either absorbed in and modelled by {νi }, or as some omitted variables. These unobserved heterogeneities may or may not cause troublesome variable(s), depends on their correlations with the existing variable Dr. Z.Q. Zhang ([email protected]) xit . STAT8007 2019-20 1st Semester 42 / 66 Eciency of FE and OLS Question: If E(xit νi ) = 0 in the error components model (5.10). Could we use OLS? Because xit is uncorrelated with either specica...
View Full Document

  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors