*! version 1.0.0 10-05-2019

Title

xtpsse -- runs a conditional fixed-effects Poisson panel regression, computes sandwich and spatial standard errors, and tests for time-invariant spatial
dependence according to Bertanha and Moser (2016).

Data

You need to have a panel dataset with one dependent count data variable and explanatory variables,
besides coordinate information on how cross-section units are located in the R^2 space.
You also need a cross section ID variable and a time variable for your panel. You may either specify the panel using
the xtset <panelvar> <timevar> before you run xtpsse, or your can specify these directly through the i() and t() options.
If you do not have coordinate variables but have information on how far apart observations are, you may want to use commands like mdsmat and mds to generate coordinate variables.

Syntax

xtpsse varlist(numeric) [if] [in]
,
COORDinates(varlist)
CUToffs(numlist >0)
[I(varname)]
[T(varname)]
[TEst(integer)]

where capital letters indicate how you can abbreviate option names.

varlist: (required) enter the list of variables you want to regress, starting by the dependent variable.
You can use abbreviation rules like time_dum* or class1-class20, but only variables that contain numeric values are allowed.
Variables that are constant across time are not allowed.

[if] or [in]: (optional) like in any other STATA command, to restrict the sample you want to obtain your estimates from.

coordinates(varlist) or coord(varlist): (required) enter the two variable names that contain the coordinates.
E.g. you could have coordx and coordy as variables names. The coordinate variables should
contain numeric real values only, they vary across i but are constant across t, and they should be non-missing for all (i,t) observations.

cutoffs(numlist) or cut(numlist): (required) max. distance along each coordinate (x,y) that defines neighborhood of a
cross-sectional unit; this is used to compute the spatial standard error estimates; cross-sectional units are located on R^2 space,
so an example of cutoff would be cut(100.5 123). Cutoffs should be strictly positive.

i(varname): (optional only if you use xtset before xtpsse) specify which variable identifies cross-section units in your panel.
You either specify it through this option OR using xtset <panelvar> <timevar> command, before you run xtpsse.
Either way, you DO need to specify both a cross-section and time index variables before you run xtpsse.

t(varname): (optional only if you use xtset before xtpsse) specify which variable identifies time units in your panel.
You either specify it through this option OR using xtset <panelvar> <timevar> command, before you run xtpsse.
Either way, you DO need to specify both a cross-section and time index variables before you run xtpsse.

test(integer) or te(integer): (optional) integer should be between 0 to K, where K is the number of explanatory variables.
If option test is not inputted, the default value for this option is test(K);
if option test is inputted with integer=0,
the code does not compute the test-statistic;
if option test is inputted with integer>0, the code does compute the test-statistic, and will use at most
the first 'integer' elements of the score vector to construct the test-statistic.
If 'integer' is too large compared to the number of observations, the Jacobian or variance-covariance matrices may be singular.
In this case, the code will automatically reduce the number of score
elements being used in order to have invertible matrices.
The number of spatial lags (used to calculate averages of spatially lagged score functions) is fixed at the 'cutoff' values;
the cutoff value for computing the spatial covariance matrix of the estimated vector of coefficients 'Theta' is fixed at twice the value of 'cutoff'.

Examples

(1)

. xtset cross_id year

. xtpsse y x1-x50 age* if year<2000, coord(xcoord ycoord) cut(1000 2000)

(2)

. xtpsse y x1-x50 age* if year<2000, coord(xcoord ycoord) cut(1000 2000) i(cross_id) t(year)

(3)

. xtpsse y x1-x50 age* if year<2000, coord(xcoord ycoord) cut(1000 2000) i(cross_id) t(year) te(0)

(4)

. xtpsse y x1 x2 x3, coord(xcoord ycoord) cut(1000 2000) i(cross_id) t(year) te(3)

Reference

Bertanha, M., and Moser, Petra. (2016),
Spatial Errors in Count Data Regressions.
Journal of Econometric Methods 5(1), Jan 2016, pg 49-69.