Convert to an mcmc object

Share:

Description

Convert to an mcmc object.

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## 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,
                  phipars = phiprior, omgpars = omgprior,
                  linkp = linkp,
                  phisc = phisc, omgsc = omgsc, 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)