# bf2optim: Empirical Bayes estimator In geoBayes: Analysis of Geostatistical Data using Bayes and Empirical Bayes Methods

## Description

Estimation by empirical Bayes.

## Usage

 `1` ```bf2optim(bf1obj, paroptim, useCV = TRUE, control = list()) ```

## Arguments

 `bf1obj` Output from the function `bf1skel` which contains the Bayes factors and importance sampling weights. `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 `optim`.

## 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

 ``` 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``` ```## Not run: data(rhizoctonia) ### Define the model corrf <- "spherical" kappa <- 0 ssqdf <- 1 ssqsc <- 1 betm0 <- 0 betQ0 <- .01 linkp <- "probit" ### Skeleton points philist <- c(100, 140, 180) omglist <- c(.5, 1) parlist <- expand.grid(phi=philist, linkp=linkp, 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, 'binomial', rhizoctonia, weights = Total, atsample = ~ Xcoord + Ycoord, Nout = Nout, Nthin = Nthin, Nbi = Nbi, betm0 = betm0, betQ0 = betQ0, ssqdf = ssqdf, ssqsc = ssqsc, phistart = parlist\$phi[i], omgstart = parlist\$omg[i], linkp = parlist\$linkp[i], kappa = parlist\$kappa[i], corrfcn = corrf, phisc = 0, omgsc = 0) } bf <- bf1skel(runs) est <- bf2optim(bf, list(linkp = linkp, phi = c(100, 200), omg = c(0, 2))) est ## End(Not run) ```

geoBayes documentation built on May 14, 2018, 1:03 a.m.