R/subtyper.R
lm_anv_p_and_d.Rd
This function fits two linear regression 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. NOTE: this function will scale variables internally to aid coefficient estimate visualization.
lm_anv_p_and_d(
data,
outcome,
predictor,
fixed_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.
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 sample size (n).
# Assuming 'data' is your dataset with columns 'outcome', 'predictor', and 'fixed_var1', ...
# results <- lm_anv_p_and_d(data, "outcome", "predictor", "fixed_var1 + fixed_var2")
# summary(results$full_model) # Full model summary
# results$model_comparison # ANOVA comparison
# results$effect_sizes # Effect sizes