Federico Belotti's niche on the web

A new Stata command for spatial differencing estimation is now available. sreg fits the following model:

y_{ic}= \theta_z + \mathbf{x}_{ic}'\mathbf{\beta} + \epsilon_{ic}

where y_{ic} is the outcome of unit i located in area c with c=1,\ldots,C, \mathbf{x}_{ic} is a k-vector of exogenous covariates, \epsilon_{ic} is the idiosyncratic error and \theta_z is an unobserved local effect for the unobserved location z, z=1,\ldots,Z, possibly at a finer spatial scale than c. Estimating this model by ordinary least squares ignoring \theta_z gives a consistent estimate of \mathbf{\beta} only if \mathbb{E}(\theta_z|\mathbf{x}_{ic})=0. If we set aside this unrealistic assumption and allow for arbitrary correlation between the local unobservables and the explanatory variables, i.e. \mathbb{E}(\theta_z|\mathbf{x}_{ic})\neq 0, a non-experimental approach to estimating the model involves, in some way, transforming the data to rule out \theta_z. An increasingly common way to deal with this issue is the so-called spatial differencing approach.

sreg implements the spatial differencing estimator described in Belotti et al. (2017), as well as different variance-covariance estimators, among which the dyadic-robust (Cameron and Miller, 2014) and the Duranton et al. (2011)'s analytically-corrected estimators. Of special note is that sreg also allow to apply the spatial differencing transformation to units located in contiguous clusters ("boundary-discontinuity" design).

The command was written together with Edoardo Di Porto and Gianluca Santoni.

You may install it by typing

net install sreg, from(

in your Stata command bar. Stata version 14.2 is required.


A new Stata command for the consistent estimation of fixed-effects stochastic frontier models is now available. sftfe fits the following fixed-effects stochastic frontier model:

y_{it} = \alpha_i + x_{it}\beta + v_{it} \pm u_{it}

where v_{it} is a normally distributed error term and u_{it} is a one-sided strictly non-negative term representing inefficiency. The sign of the u_{it} term is positive or negative depending on whether the frontier describes a cost or production function, respectively. sftfe allows the underlying mean and variance of the inefficiency (as well as the variance of the idiosyncratic error) to be expressed as functions of exogenous covariates. Of special note is that sftfe allows the estimation of models in which the inefficiency is assumed to follow a first-order autoregressive process.

Technical details related to the estimators implemented in the command can be found in the article:

Belotti, F., Ilardi, G., (2015). Consistent Inference in Fixed-effects Stochastic Frontier Models, Temi di discussione (Economic working papers), Bank of Italy (forthcoming).

The command was written together with Giuseppe Ilardi.

You may install it by typing

net install sftfe, all from(

in your Stata command bar.


CEIS, Centre for Economics and International Studies - Tor Vergata is hosting the 1st ERASMUS Intensive Programme on Efficiency and Productivity Analysis Programme (EPASP) organised with CHE, Centre for Health Economics - University of York and COHERE, Centre for Health Economics Research - University of Southern Denmark.

This course will present the latest contributions and developments in the field of efficiency and productivity growth measurement in manufacturing and services. The objective is to provide a comprehensive and up–to–date survey of the existing models, together with a significant discussion on data and on the core methods of practically measuring efficiency and productivity. First, the students are introduced to the measurement of partial and total factor productivity growth. Different parametric and non–parametric approaches to the productivity measurement in the context of firm–specific modeling are discussed. Second, a detailed survey of the econometric approach to efficiency analysis will be discussed, focusing on modeling, distributional assumptions and estimation methods. The correspondence between a number of hypotheses and empirical findings are examined through a varieties of relevant empirical applications. Third, measurement of inputs and outputs in manufacturing and services are discussed, with a particular emphasis to the analysis of efficiency and productivity growth in the service sector.

Morning classes will cover theoretical topics while computer sessions, in the afternoon, will focus on applied issues that will be analysed, mainly, using the Stata commands sfcross and sfpanel, two new user written packages documented at Stata Journal.

For this reason a good knowledge of STATA (data management, do file programming) is a prerequisite for the admission.

Apply now!

Missing data can pose major problems when estimating econometric models since it is generally unlikely that missing values are Missing Completely At Random. A strategy to address this issue without using more complex econometric approaches is represented by multiple imputation, that is the process of replacing missing values by multiple sets of plausible values. This post provides a simple example in which xsmle is used together with mi, a Stata's suite of commands that deals with multiple data imputation. Consider the following data in which the only regressor (x1) has 14 missing values

. sum y x1

    Variable |       Obs        Mean    Std. Dev.       Min        Max
           y |       940    4.144785    1.674932  -.7510805   9.170195
          x1 |       926    1.375773    1.202928  -2.039139   4.966914

Since these missing values make the panel unbalanced, xsmle will not be able to work. Nonetheless, we can overcome the obstacle by exploiting mi and xsmle jointly.

The first step is to declare the dataset as a mi dataset. The command mi set wide is the appropriate one. Indeed, data must be mi setted before other mi commands can be used. It does not matter which mi style you choose since you can always change it using mi convert. In this example, I choose the wide style.

. mi set wide                                                       

. mi register imputed x1                                 

. set seed 1712                                                      

. mi impute regress x1 =, add(10)   

Univariate imputation                   Imputations =       10
Linear regression                             added =       10
Imputed: m=1 through m=10                   updated =        0

               |              Observations per m              
      Variable |   complete   incomplete   imputed |     total
            x1 |        926           14        14 |       940
(complete + incomplete = total; imputed is the minimum across m
 of the number of filled in observations.)

Once the dataset has been mi setted, the second step is to register the variables with missing values. In this example, x1 is a variable that has missing values and mi register imputed x1 declares this variable as a variable to be imputed. A good practice for reproducible results is to set the seed of the Stata's pseudo random number generator using the command set seed #, where # is any number between between 0 and 2^31-1.

Then, the command mi impute regress x1 =, add(10) can be used to fill in missing values of x1 using the set of dummy variables from the categorical variable cat through the regress method (see help mi impute for detail on the available methods). The option add(10) specifies the number of imputations to add to the mi data (currently, the total number of imputations cannot exceed 1,000). After mi impute regress x1 =, add(10) has been executed, ten new variables _#_x1 (with # = 1,...,10) will be created in the dataset, each representing an imputed version of x1.

. mi estimate, dots: xsmle y x1, wmat(W) model(sdm) fe type(ind)

Imputations (10):
  .........10 done

Multiple-imputation estimates                     Imputations     =         10
SDM with spatial fixed-effects                    Number of obs   =        940
                                                  Average RVI     =     0.0409
                                                  Complete DF     =        748
DF adjustment:   Small sample                     DF:     min     =     421.51
                                                          avg     =     624.79
                                                          max     =     732.54
Model F test:       Equal FMI                     F(   7,  730.5) =     214.64
Within VCE type:          OIM                     Prob > F        =     0.0000

           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
Main         |
          x1 |   .3927311   .0358267    10.96   0.000     .3223164    .4631458
Wx           |
          x1 |   .7172546   .0759222     9.45   0.000     .5682036    .8663056
Spatial      |
         rho |   .3342481   .0404076     8.27   0.000     .2548957    .4136005
Variance     |
    sigma2_e |   .8201919   .0385477    21.28   0.000     .7445121    .8958717
Direct       |
          x1 |   .4641954   .0315439    14.72   0.000     .4021925    .5261983
Indirect     |
          x1 |   1.215779   .1155787    10.52   0.000     .9888711    1.442687
Total        |
          x1 |   1.679974    .127172    13.21   0.000     1.430302    1.929647

Finally, as documented in help mi estimate, the prefix command mi estimate: estimation_command can be used to execute the estimation_command on the imputed _#_x1 variables. This command will adjust coefficients and standard errors for the variability between imputations according to the combination rules by Rubin (1987). In this example, the command

mi estimate, dots: xsmle y x1, wmat(W) model(sdm) fe type(ind)

estimates a spatial fixed effects Durbin model on the ten imputed versions of the x1 variable.


Official Stata manuals and help files.
Rubin, D. B. 1987. Multiple Imputation for Nonresponse in Surveys. New York: Wiley.

Powered by WordPress © 2005 - 2017 © Web Design by myself using Arjuna-x theme (by SRS Solutions)