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(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 x_{ir} for observation i will not only affect the observations y_i directly (direct impact), but also affect neighboring observations y_j (indirect impact). These impacts potentially also include feedback loops from observation i to observation j and back to i. (see LeSage (2009), section 2.7 for interpreting parameter estimates in spatial models).

For the r-th non-constant explanatory variable, let S_r(W) be the n \times n matrix that captures the impacts from observation i to j.

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

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

and the indirect impact from observation j to observation i as

\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 n 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:

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

  2. average total impacts:

    M_r(T) = n^{-1} 1'_n S_r(W) 1_n

  3. average indirect impacts:

    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 M_r(D), there are efficient approaches available, see LeSage (2009), chapter 4, pp.114/115.

The computation of the average total effects M_r(T) and hence also the average indirect effects M_r(I) are more subtle, as S_r(W) is a dense n \times n matrix. In the LeSage Spatial Econometrics Toolbox for MATLAB (March 2010), the implementation in sarp_g computes the matrix inverse of S= (I_n - \rho W) which all the negative consequences for large n. We implemented n^{-1} 1'_n S_r(W) 1_n via a QR decomposition of 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 n.

SAR probit model

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

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 \times n matrix of marginal effects is

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 \times n matrix and will break down for large n.

2. 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]