*! version 1.4.2 06feb2024

*! Sebastian Kripfganz, www.kripfganz.de

*! Vasilis Sarafidis, sites.google.com/view/vsarafidis

Title

spxtivdfreg -- Defactored IV estimation of large spatial panel data models

Syntax

spxtivdfreg depvar [indepvars] [if] [in] [, options]

options

Model
* spmatrix(spmat_spec) specify spatial weights matrix

splag include spatial lag of depvar

tlags(#) include time lags of depvar

sptlags(#) include spatial time lags of depvar

spindepvars(varlist) include spatially lagged indepvars

iv(iv_spec) instruments; can be specified more than once

xtivdfreg_options other options for xtivdfreg estimation

* The option spmatrix() is required.

spmat_spec is

matname|filename [, spmatrix|mata|stata|import import_options]

iv_spec is

varlist [, splags spiv(spvarlist) fvar(fvars) lags(#) factmax(#) [no]eigratio [no]std [no]doubledefact]

You must xtset your data before using spxtivdfreg; see [XT] xtset. The panel data set must be strongly balanced.

All varlists may contain factor variables; see fvvarlist. This requires the community-contributed package ftools to be installed; see ftools.

depvar and all varlists may contain time-series operators; see tsvarlist.

spxtivdfreg is a wrapper for xtivdfreg. See spxtivdfreg postestimation for features available after estimation.

Description

spxtivdfreg implements the instrumental variables (IV) estimator for large spatial panel data models, as developed by Cui, Sarafidis, and Yamagata (2023) and Chen, Cui, Sarafidis, and Yamagata (2023)
as an extension of Norkute, Sarafidis, Yamagata, and Cui (2021) and Cui, Norkute, Sarafidis, and Yamagata (2022) to models with spatial lags of the dependent and independent variables.
The instruments are defactored to control for a multifactor error structure. Heterogeneous slope coefficients can be allowed using a mean-group (MG) estimator.

The defactorization procedure and related options are explained in detail by Kripfganz and Sarafidis (2021, 2024); see xtivdfreg.

Options

Model

spmatrix(matname|filename [, spmatrix|mata|stata|import import_options]) specifies the spatial weights matrix.
The suboptions spmatrix, mata, or stata declare matname to be an SP matrix, a Mata matrix, or a Stata matrix, respectively.
Suboption import requests to import a matrix from filename (requires Stata version 14 or higher), which must be an Excel file or a delimited text file. import_options can be any options allowed with
import excel or import delimited, depending on the file type. spmatrix is the default; see [SP] spmatrix (requires Stata version 15 or higher).

splag requests to include a spatial lag of depvar as an additional regressor.

tlags(#) requests to include # time lags of depvar as additional regressors. The default is tlags(0).

sptlags(#) requests to include # spatial time lags of depvar as additional regressors. The default is sptlags(0).

spindepvars(varlist) requests to include spatial lags of varlist as additional independent variables.

iv(varlist [, splags spiv(spvarlist) fvar(fvars) lags(#) factmax(#) [no]eigratio [no]std [no]doubledefact]) specifies instrumental variables.
One can specify as many sets of instruments as required. Variables in the same set are defactored jointly. External variables that are not part of the regression model can also be used as instruments in varlist.

splags adds spatial lags of all variables in varlist as additional instrumental variables. splags is equivalent to spiv(varlist).

spiv(spvarlist) adds spatial lags of spvarlist as additional instrumental variables.

fvar(fvars) specifies that factors are extracted from the variables in fvars. The default is to extract factors from all variables in varlist.

lags(#) specifies the # of lags of varlist to be added to the set of instruments.
The variables at each lag order are defactored separately with factors extracted from the corresponding lag of fvars. The default is lags(0).

factmax(#) specifies the maximum number of factors to be extracted from fvars. The default is set by the global option factmax(#).

noeigratio and eigratio request to either use a fixed number of factors as specified with suboption factmax(#) or to use the Ahn and Horenstein (2013) eigenvalue ratio test to compute the number of factors.
eigratio is the default unless otherwise specified with the global option noeigratio.

std and nostd request to compute factors from either standardized or nonstandardized variables. nostd is the default unless otherwise specified with the global option std.

doubledefact requests to include fvars in a further defactorization stage of the entire model for the first-stage estimator. All sets of instruments that are included in this defactorization stage are jointly defactored,
excluding lags of fvars specified with suboption lags(#). nodoubledefact requests to avoid implementing a further defactorization stage of the entire model for the first-stage estimator.
The default is set by the global option [no]doubledefact.

xtivdfreg_options: absorb(absvars), factmax(#), [no]doubledefact, fstage, mg, and noconstant; see xtivdfreg.

Reporting

xtivdfreg_options: level(#), coeflegend, noheader, notable, and other display_options; see xtivdfreg.

Optimization

xtivdfreg_options: noeigratio and std; see xtivdfreg.

Remarks

Factors are extracted from the specified instruments excluding their spatial lags, because the latter are driven by the same factors. The user is encouraged to become familiar with the details on the defactorization stages by studying
the xtivdfreg help file and the discussion in Kripfganz and Sarafidis (2021, 2024).

After the estimation, the command leaves the spatial weights matrix in memory as a Mata matrix named spxtivdfreg_spmat.
If the spatial weights matrix was initially imported from a file, this Mata matrix can subsequently be used to re-estimate the same or other model specifications without the need of re-importing the spatial weights matrix.
However, this Mata matrix is overwritten each time the command is run. If this is undesired, a copy of it needs to be made manually.

It is the user's responsibility to check that the ordering of the elements in the specified spatial weights matrix is the same as that of the cross-sectional groups in the data set.

Example

Setup (requires Stata version 15 or higher)

(The data set and spatial weights matrix are available as ancillary files for the xtivdfreg package. The spatial weights matrix files will be copied to the current working directory.)

. use http://www.kripfganz.de/stata/spxtivdfreg_example

. copy http://www.kripfganz.de/stata/spxtivdfreg_example_spmat.stswm .

. copy http://www.kripfganz.de/stata/spxtivdfreg_example_spmat.csv .

Defactored IV estimation with spatial lag and time lag, homogeneous slopes

Spatial weights matrix from spmatrix

. spmatrix use W using spxtivdfreg_example_spmat

. spxtivdfreg NPL INEFF CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, absorb(ID) splag tlags(1) spmatrix(W) iv(INTEREST CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, splags lag(1)) std

Spatial weights matrix from Excel or delimited file

. spxtivdfreg NPL INEFF CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, absorb(ID) splag tlags(1) spmatrix("spxtivdfreg_example_spmat.csv", import) iv(INTEREST CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, splags lag(1)) std

Defactored IV estimation with spatial lag and time lag, heterogeneous slopes

. spxtivdfreg NPL INEFF CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, absorb(ID) splag tlags(1) spmatrix(W) iv(INTEREST CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, splags lag(1)) std mg

IV estimation with spatial lag and time lag, no common shocks

. spxtivdfreg NPL INEFF CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, absorb(ID) splag tlags(1) spmatrix(W) iv(INTEREST CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, splags lag(1)) std factmax(0)

Defactored IV estimation with spatial lag, time lag, and spatial time lag

. spxtivdfreg NPL INEFF CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, absorb(ID) splag tlags(1) sptlags(1) spmatrix(W) iv(INTEREST CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, splags lag(1)) std

Defactored IV estimation with spatial lag, time lag, and spatially lagged independent variable (dynamic spatial Durbin model)

. spxtivdfreg NPL INEFF CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, absorb(ID) splag tlags(1) spindepvars(PROFIT) spmatrix(W) iv(INTEREST CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, splags lag(1)) std

Defactored IV estimation with time lag but no spatial lags

. spxtivdfreg NPL INEFF CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, absorb(ID) tlags(1) spmatrix(W) iv(INTEREST CAR SIZE BUFFER PROFIT QUALITY LIQUIDITY, lag(1)) std

See Kripfganz and Sarafidis (2024) for a detailed discussion of some of these examples.

Saved results

In addition to results saved by xtivdfreg, spxtivdfreg saves the following in e():

Scalars

e(splag) spatial lag of depvar

e(tlags) time lags of depvar

e(sptlags) spatial time lags of depvar

e(maxeig) maximum eigenvalue of spatial weights matrix

Authors

Sebastian Kripfganz, University of Exeter, http://www.kripfganz.de

Vasilis Sarafidis, Brunel University London, https://sites.google.com/view/vsarafidis

References

Ahn, S. C., and A. R. Horenstein. 2013.
Eigenvalue ratio test for the number of factors.
Econometrica 81: 1203-1227.

Chen, J., G. Cui, V. Sarafidis, and T. Yamagata. 2023.
IV estimation of heterogeneous spatial dynamic panels with interactive effects.
Manuscript.

Cui, G., M. Norkute, V. Sarafidis, and T. Yamagata. 2022.
Two-stage instrumental variable estimation of linear panel data models with interactive effects.
Econometrics Journal 25: 340-361.

Cui, G., V. Sarafidis, and T. Yamagata. 2023.
IV estimation of spatial dynamic panels with interactive effects: Large sample theory and an application on bank attitute toward risk.
Econometrics Journal: 26: 124-146.

Kripfganz, S., and V. Sarafidis. 2021.
Instrumental-variable estimation of large-T panel-data models with common factors.
Stata Journal 21: 659-686.

Kripfganz, S., and V. Sarafidis. 2024.
Estimating spatial dynamic panel data models with unobserved common factors in Stata.
Manuscript.

Norkute, M., V. Sarafidis, T. Yamagata, and G. Cui. 2021.
Instrumental variable estimation of dynamic linear panel data models with defactored regressors and a multifactor error structure.
Journal of Econometrics 220: 416-446.