Learn R Programming

spatialprobit (version 0.9-8)

marginal.effects: Compute marginal effects for the SAR probit model

Description

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

Usage

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

Arguments

object
Estimated SAR probit model of class sarprobit
obj
Estimated SAR probit model of class sarprobit
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

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.

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, $S_r(W)$ is defined as $$S_r(W) = \phi\left((I_n - \rho W)^{-1} \bar{x}_r \beta_r \right) \odot (I_n - \rho W)^{-1} I_n \beta_r$$ 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}$$, 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 summary measures: average direct impacts: $M_r(D) = average S_r(W)_{ii} = n^{-1} tr(S_r(W))$ average total impacts: $M_r(T) = n^{-1} 1'_n S_r(W) 1_n$ average indirect impacts: $M_r(I) = M_r(T) - M_r(D)$ Specifically, for the SAR probit model the $n \times n$ matrix of marginal effects is $$\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$$ 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$.

References

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

Examples

Run this code
require(spatialprobit)

# number of observations
n <- 10

# 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 <- sparseMatrix(i=rep(1:n, each=m), 
  j=replicate(n, sample(x=1:n, size=m, replace=FALSE)), x=1/m, dims=c(n, n))

# 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)

Run the code above in your browser using DataLab