# load data
data(iowaSW06)
Q <- list( list(type="CAR1",content=c(33,24)) )
# construct the design matrix with with as many columns as there are
# in null space of kronecker prod of Q's
X <- matrix( rep(1,33*24), ncol=1)
# parameters of gamma prior densities on tausqy, tausqphi[1], tausqphi[2]
alpha2 = beta2 <- c(.1, .1)
# number of samples
nsamp = 100
#random seed
myseed = 314
output <- CARrampsOcl.fit(alpha=alpha2,
beta=beta2, Q=Q, y=iowaSW06, nsamp=nsamp,
seed=myseed,
fixed = FALSE, randeffs=TRUE, coefs=TRUE,designMat=X,
mult= 50)
# plot the raw data and the posterior means of the site-specific random effects
plotCAR1( output, numcols=32, col = rev(terrain.colors(32)),
cardims = c(33 ,24 ), rev.inds = c(FALSE, TRUE))
Run the code above in your browser using DataLab