This function attempts to fit a linear mixed-effects model with a given formula string using the lme4::lmer function. It includes error handling to gracefully return NULL if the model cannot be fit.

fit_lmer_model(formula_str, data)

Arguments

formula_str

A character string representing a model formula.

data

A data frame used for model fitting.

Value

A fitted lmerMod object if successful, otherwise NULL.