predictor_competition2.Rd
Compare the predictive strength of two independent variables in a minimal linear (mixed effects) regression model. The function creates two identical
lm
or lmer
objects, only differing in fixed effects structure. Then, using the Akaike Information Criterion, the better predictor is determined. A model
is assumed to have a better fit, if its AIC is 2 points lower than the other's.
predictor_competition2(
data,
dependent,
independent1,
independent2,
random.intercept = NULL,
random.slope = 1
)
The original data set for both models.
The dependent variable for both models.
The independent variable(s), i.e. the fixed effects, of the 1st model.
The independent variable(s), i.e. the fixed effects, of the 2nd model.
The random intercept for both models. If not random intercept is specified, regular linear models are fitted.
The random slope for both models. The default assumes no random slope.
A dataframe containing df and AIC. Usually used without variable assignment.
Bates, D., Maechler, M., Bolker, B., & Walker, S. (2015). Fitting Linear Mixed-Effects Models Using lme4. Journal of Statistical Software, 67(1), 1-48. doi:10.18637/jss.v067.i01.
data("data_s")
predictor_competition2(data = data_s, dependent = "sDur", independent1 = "pauseBin", independent2 = "typeOfS")
#> ℹ We have a winner - it's pauseBin!
#> df AIC
#> mdl1 3 -484.5026
#> mdl2 4 -462.1716