predictor_competition: Compare Variables for Predictor Strength

View source: R/predictor_competition.R

predictor_competitionR Documentation

Compare Variables for Predictor Strength

Description

NOTE: This function is deprecated. Please use SfL::predictor_competition2 instead. 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, a log-likelihood test is used to decide which fixed effect structure is better fit to predict the dependent variable.

Usage

predictor_competition(
  data,
  dependent,
  independent1,
  independent2,
  random.intercept = NULL,
  random.slope = 1
)

Arguments

data

The original data set for both models.

dependent

The dependent variable for both models.

independent1

The independent variable(s), i.e. the fixed effects, of the 1st model.

independent2

The independent variable(s), i.e. the fixed effects, of the 2nd model.

random.intercept

The random intercept for both models. If not random intercept is specified, regular linear models are fitted.

random.slope

The random slope for both models. The default assumes no random slope.

Value

A dataframe containing npar, AIC, BIG, logLik, deviance, Chisq, Df, and Pr(>Chisq). Usually used without variable assignment.

Author(s)

D. Schmitz

References

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.

Examples

data("data_s")

# example 1: two similarly well fit predictors
predictor_competition(data = data_s, dependent = "sDur", independent1 = "typeOfS", independent2 = "pauseBin", random.intercept = "speaker")

# example 2: one predictor is better than the other
predictor_competition(data = data_s, dependent = "sDur", independent1 = "typeOfS", independent2 = "slideNumber", random.intercept = "speaker")


dosc91/SfL documentation built on Sept. 14, 2024, 6:44 a.m.