Usage
ST.CARadaptive(formula, family, data=NULL, trials=NULL, W, burnin, n.sample, thin=1,
prior.mean.beta=NULL, prior.var.beta=NULL, prior.nu2=NULL, prior.tau2=NULL,
prior.zeta2 = NULL, verbose=TRUE, rhofix = NULL, epsilon = 0)
Arguments
formula
A formula for the covariate part of the model using the syntax of the
lm() function. Offsets can be included here using the offset() function.
The response and each covariate should be vectors of length (KT)*1, where
K is the n
family
One of either `binomial', `gaussian' or `poisson', which respectively specify a
binomial likelihood model with a logistic link function, a Gaussian likelihood
model with an identity link function, or a Poisson likelihood model with a
data
An optional data.frame containing the variables in the formula.
trials
A vector the same length as the response containing the total number of trials
for each area and time period. Only used if family=`binomial'.
W
A K by K neighbourhood matrix (where K is the number of spatial units).
Typically a binary specification is used, where the jkth element equals one
if areas (j, k) are spatially close (e.g. share a common border) and is zero
o
burnin
The number of McMC samples to discard as the burnin period.
n.sample
The number of McMC samples to generate.
thin
The level of thinning to apply to the McMC samples to reduce their temporal
autocorrelation. Defaults to 1.
prior.mean.beta
A vector of prior means for the regression parameters beta (Gaussian priors are
assumed). Defaults to a vector of zeros.
prior.var.beta
A vector of prior variances for the regression parameters beta (Gaussian priors
are assumed). Defaults to a vector with values 1000.
prior.nu2
The prior shape and scale in the form of c(shape, scale) for an Inverse-Gamma(shape, scale)
prior for the Gaussian error variance nu2. Defaults to c(0.001, 0.001) and only used if
family=`Gaussian'.
prior.tau2
The prior shape and scale in the form of c(shape, scale) for an Inverse-Gamma(shape, scale)
prior for the random effect variance tau2. Defaults to c(0.001, 0.001).
prior.zeta2
The prior shape and scale in the form of c(shape, scale) for an Inverse-Gamma(shape, scale)
prior for the second level adjacency random effect variance zeta2. Defaults to
c(0.001, 0.001).
verbose
Logical, should the function update the user on its progress.
rhofix
Value between 0 and 1 at which to fix the spatial correlation parameter. Setting to 1, reduces the random effects prior to the intrinsic CAR model. When set to NULL, (the default) the parameter is estimated with a uniform[0,1] prior.
epsilon
Diagonal ridge parameter to add to the random effects prior precision, only required when rhofix = 1, and the prior precision is improper. Defaults to 0.