buildmerControl {buildmer} | R Documentation |
Set control options for buildmer
Description
buildmerControl
provides all the knobs and levers that can be manipulated during the buildmer fitting and summary
/anova
process. Some of these are part of buildmer's core functionality—for instance, crit
allows to specify different elimination criteria, a core buildmer feature—whereas some are only meant for internal usage, e.g. I_KNOW_WHAT_I_AM_DOING
is only used to turn off the PQL safeguards in buildbam
/buildgam
, which you really should only do if you have a very good reason to believe that the PQL check is being triggered erroneously for your problem.
Usage
buildmerControl(
formula = quote(stop("No formula specified")),
data = NULL,
family = gaussian(),
args = list(),
direction = c("order", "backward"),
cl = NULL,
crit = NULL,
elim = NULL,
fit = function(...) stop("No fitting function specified"),
include = NULL,
quiet = FALSE,
calc.anova = FALSE,
calc.summary = TRUE,
ddf = "Wald",
quickstart = 0,
singular.ok = FALSE,
grad.tol = formals(buildmer::converged)$grad.tol,
hess.tol = formals(buildmer::converged)$hess.tol,
dep = NULL,
REML = NA,
can.use.reml = TRUE,
force.reml = FALSE,
scale.est = NA,
I_KNOW_WHAT_I_AM_DOING = FALSE
)
Arguments
formula |
The model formula for the maximal model you would like to fit. Alternatively, a buildmer term list as obtained from |
data |
The data to fit the model(s) to. |
family |
The error distribution to use. |
args |
Extra arguments passed to the fitting function. |
direction |
Character string or vector indicating the direction for stepwise elimination; possible options are |
cl |
Specifies a cluster to use for parallelizing the evaluation of terms. This can be an object as returned by function |
crit |
Character string or vector determining the criterion used to test terms for their contribution to the model fit in the ordering step. Possible options are |
elim |
Character string or vector determining the criterion used to test terms for elimination in the elimination step. Possible options are |
fit |
Internal parameter — do not modify. |
include |
A one-sided formula or character vector of terms that will be included in the model at all times and are not subject to testing for elimination. These do not need to be specified separately in the |
quiet |
A logical indicating whether to suppress progress messages. |
calc.anova |
Logical indicating whether to also calculate the ANOVA table for the final model after term elimination. |
calc.summary |
Logical indicating whether to also calculate the summary table for the final model after term elimination. |
ddf |
The method used for calculating p-values for |
quickstart |
For |
singular.ok |
Logical indicating whether singular fits are acceptable. Only for lme4 models. |
grad.tol |
Tolerance for declaring gradient convergence. For |
hess.tol |
Tolerance for declaring Hessian convergence. For |
dep |
A character string specifying the name of the dependent variable. Only used if |
REML |
In some situations, the user may want to force REML on or off, rather than using buildmer's autodetection. If |
can.use.reml |
Internal option specifying whether the fitting engine should distinguish between fixed-effects and random-effects model comparisons. Do not set this option yourself unless you are programming a new fitting function for |
force.reml |
Internal option specifying whether, if not differentiating between fixed-effects and random-effects model comparisons, these comparisons should be based on ML or on REML (if possible). Do not set this option yourself unless you are programming a new fitting function for |
scale.est |
Internal option specifying whether the model estimates an unknown scale parameter. Used only in |
I_KNOW_WHAT_I_AM_DOING |
An internal option that you should not modify unless you know what you are doing. |
Details
With the default options, all buildmer
functions will do two things:
Determine the order of the effects in your model, based on their importance as measured by the likelihood-ratio test statistic. This identifies the ‘maximal model’, which is the model containing either all effects specified by the user, or subset of those effects that still allow the model to converge, ordered such that the most information-rich effects have made it in.
Perform backward stepwise elimination based on the significance of the change in log-likelihood.
The final model is returned in the model
slot of the returned buildmer
object.
All functions in the buildmer
package are aware of the distinction between (f)REML and ML, and know to divide chi-square p-values by 2 when comparing models differing only in random effects (see Pinheiro & Bates 2000).
The steps executed above can be changed using the direction
argument, allowing for arbitrary chains of, for instance, forward-backward-forward stepwise elimination (although using more than one elimination method on the same data is not recommended). The criterion for determining the importance of terms in the ordering stage and the elimination of terms in the elimination stage can also be changed, using the crit
argument.