#' Generalized Linear Mixed Model (GLMM) for sample size eggs.
#'
#' @param x is the dataframe object for apply the GLMM.
#' @param fam is the name of family distribution.
#' @param aproximation is the Laplace approximation for the hyperparameter option. The options valid are "gaussian", "simplied.laplace" and "laplace".
#' @param integration is the different exploration schemes for the numerical integratio. The option valid are "grid", "eb" and "ccd".
#'
#' @return a INLA object.
#' @export
#'
#' @examples
glmm_sample_size_eggs <- function(x, fam, aproximation, integration){
hyper.prec <- list(theta = list(prior = "pc.prec",
param = c(1, 0.5)))
x$n <- factor(x$n)
x$n <- relevel(x$n, ref = "4")
INLA::inla(formula = eggs ~ n +
f(sector, model = "iid", hyper = hyper.prec)+
f(manzana, model = "iid", hyper = hyper.prec)+
f(loc, model = "iid", hyper = hyper.prec) +
f(mpo, model = "iid", hyper = hyper.prec),
family = fam,
data = x,
verbose = TRUE,
num.threads = 1,
control.inla = list(strategy = aproximation,
int.strategy = integration),
control.compute = list(dic = TRUE, waic = TRUE),
control.predictor = list(compute = TRUE, link = 1))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.