marginal.effects {spatialprobit}R Documentation

Marginal effects for spatial probit and Tobit models (SAR probit, SAR Tobit)

Description

Estimate marginal effects (average direct, indirect and total impacts) for the SAR probit and SAR Tobit model.

Usage

## S3 method for class 'sarprobit'
marginal.effects(object, o = 100, ...)
## S3 method for class 'sartobit'
marginal.effects(object, o = 100, ...)
## S3 method for class 'sarprobit'
impacts(obj, file=NULL, 
  digits = max(3, getOption("digits")-3), ...)
## S3 method for class 'sartobit'
impacts(obj, file=NULL, 
  digits = max(3, getOption("digits")-3), ...)

Arguments

object

Estimated model of class sarprobit or sartobit

obj

Estimated model of class sarprobit or sartobit

o

maximum value for the power tr(Wi),i=1,...,otr(W^i), i=1,...,o to be estimated

digits

number of digits for printing

file

Output to file or console

...

additional parameters

Details

impacts() will extract and print the marginal effects from a fitted model, while marginal.effects(x) will estimate the marginal effects anew for a fitted model.

In spatial models, a change in some explanatory variable xirx_{ir} for observation ii will not only affect the observations yiy_i directly (direct impact), but also affect neighboring observations yjy_j (indirect impact). These impacts potentially also include feedback loops from observation ii to observation jj and back to ii. (see LeSage (2009), section 2.7 for interpreting parameter estimates in spatial models).

For the rr-th non-constant explanatory variable, let Sr(W)S_r(W) be the n×nn \times n matrix that captures the impacts from observation ii to jj.

The direct impact of a change in xirx_{ir} on its own observation yiy_i can be written as

yixir=Sr(W)ii \frac{\partial y_i}{\partial x_{ir}} = S_r(W)_{ii}

and the indirect impact from observation jj to observation ii as

yixjr=Sr(W)ij \frac{\partial y_i}{\partial x_{jr}} = S_r(W)_{ij}

.

LeSage(2009) proposed summary measures for direct, indirect and total effects, e.g. averaged direct impacts across all nn observations. See LeSage(2009), section 5.6.2., p.149/150 for marginal effects estimation in general spatial models and section 10.1.6, p.293 for marginal effects in SAR probit models.

We implement these three summary measures:

  1. average direct impacts:

    Mr(D)=Sr(W)iiˉ=n1tr(Sr(W))M_r(D) = \bar{S_r(W)_{ii}} = n^{-1} tr(S_r(W))

  2. average total impacts:

    Mr(T)=n11nSr(W)1nM_r(T) = n^{-1} 1'_n S_r(W) 1_n

  3. average indirect impacts:

    Mr(I)=Mr(T)Mr(D)M_r(I) = M_r(T) - M_r(D)

The average direct impact is the average of the diagonal elements, the average total impacts is the mean of the row (column) sums.

For the average direct impacts Mr(D)M_r(D), there are efficient approaches available, see LeSage (2009), chapter 4, pp.114/115.

The computation of the average total effects Mr(T)M_r(T) and hence also the average indirect effects Mr(I)M_r(I) are more subtle, as Sr(W)S_r(W) is a dense n×nn \times n matrix. In the LeSage Spatial Econometrics Toolbox for MATLAB (March 2010), the implementation in sarp_g computes the matrix inverse of S=(InρW)S= (I_n - \rho W) which all the negative consequences for large n. We implemented n11nSr(W)1nn^{-1} 1'_n S_r(W) 1_n via a QR decomposition of S=(InρW)S = (I_n - \rho W) (already available from a previous step) and solving a linear equation, which is less costly and will work better for large nn.

SAR probit model

Specifically, for the SAR probit model the n×nn \times n matrix of marginal effects is

Sr(W)=E[yxr]xr=ϕ((InρW)1xˉrβr)(InρW)1Inβr S_r(W) = \frac{\partial E[y | x_r]}{\partial x_{r}'} = \phi\left((I_n - \rho W)^{-1} \bar{x}_r \beta_r \right) \odot (I_n - \rho W)^{-1} I_n \beta_r

SAR Tobit model

Specifically, for the SAR Tobit model the n×nn \times n matrix of marginal effects is

Sr(W)=E[yxr]xr=Φ((InρW)1xˉrβr/σ)(InρW)1Inβr S_r(W) = \frac{\partial E[y | x_r]}{\partial x_{r}'} = \Phi\left((I_n - \rho W)^{-1} \bar{x}_r \beta_r / \sigma \right) \odot (I_n - \rho W)^{-1} I_n \beta_r

Value

This function returns a list with 6 elements: 'direct' for direct effects, 'indirect' for indirect effects, 'total' for total effects, and 'summary_direct', 'summary_indirect', 'summary_total' for the summary of direct, indirect and total effects.

Warning

1. Although the direct impacts can be efficiently estimated, the computation of the indirect effects require the inversion of a n×nn \times n matrix and will break down for large nn.

2. tr(Wi)tr(W^i) is determined with simulation, so different calls to this method will produce different estimates.

Author(s)

Stefan Wilhelm <wilhelm@financial.com>

References

LeSage, J. and Pace, R. K. (2009), Introduction to Spatial Econometrics, CRC Press

See Also

marginal.effects.sartobit

Examples


require(spatialprobit)

# number of observations
n <- 100

# true parameters
beta <- c(0, 1, -1)
rho <- 0.75

# design matrix with two standard normal variates as "covariates"
X <- cbind(intercept=1, x=rnorm(n), y=rnorm(n))

# sparse identity matrix
I_n <- sparseMatrix(i=1:n, j=1:n, x=1)

# number of nearest neighbors in spatial weight matrix W
m <- 6

# spatial weight matrix with m=6 nearest neighbors
# W must not have non-zeros in the main diagonal!
W <- kNearestNeighbors(x = rnorm(n), y = rnorm(n), k = m)

# innovations
eps <- rnorm(n=n, mean=0, sd=1)

# generate data from model 
S <- I_n - rho * W
z <- solve(qr(S), X %*% beta + eps)
y <- as.vector(z >= 0)  # 0 or 1, FALSE or TRUE

# estimate SAR probit model
set.seed(12345)
sarprobit.fit1 <- sar_probit_mcmc(y, X, W, ndraw=500, burn.in=100, 
  thinning=1, prior=NULL, computeMarginalEffects=TRUE)
summary(sarprobit.fit1)

# print impacts
impacts(sarprobit.fit1)

################################################################################
#
# Example from LeSage/Pace (2009), section 10.3.1, p. 302-304
#
################################################################################

# Value of "a" is not stated in book! 
# Assuming a=-1 which gives approx. 50% censoring
 library(spatialprobit)

a <- -1   # control degree of censored observation
n <- 1000
rho <- 0.7
beta <- c(0, 2)
sige <- 0.5
I_n <- sparseMatrix(i=1:n, j=1:n, x=1)
x <- runif(n, a, 1)
X <- cbind(1, x)
eps <- rnorm(n, sd=sqrt(sige))
param <- c(beta, sige, rho)

# random locational coordinates and 6 nearest neighbors
lat <- rnorm(n)
long <- rnorm(n)
W <- kNearestNeighbors(lat, long, k=6)

y <- as.double(solve(I_n - rho * W) %*% (X %*% beta + eps))
table(y > 0)

# set negative values to zero to reflect sample truncation
ind <- which(y <=0)
y[ind] <- 0

# Fit SAR Tobit (with approx. 50% censored observations)
fit_sartobit <- sartobit(y ~ x, W, ndraw=1000, burn.in=200, 
  computeMarginalEffects=TRUE, showProgress=TRUE)

# print impacts
impacts(fit_sartobit)


[Package spatialprobit version 1.0.4 Index]