# econometrics.it

Federico Belotti's niche on the web

## Spatial panel data models using Stata

71 comments

A new command for estimating and forecasting spatial panel data models using Stata is now available: xsmle.

xsmle fits fixed or random effects spatial models for balanced panel data. See the mi prefix command in order to use xsmle in the unbalanced case. Consider the following general specification for the spatial panel data model:

$y_{it} = \tau y_{it-1} + \rho W y_{it} + X_{it} \beta + D Z_{it} \theta + a_i + \gamma_t + v_{it}$
$v_{it} = \lambda E v_{it} + u_{it}$

where $u_{it}$ is a normally distributed error term, $W$ is the spatial matrix for the autoregressive component, $D$ the spatial matrix for the spatially lagged independent variables, $E$ the spatial matrix for the idiosyncratic error component. $a_i$ is the individual fixed or random effect and $\gamma_t$ is the time effect. xsmle fits the following nested models:

i) The SAR model with lagged dependent variable ($\theta=\lambda=0$)

$y_{it} = \tau y_{it-1} + \rho W y_{it} + X_{it} \beta + a_i + \gamma_t + u_{it}$,

where the standard SAR model is obtained by setting $\tau=0$.

ii) The SDM model with lagged dependent variable ($\lambda=0$)

$y_{it} = \tau y_{it-1} + \rho W y_{it} + X_{it} \beta + D Z_{it} \theta + a_i + \gamma_t + u_{it}$,

where the standard SDM model is obtained by setting $\tau=0$. xsmle allows to use a different weighting matrix for the spatially lagged dependent variable ($W$) and the spatially lagged regressors ($D$) together with a different sets of explanatory ($X_{it}$) and spatially lagged regressors ($Z_{it}$). The default is to use $W=D$ and $X_{it}=Z_{it}$.

iii) The SAC model ($\theta=\tau=0$)

$y_{it} = \rho W y_{it} + X_{it} \beta + a_i + \gamma_t + v_{it}$,
$v_{it} = \lambda E v_{it} + u_{it}$,

for which xsmle allows to use a different weighting matrix for the spatially lagged dependent variable ($W$) and the error term ($E$).

iv) The SEM model ($\rho=\theta=\tau=0$)

$y_{it} = X_{it} \beta + a_i + \gamma_t + v_{it}$,
$v_{it} = \lambda E v_{it} + u_{it}$.

v) The GSPRE model ($\rho=\theta=\tau=0$)

$y_{it} = X_{it} \beta + a_i + v_{it}$,
$a_i = \phi W a_i + \mu_i$,
$v_{it} = \lambda E v_{it} + u_{it}$,

where also the random effects have a spatial autoregressive form.

The command was written together with Andrea Piano Mortari and Gordon Hughes.

You may install it by typing

net install xsmle, all from(http://www.econometrics.it/stata)

in your Stata command bar.

HTH,
Federico

## twopm: estimating two-part models using Stata

5 comments

A new Stata command to estimate two-part models for mixed discrete-continuous outcomes is now available at SSC/econometrics.it.

In two part models, a binary choice model is estimated for the probability of observing a zero versus positive outcome. Then, conditional on a positive outcome, an appropriate regression model is estimated for the positive outcome.

twopm focuses on continuous outcomes modeled using regress or glm. When the outcome is a count variable, such models are known as hurdle models. Of special note is that twopm allows the user to leverage the capabilities of predict and margins to calculate predictions and marginal effects from the combined first- and second-part models.

It was written together with Partha Deb.
You may install the command by typing

ssc install twopm

in your Stata command bar.

HTH,
Federico

## How to write an empirical paper

Comments off

Follow this link to get a sample research paper for an introductory course in econometrics. I find that it is a good guide on how to write down an empirical paper. The proposed template integrates many writing instructions and rules into a single example and shows how they all fit together. My advice is to pay attention to the structure of the paper and how the descriptive statistics and empirical results are presented.

HTH,
Federico

© 2005 - 2020 econometrics.it © Web Design by myself using Arjuna-x theme (by SRS Solutions)