Learn R Programming

spatialprobit (version 0.9-1)

sartobit: Bayesian estimation of the SAR Tobit model

Description

Bayesian estimation of the spatial autoregressive Tobit model (SAR Tobit model).

Usage

sartobit(formula, W, data, ...)

sar_tobit_mcmc(y, X, W, ndraw = 1000, burn.in = 100, thinning = 1, 
  prior=list(a1=1, a2=1, c=rep(0, ncol(X)), T=diag(ncol(X))*1e12, lflag = 0), 
  start = list(rho = 0.75, beta = rep(0, ncol(X)), sige = 1),
  m=10, computeMarginalEffects=FALSE, showProgress=FALSE)

Arguments

y
dependent variables. vector of zeros and ones
X
design matrix
W
spatial weight matrix
ndraw
number of MCMC iterations
burn.in
number of MCMC burn-in to be discarded
thinning
MCMC thinning factor, defaults to 1.
prior
A list of prior settings for $\rho \sim Beta(a1,a2)$ and $\beta \sim N(c,T)$. Defaults to diffuse prior for beta.
start
list of start values
m
Number of burn-in samples in innermost Gibbs sampler. Defaults to 10.
computeMarginalEffects
Flag if marginal effects are calculated. Defaults to FALSE. We recommend to enable it only when sample size is small.
showProgress
Flag if progress bar should be shown. Defaults to FALSE.
formula
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.
data
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the e
...
additional arguments to be passed

Value

  • Returns a structure of class sartobit:
  • betaposterior mean of bhat based on draws
  • rhoposterior mean of rho based on draws
  • bdrawbeta draws (ndraw-nomit x nvar)
  • pdrawrho draws (ndraw-nomit x 1)
  • sdrawsige draws (ndraw-nomit x 1)
  • totala matrix (ndraw,nvars-1) total x-impacts
  • directa matrix (ndraw,nvars-1) direct x-impacts
  • indirecta matrix (ndraw,nvars-1) indirect x-impacts
  • rdrawr draws (ndraw-nomit x 1) (if m,k input)
  • nobs# of observations
  • nvar# of variables in x-matrix
  • ndraw# of draws
  • nomit# of initial draws omitted
  • nsteps# of samples used by Gibbs sampler for TMVN
  • yy-vector from input (nobs x 1)
  • zip# of zero y-values
  • a1a1 parameter for beta prior on rho from input, or default value
  • a2a2 parameter for beta prior on rho from input, or default value
  • timetotal time taken
  • rmax1/max eigenvalue of W (or rmax if input)
  • rmin1/min eigenvalue of W (or rmin if input)
  • tflag'plevel' (default) for printing p-levels; 'tstat' for printing bogus t-statistics
  • lflaglflag from input
  • cflag1 for intercept term, 0 for no intercept term
  • lndeta matrix containing log-determinant information (for use in later function calls to save time)

Details

Bayesian estimates of the spatial autoregressive Tobit model (SAR Tobit model) $$y = \rho W y + X \beta + \epsilon, \epsilon \sim N(0, \sigma^2_{e} I_n)$$ $$y = (I_n - \rho W)^{-1} X \beta + (I_n - \rho W)^{-1} \epsilon$$ where y $(n \times 1)$ is only observed for y >= 0 and censored to 0 otherwise. $\beta$ is a $(k \times 1)$ vector of parameters associated with the $(n \times k)$ data matrix X. The prior distributions are $\beta \sim N(c,T)$ and $\rho \sim Uni(rmin,rmax)$ or $\rho \sim Beta(a1,a2)$.

References

LeSage, J. and Pace, R. K. (2009), Introduction to Spatial Econometrics, CRC Press, chapter 10, section 10.3, 299--304

See Also

sar_lndet for computing log-determinants

Examples

Run this code
# 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 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)

# full information
yfull <- y

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

# Fit SAR (with complete information)
fit_sar <- sartobit(yfull ~ X-1, W,ndraw=1000,burn.in=200, showProgress=FALSE)
summary(fit_sar)

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

par(mfrow=c(2,2))
for (i in 1:4) {
 ylim1 <- range(fit_sar$B[,i], fit_sartobit$B[,i])
 plot(fit_sar$B[,i], type="l", ylim=ylim1, main=fit_sartobit$names[i], col="red")
 lines(fit_sartobit$B[,i], col="green")
 legend("topleft", legend=c("SAR", "SAR Tobit"), col=c("red", "green"), 
   lty=1, bty="n")
}

Run the code above in your browser using DataLab