bfFixefLMER_t.fnc: Back-fits an LMER model on absolute t-value and, optionally,...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

This function back-fits an initial LMER model on t-values, and, if enabled, log-likelihood ratio testing. Note that, this function CAN be used with generalized linear mixed-effects models (glmers).

Usage

1
2
3
4
5
6
bfFixefLMER_t.fnc(model, item = FALSE,
method = c("t", "z", "llrt", "AIC", "BIC", "relLik.AIC", 
"relLik.BIC"), threshold = NULL, t.threshold = NULL, 
alphaitem = NULL, prune.ranefs = TRUE, set.REML.FALSE = TRUE, 
keep.single.factors=FALSE, reset.REML.TRUE = TRUE, 
log.file = NULL)

Arguments

model

A mer object (fitted by function lmer). Note that this function can be used with generalized linear mixed-effects models (glmers).

item

Whether or not to evaluate the addition of by-item random intercepts to the model, evaluated by way of log-likelihood ratio test. Either FALSE (the default) or the column name (quoted) of the item identifier (e.g., "Item", or "Word").

method

Backfitting method. One of "t" (lmer), "z" (glmer), "llrt", "AIC", "BIC", "relLik.AIC", or "relLik.BIC" (the latter two are based on relative likelihood, see function relLik). Defaults to "t". You can find information regarding differences between AIC and BIC from http://methodology.psu.edu/eresources/ask/sp07.

threshold

Method-specific threshold for parameter selection. It refers to the minimum t/z-value in the case of "t" or "z", to the alpha value in the case of "llrt", to the minimum reduction in likelihood in the case of "AIC" and "BIC", or to the minimum difference in probability in the case of "relLik.AIC" and "relLik.BIC". Defaults NULL, which means 2 for "t" and "z", 0.05 for "llrt", 5 for "AIC" and "BIC", and 4 for "relLik.AIC" and "relLik.BIC".

t.threshold

Defaults to NULL. If the method = "t" or method = "z", it is the t/z-value below which a model term is dropped (if t.threshold = NULL, it will be set to 2). Otherwise it is the threshold for t/z-value below which a test (see method) is performed between a model with the term under consideration and a simpler model without it (if t.threshold = NULL, it is set to Inf, which means that all terms are tested.

alphaitem

Alpha value for the evaluation of by-item random intercepts. Defaults to 0.05 or to the specified threshold in case method is llrt.

prune.ranefs

Logical. Whether to remove any random effect for which its variable is not also present in the fixed effects structure (with the exception of the grouping variables such as "Subjects" and "Items"). Defaults to TRUE. For example, if the random effects structure contains the terms Condition + ROI + Group, and the random effects structure contains the terms (1 | Subject) + (0 + TrialNum | Subject), the random effect (0 + TrialNum | Subject) will be pruned from the model given that it is not in the model's fixed effects structure.

set.REML.FALSE

Logical. Whether or not to set REML to FALSE. Defaults to TRUE. Not used for glmer models.

reset.REML.TRUE

Logical. Whether or not to re-set the back-fitted model to REML = TRUE. Not used for glmer models.

keep.single.factors

Logical. Whether or not main effects are kept (not subjected to testing and reduction). Defaults to FALSE.

log.file

Whether a back-fitting log should be saved. Defaults to NULL, which means that a log is saved in a temporary folder with the file name file.path(tempdir(), paste("bfFixefLMER_F_log_", gsub(":", "-", gsub(" ", "_", date())), ".txt", sep = "")). The path and file name of the log can be changed to whatever the use wishes. Set to FALSE to disable.

Details

The back-fitting process works as follows:

  1. If argument method is not set to "t", REML is set to FALSE;

  2. First consider only highest-order interaction model terms:

    1. If method is "t" or "z", the model term with the lowest t/z-value is identified. If this t/z-value is smaller than threshold, the model term is removed and a new model is fitted. This is repeated for each model term for term that has a t-value smaller than the threshold value. The algorithm then moves on to step (b). If method is not "t" or "z", the model term with the lowest t/z-value-value is identified and the following is evaluated:

      1. A new model without this model term is fitted;

      2. The more complex and simpler models are compared by way of a log-likelihood ratio test in case method is "llrt", by way of AIC or BIC comparison if method is "AIC" "BIC", or by calculating the relLik based on AIC or BIC in case method is "relLik.AIC" or "relLik.BIC". If the result determines that the term under consideration does not increase model fit, it is removed; otherwise it is kept.

      3. Move on to the next model term with the smallest t/z-value smaller than threshold and repeat steps (i)–(iii).

    2. Once all highest-order interaction terms have been evaluated, go down to the second highest order interactions: Repeat steps (ai)–(aiii) with the following addition: If a term would be removed from the model, but it is part of a high-order interaction, keep it. Once all terms of the interaction level have been evaluated, move down to the next lower-order level until main effects have been evaluated, after which the process stops. If keep.single factors = TRUE, the process stops after the evaluation of all interaction terms.

  3. If argument method is set to something other than t or z, set reset.REML.TRUE to TRUE (default) unless otherwise specified.

In brief, if method is set to "t" or "z", a term remains in the model if its t/z-value is equal to or greater than threshold; if method is set to something else, a term remains in the model if

  1. its t/z-value is equal to or greater than threshold;

  2. it significantly increases model fit as determined by the specified method;

  3. it is part of a significant interaction term.

This backfitting method was used in Tremblay & Tucker (2011). If factorial terms with more than two levels are included in the initial model, back-fitting on F is recommended.

Value

A mer model with back-fitted fixed effects (on t-values) is returned and a log of the back-fitting process is printed on screen and (by default) in a log file.

Note

If you get this error:

1
2
Error in model.frame.default(data = ..2, formula = log_Segment_Duration ~  : 
  The ... list does not contain 2 elements

It is probably because you updated the model using function update and the data now appears as data = ..2 or something similar to this. You can check this by typing model@call. If this is the case, re-fit your model as lmer(DV ~ IV + IV + (RANEF), data = dat).

Author(s)

Antoine Tremblay, Statistics Canada, trea26@gmail.com and Johannes Ransijn johannesransijn@gmail.com.

References

Tremblay, A. and Tucker B. V. (2011). The Effects of N-gram Probabilistic Measures on the Processing and Production of Four-word Sequences. The Mental Lexicon, 6(2), 302–324.

See Also

bfFixefLMER_F.fnc; ffRanefLMER.fnc; fitLMER.fnc; mcposthoc.fnc; pamer.fnc; mcp.fnc; relLik; romr.fnc; perSubjectTrim.fnc.

Examples

1
# see example in LMERConvenienceFunctions help page.

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 

LMERConvenienceFunctions documentation built on Oct. 23, 2020, 5:12 p.m.