R/subtyper.R
lmer_anv_p_and_d_old.Rd
This function fits two linear mixed effects models: a base model without the main predictor of interest and a full model including the main predictor. It then compares these models using ANOVA to test the significance of adding the main predictor. Additionally, it calculates the effect sizes for the predictor in the full model. This function is designed to facilitate the analysis of data where both fixed and random effects are present, accommodating complex experimental designs. NOTE: this function will scale variables internally to aid coefficient estimate visualization.
lmer_anv_p_and_d_old(
data,
outcome,
predictor,
fixed_effects,
random_effects,
predictoroperator = "*",
verbose = FALSE
)
A data frame containing the variables referenced in the model formulas.
The name of the dependent variable (outcome) as a string.
The name of the main predictor variable as a string.
A string specifying the fixed effects to be included in the model, excluding the main predictor.
A string specifying the random effects to be included in the model. we assume that a subject ID is the first entry if this is a vector.
either a +
or *
boolean
A list containing the fitted full model object, ANOVA model comparison, calculated effect sizes for the predictor, coefficients of the full model, and the count of unique levels in the random effects variable.
# Assuming 'data' is your dataset with columns 'outcome', 'predictor', 'fixed_var1', ...,
# and 'subject' as the random effect:
# results <- lmer_anv_p_and_d(data, "outcome", "predictor", "fixed_var1 + fixed_var2", "subject")
# summary(results$full_model) # Full model summary
# results$model_comparison # ANOVA comparison
# results$effect_sizes # Effect sizes