More in panel data
Nonlinear panel-data models
Stata now fits nonlinear models with random effects. This means that when your science says that the model should be nonlinear in the parameters, as in the constant elasticity of substitution (CES) production function or in a growth curve for adoption of a new technology, you can now fit that model even when you have panel data. Parameters in the fixed portion of the model and random effects can both enter the model nonlinearly.
Now instead of fitting a linear model with random effects UjUj, such as:
we can fit a nonlinear model with random effects, such as:
menl command fits these models. In particular, an example with random intercepts is presented under Random intercepts. You can also fit models with random coefficients as shown in the Random coefficients and random-effects covariance structures example. You can even fit models with additional levels. See the Nonlinear three-level model: CES production function
Bayesian panel-data models
bayes prefix can fit Bayesian panel-data models. If you read Bayesian regression models using the
bayes prefix, this may surprise you. But what you might have overlooked is that panel-data models can be fit using commands for multilevel models. You can read all about Bayesian multilevel models. But when you see:
which fits a panel-data linear regression model with random intercepts by
id. Thus, while you can’t fit the Bayesian version of this model by typing:
you can type:
And because you are using
mixed, you are not limited to random intercepts. You can include random coefficients too. If the coefficient for x2 varies across
For an example, see Random coefficients.
Bayesian panel-data models are not only for continuous outcomes. You can just as easily type for binary outcomes
for count outcomes:
or for censored outcomes:
Or use any of the 12 multilevel estimators that support the
Panel-data interval regression with random coefficients
Suppose you have panel data and want to fit a random-effects model to an interval-measured outcome such as income bracket or age group.
yupper record the upper and lower endpoints of the outcome, we could type:
to fit a model with random intercepts by
xtintreg command is not new, but the
meintreg command is. You can fit the same model with
meintreg by typing:
The advantage of using
meintreg is that it does not restrict us to random intercepts. What if the coefficient for
x1 varies across the levels of
id? We can fit a random-coefficients model by typing:
You can see an example and learn more about the new meintreg command. That example fits a model with city-level random intercepts.
The model could easily be extended to allow for random coefficients on
work by typing: