Fit Bayesian spatial micobin regression model under canonical link (cobit link) with Markov chain Monte Carlo (MCMC). $$ y(s_{i}) \mid x(s_{i}), u(s_i) \stackrel{ind}{\sim} micobin(x(s_{i})^T\beta + u(s_i), \psi), \quad u(\cdot)\sim GP $$ for \(i=1,\dots,n\). See dmicobin for details on micobin distribution. It currently only supports mean zero GP with exponential covariance $$ cov(u(s_i), u(s_j)) = \sigma_u^2\exp(-\phi_u d(s_i,s_j)) $$ where \(\phi_u\) corresponds to inverse range parameter.
spmicobinreg(
formula,
data,
link = "cobit",
coords,
NNGP = FALSE,
contrasts = NULL,
priors = list(beta_intercept_scale = 10, beta_scale = 2.5, beta_df = Inf),
nngp.control = list(n.neighbors = 15, ord = order(coords[, 1])),
nburn = 1000,
nsave = 1000,
nthin = 1
)
Returns list of
a matrix of posterior samples (coda::mcmc) with nsave rows
a matrix of posterior samples (coda::mcmc) of random effects, with nsave rows
a nsave x n matrix of pointwise log-likelihood values, can be used for WAIC calculation.
list of hyperprior information
number of MCMC samples
wall-clock time for running MCMC
wall-clock time for preprocessing before MCMC
response vector
fixed effect design matrix
a n x 2 matrix of Euclidean coordinates
if NNGP = TRUE, also returns
a list of control parameters for NNGP prior
an "NNGP" class with empty samples, placeholder for prediction
an object of class "formula" or a two-sided linear formula object describing both the fixed-effects and random-effects part of the model; see "lmer"
data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model.
character, link function (default "cobit"). Only supports canonical link function "cobit" that is compatible with Kolmogorov-Gamma augmentation.
a n x 2 matrix of Euclidean coordinates
logical, if TRUE, use NNGP prior for the spatial random effects; see spNNGP
an optional list. See the contrasts.arg of model.matrix.default.
a list of prior hyperparameters. See Details
a list of control parameters for NNGP prior (only when NNGP = TRUE). This should be a named list of n.neighbors and ord, with default of 15 and first coordiate-based ordering.. See spNNGP for details.
number of burn-in MCMC iterations.
number of posterior samples. Total MCMC iteration is nburn + nsave*nthin
thin-in rate. Total MCMC iteration is nburn + nsave*nthin
The prior setting can be controlled with "priors" argument. Prior for regression coefficients are independent normal or t prior centered at 0. "priors" is a named list of:
beta_intercept_scale, Default 100, the scale of the intercept prior
beta_scale, Default 100, the scale of nonintercept fixed-effect coefficients
beta_df, Default Inf, degree of freedom of t prior. If beta_df=Inf
, it corresponds to normal prior
lambda_max, Default 70, upper bound for lambda (integer)
psi_ab, Default c(2,2), beta shape parameters for \(\psi\) (length 2 vector).
logprior_sigma.sq, Default half-Cauchy on the sd(u) \(=\sigma_u\), log prior of var(u)\(=\sigma_u^2\)
phi_lb, lower bound of uniform prior of \(\phi_u\) (inverse range parameter of spatial random effect). Can be same as phi_ub
phi_ub, lower bound of uniform prior of \(\phi_u\) (inverse range parameter of spatial random effect). Can be same as phi_lb
# \donttest{
# Please see https://github.com/changwoo-lee/cobin-reproduce
# }
Run the code above in your browser using DataLab