bf2optim {geoBayes} | R Documentation |
Empirical Bayes estimator
Description
Estimation by empirical Bayes.
Usage
bf2optim(bf1obj, paroptim, useCV = TRUE, control = list())
Arguments
bf1obj |
Output from the function |
paroptim |
A named list with the components "linkp", "phi", "omg", "kappa". Each component must be numeric with length 1, 2, or 3 with elements in increasing order but for the binomial family linkp is also allowed to be the character "logit" and "probit". If the compontent's length is 1, then the corresponding parameter is considered to be fixed at that value. If 2, then the two numbers denote the lower and upper bounds for the optimisation of that parameter (infinities are allowed). If 3, these correspond to lower bound, starting value, upper bound for the estimation of that parameter. |
useCV |
Whether to use control variates for finer corrections. |
control |
A list of control parameters for the optimisation.
See |
Details
This function is a wrap around bf2new
using the
"L-BFGS-B" method of the function optim
to
estimate the parameters.
Value
The output from the function optim
.
The "value"
element is the log-Bayes factor, not the
negative log-Bayes factor.
Examples
## Not run:
data(rhizoctonia)
### Define the model
corrf <- "spherical"
kappa <- 0
ssqdf <- 1
ssqsc <- 1
betm0 <- 0
betQ0 <- .01
family <- "binomial.probit"
### Skeleton points
philist <- c(100, 140, 180)
omglist <- c(.5, 1)
parlist <- expand.grid(linkp=0, phi=philist, omg=omglist, kappa = kappa)
### MCMC sizes
Nout <- 100
Nthin <- 1
Nbi <- 0
### Take MCMC samples
runs <- list()
for (i in 1:NROW(parlist)) {
runs[[i]] <- mcsglmm(Infected ~ 1, family, rhizoctonia, weights = Total,
atsample = ~ Xcoord + Ycoord,
Nout = Nout*c(.8,.2), Nthin = Nthin, Nbi = Nbi,
betm0 = betm0, betQ0 = betQ0,
ssqdf = ssqdf, ssqsc = ssqsc,
phi = parlist$phi[i], omg = parlist$omg[i],
linkp = parlist$linkp[i], kappa = parlist$kappa[i],
corrfcn = corrf,
corrtuning=list(phi = 0, omg = 0, kappa = 0))
}
bf <- bf1skel(runs)
est <- bf2optim(bf, list(phi = c(100, 200), omg = c(0, 2)))
est
## End(Not run)