| mcmcmake {geoBayes} | R Documentation |
Convert to an mcmc object
Description
Convert to an mcmc object.
Usage
mcmcmake(...)
Arguments
... |
Output(s) from the functions mentioned in the Details. |
Details
This function takes as input the one or more output(s) from
function mcsglmm or mcstrga and
returns an mcmc object or an
mcmc.list object for coda. The function
requires the coda package to be installed.
The spatial random field components are assigned the names
z_* where * is a number beginning at 1. Similarly,
the regressor coefficients are assigned the names beta_* if
not unique, or simply beta if there is only one regressor.
The names ssq, tsq, phi, omg
correspond to the partial sill, measurement error variance,
spatial range, and relative nugget parameters respectively.
Value
An mcmc object.
See Also
Functions such as plot.mcmc and
summary.mcmc in the coda package. The
function do.call can be used to pass arguments
stored in a list.
Examples
## Not run:
### Load the data
data(rhizoctonia)
rhiz <- na.omit(rhizoctonia)
rhiz$IR <- rhiz$Infected/rhiz$Total # Incidence rate of the
# rhizoctonia disease
### Define the model
corrf <- "spherical"
ssqdf <- 1
ssqsc <- 1
tsqdf <- 1
tsqsc <- 1
betm0 <- 0
betQ0 <- diag(.01, 2, 2)
phiprior <- c(200, 1, 1000, 100) # U(100, 300)
phisc <- 1
omgprior <- c(3, 1, 1000, 0) # U(0, 3)
omgsc <- 1.3
linkp <- 1
## MCMC parameters
Nout <- 100
Nbi <- 0
Nthin <- 1
### Run MCMC
sample <- mcstrga(Yield ~ IR, data = rhiz,
atsample = ~ Xcoord + Ycoord, corrf = corrf,
Nout = Nout, Nthin = Nthin,
Nbi = Nbi, betm0 = betm0, betQ0 = betQ0,
ssqdf = ssqdf, ssqsc = ssqsc,
tsqdf = tsqdf, tsqsc = tsqsc,
linkp = linkp,
corrprior = list(phi = phiprior, omg = omgprior),
corrtuning = list(phi = phisc, omg = omgsc, kappa = 0),
test = FALSE)
mcsample <- mcmcmake(sample)
plot(mcsample[, c("phi", "omg", "beta_1", "beta_2", "ssq", "tsq")],
density = FALSE)
summary(mcsample[, c("phi", "omg", "beta_1", "beta_2", "ssq", "tsq")])
## End(Not run)