mcmcmake | R Documentation |
mcmc
objectConvert to an mcmc
object.
mcmcmake(...)
... |
Output(s) from the functions mentioned in the 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.
An mcmc object.
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.