Description Usage Arguments Details Value Examples

Fit a GLMM

1 2 3 |

`formula` |
a two-sided linear formula object describing both the
fixed-effects and random-effects part of the model, with the response
on the left of a |

`subformula` |
a subformula, describing how a substituted variable
depends on covariates, or a list of subformulas, if there is more
than one |

`data` |
an optional data frame, list or environment containing the
variables named in |

`family` |
a GLM family, see |

`method` |
the method used to approximate the likelihood. The options
are |

`control` |
a list of extra parameters controlling the approximation to the likelihood. See 'Details' for more information. |

`weights` |
an optional vector of ‘prior weights’ to be used
in the fitting process. Should be |

`offset` |
this can be used to specify an |

`prev_fit` |
a |

`verbose` |
controls how much detail to print out while fitting the model. For verbose = 0, print nothing. For verbose = 1 (the default), print output approximately once a second during model fitting. For verbose = 2, print out the parameter value and log-likelihood at every stage of optimization. |

The `control`

argument is a list, used to specify further
arguments controlling the approximation to the likelihood:

`nAGQ`

the number of adaptive Gaussian quadrature points. Only used if

`method = "AGQ"`

. Defaults to 15.`nSL`

the level of sparse grid storage. Only used if

`method = "SR"`

. Defaults to 3.`nIS`

the number of samples to use for importance sampling. Only used if

`method = "IS"`

. Defaults to 1000.`order`

the order of Laplace approxiation. only used if

`method = "Laplace"`

. Defaults to 1.`check_Laplace`

should quality of first-order Laplace approximation be checked? Only used if

`method = "Laplace"`

and`order = 1`

. Defaults to TRUE.`divergence_threshold`

if

`check_Laplace = TRUE`

, warn about quality of inference using the first-order Laplace approximation if measure of divergence from inference with second-order Laplace approximation exceeds`divergence_threshold`

. Defaults to 0.1.

An object of the class `glmmFit`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
# Fit a three-level model with the Laplace approximation to the likelihood
(mod_Laplace <- glmm(response ~ covariate + (1 | cluster) + (1 | group),
data = three_level, family = binomial,
method = "Laplace"))
# if we try to fit with adaptive Gaussian quadrature, we get an error
## Not run:
(mod_AGQ <- glmm(response ~ covariate + (1 | cluster) + (1 | group),
data = three_level, family = binomial, method = "AGQ",
control = list(nAGQ = 15)))
## End(Not run)
# We can fit with the Sequential Reduction approximation
## Not run:
(mod_SR <- glmm(response ~ covariate + (1 | cluster) + (1 | group),
data = three_level, family = binomial, method = "SR",
control = list(nSL = 3)))
## End(Not run)
# the estimates of the random effects standard deviations
# are larger than those using the Laplace approximation
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.