Skip to contents

This function allows you to remove random effects from a formula by specifying which terms to drop. It checks for the presence of vertical bars ('|') in the terms of the formula and drops the random effects accordingly. If all terms are random effects, the function updates the formula to have only an intercept.

Usage

drop_randfx(form)

Arguments

form

The formula from which random effects should be dropped.

Value

A modified formula with specified random effects dropped.

Examples

# Create a formula with random effects
formula <- y ~ x1 + (1 | group) + (1 | subject)
# Drop the random effects related to 'group'
modified_formula <- drop_randfx(formula)