= Random Effects Model = A '''random effects model''' utilizes repeated observations (i.e., panel data) to decompose and correct for within-group and between-group heterogeneity. <> ---- == Description == This model is used for panel analysis. A good starting point for modeling with panel data is the [[Statistics/PooledOrdinaryLeastSquaresModel|pooled OLS model]]. This model builds upon weaknesses of that methodology. It is helpful to establish a decomposition for the unit error term ''ε,,it,,'' into time-variant and time-invariant components: ''u,,it,,'' and ''α,,i,,''. Also, consider ''N'' to the total number of observations. If using a balanced panel, i.e. all individuals ''i'' have ''T'' observations, this is simply ''nT''. More generally though, the calculation is {{attachment:n.svg}}. Strong assumptions about the variance structure are made. * Errors are distributed about 0, i.e. ''E[ε,,it,,] = 0''. * Therefore the covariance of errors between two measurements of the same individual is: * ''Cov(ε,,it,,, ε,,is,,) = E[(ε,,it,, - 0)(ε,,is,, - 0)] = E[ε,,it,,ε,,is]'' * ''Cov(ε,,it,,, ε,,is,,) = E[(u,,it,, + α,,i,,)(u,,is,, + α,,i,,)] = E[u,,it,,u,,is,, + u,,it,,α,,i,, + u,,is,,α,,i,, + α,,i,,^2^]'' * The components of errors are independent. * The above simplifies to ''σ,,α,,^2^''. * For the same reasons, the '''variance''' of errors (i.e., the covariance between a measurement and itself) simplifies to ''σ,,α,,^2^ + σ,,u,,^2^''. * There is zero covariance between the errors and any predictor. The first two lead to a ''T,,i,,'' by ''T,,i,,'' covariance matrix for any individual ''i'': {{attachment:sigma.svg}} Furthermore, the covariance matrix for all individuals and all measurements can be fully expressed in a ''N'' by ''N'' covariance matrix like: {{attachment:omega.svg}} Note that all off-diagonal covariances are zero unless individuals ''i'' and ''j'' are the same. The final assumption is important because the total errors, '''''ε''''' composed of ''ε,,it,,'', can then be calculated using a [[Statistics/FixedEffectsModel#De-meaned_Estimator|de-meaned within estimator]]. The diagonal members can be summed and averaged to arrive at ''σ,,ε,,^2^'': {{attachment:within1.svg}} There are a few different estimators for ''σ,,α,,^2^'', but the simplest intuition is summing and averaging the off-diagonal members. [[Statistics/GeneralizedLeastSquares|Feasible GLS]] is used to fit the random effects model. This can be interpreted as transforming the space by weights, '''''θ''''' composed of ''θ,,i,,'', that mix observations with individual-level averages. The weights are specified as: {{attachment:theta.svg}} And the random effects model can be formulated as: {{attachment:re.svg}} As ''θ,,i,,'' approaches 1, this model converges to the fixed effects model. As ''θ,,i,,'' approaches 0, this model converges to a pooled OLS model. Because of this nesting and the fact that the fixed effects model is less efficient but must be consistent, a [[Statistics/HausmanTest|Hausman test]] should be performed with the null hypothesis that the random effects model is consistent. If rejected, the fixed effects model should be used instead. ---- CategoryRicottone