This function is used to fit a random effect linear model of the form:
$$Y_{ij} = \mu + \alpha_i + \mathbf{Z}_{ij}^\top\boldsymbol\beta + \epsilon_{ij}$$
where \(Y_{ij}\) is the continuous outcome for individual \(j\) in provider \(i\),
\(\mu\) is the overall intercept, \(\alpha_i\) is the random effect for provider \(i\),
\(\mathbf{Z}_{ij}\) are the covariates, and \(\boldsymbol\beta\) is the vector of coefficients for the covariates.
The model is fitted by overloading the lmer
function from the lme4
package.
Three different input formats are accepted:
a formula and dataset, where the formula is of the form response ~ covariates + (1 | provider)
, with provider
representing the provider identifier;
a dataset along with the column names of the response, covariates, and provider identifier;
or the outcome vector \(\boldsymbol{Y}\), the covariate matrix or data frame \(\mathbf{Z}\), and the provider identifier vector.
In addition to these input formats, all arguments from the lmer
function can be modified via ...
,
allowing for customization of model fitting options such as controlling the optimization method or adjusting convergence criteria.
By default, the model is fitted using REML (restricted maximum likelihood).
If issues arise during model fitting, consider using the data_check
function to perform a data quality check,
which can help identify missing values, low variation in covariates, high-pairwise correlation, and multicollinearity.
For datasets with missing values, this function automatically removes observations (rows) with any missing values before fitting the model.