prior: A list of prior settings for orrhoBeta(a1,a2)
and betaN(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 TRUE
showProgress: Flag if progress bar should be shown. Defaults to FALSE.
verbose: Flag for more verbose output. Default 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 environment from which sarprobit is called.
subset: an optional vector specifying a subset of observations to be used in the fitting process.
...: additional arguments to be passed
Details
Bayesian estimates of the spatial autoregressive probit model (SAR probit model)
library(Matrix)set.seed(2)# number of observationsn <-100# true parametersbeta <- 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 matrixI_n <- sparseMatrix(i=1:n, j=1:n, x=1)# number of nearest neighbors in spatial weight matrix Wm <-6# spatial weight matrix with m=6 nearest neighbors# W must not have non-zeros in the main diagonal!i <- rep(1:n, each=m)j <- rep(NA, n * m)for(k in1:n){ j[(((k-1)*m)+1):(k*m)]<- sample(x=(1:n)[-k], size=m, replace=FALSE)}W <- sparseMatrix(i, j, x=1/m, dims=c(n, n))# innovationseps <- 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 modelsarprobit.fit1 <- sar_probit_mcmc(y, X, W, ndraw=100, thinning=1, prior=NULL)summary(sarprobit.fit1)