econometrics.it

Federico Belotti's niche on the web

Browsing Posts tagged stata

Given the high number of requests, my colleagues and I have decided to provide a brief tutorial on how to get started with xsmle. First of all, you have to install the command by typing

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

It is fundamental to use the option all because when you install a user-written package without using this option, the ancillary files (in this case "product.dta" and "usaww.spmat") won't be downloaded, while with the all option all the ancillary files will always (conditionally on the presence of an internet connection) be downloaded to 1) your current working directory OR 2) the directory you specified for ancillary files using the net set other command.

Now, lets assume that you haven't changed your "ancillary files" directory and that your Stata current working directory is the Desktop. Then, you should now find on your Desktop two new files: "product.dta" and "usaww.spmat". These files contain informations on public capital productivity in 48 US states observed over 17 years, as well as the spatial weights matrix for the US states (Munnel, 1990). The examples reported in the xsmle help file make use of these files, also available in R through the Ecdat package.

The first step is to load the "product.dta" into memory by typing

use product.dta, clear

Then, you have to do the same for the spatial weights matrix contained in the "usaww.spmat" file. Being an spmat file, this can be done by typing

spmat use W using "usaww.spmat"

At this stage, after computing the logarithm of the dependent and independent variables, we have all the ingredients to estimate a spatial panel data model. For instance, the syntax to estimate a Spatial AutoRegressive (SAR) model with random effects is

xsmle lngsp lnpcap lnpc lnemp unemp, wmat(W) model(sar)

Notice that the dataset "product.dta" has been already declared to be a panel. In general, you need to declare your dataset to be a panel dataset by using the xtset command.

References

Munnell AH (1990). “Why Has Productivity Growth Declined? Productivity and Public Investment.” New England Economic Review, 1990, 3–22.

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:


where is a normally distributed error term, is the spatial matrix for the autoregressive component, the spatial matrix for the spatially lagged independent variables, the spatial matrix for the idiosyncratic error component. is the individual fixed or random effect and is the time effect. xsmle fits the following nested models:

i) The SAR model with lagged dependent variable ()

,

where the standard SAR model is obtained by setting .

ii) The SDM model with lagged dependent variable ()

,

where the standard SDM model is obtained by setting . xsmle allows to use a different weighting matrix for the spatially lagged dependent variable () and the spatially lagged regressors () together with a different sets of explanatory () and spatially lagged regressors (). The default is to use and .

iii) The SAC model ()

,
,

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

iv) The SEM model ()

,
.

v) The GSPRE model ()

,
,
,

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

Two new Stata commands for the estimation and post-estimation of cross-sectional and panel data stochastic frontier models. sfcross extends the official frontier capabilities by including additional models (Greene 2003; Wang 2002) and command functionality, such as the possibility to manage complex survey data characteristics. Similarly, sfpanel allows to estimate a much wider range of time-varying inefficiency models compared to the official xtfrontier command. In particular, when estimation is done with likelihood-based methods, the SF model is:

where is a normally distributed error term and is a one-sided strictly non-negative term representing inefficiency. The sign of the term is positive or negative depending on whether the frontier describes a cost or production function, respectively. Among the time-varying inefficiency models , sfpanel fits:

i) the true fixed-effects (TFE) and the true random-effects (TRE) models developed by Greene (2005), in which both time-invariant unmeasured heterogeneity and time-varying firm inefficiency are considered;

ii) the Battese and Coelli (1995) model, in which the is obtained by truncation at zero of the normal distribution with mean , where is a set of covariates explaining the mean of inefficiency;

iii) the time decay model by Battese and Coelli (1992), in which , and . is assumed to be truncated-normally distributed with non-zero mean and constant variance, while governs the temporal pattern of inefficiency.

iv) the flexible parametric model by Kumbhakar (1990), in which , and .

Among the time-invariant inefficiency models , sfpanel fits:

v) the Battese and Coelli (1988) model, in which is truncated-normally distributed with non-zero mean and constant variance;

vi) the Pitt and Lee (1981) model, in which is half-normally distributed with constant variance;

When estimation is done with least squares methods, the SF production model is:

Among the time-varying inefficiency models , sfpanel fits:

vii) the Lee and Schmidt (1993) model, in which and are parameters to be estimated. This model is a special case of Kumbhakar (1990), in which is represented by a set of dummy variables for time.

viii) the Cornwell et al. (1990) model, in which

Among the time-invariant inefficiency models , sfpanel fits:

ix) the Schmidt and Sickles (1984) model in which can be either fixed or random.

The two commands were written together with Silvio Daidone, Giuseppe Ilardi and Vincenzo Atella.

You may install them by typing

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

in your Stata command bar.

Click here to access the accompanying paper.

HTH,
Federico

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

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