Skip to contents

be_fit_model_single() fits the average-BE model for a single endpoint and dispatches on model_type to be_fit_model_lmer(), be_fit_model_nlme(), be_fit_model_gls(), or be_fit_model_anova(). This is the only place model fitting happens. For the "lmer", "anova", and "isc" types the within-formulation ANOVA variances are also fit here; for "nlme" they come from the single mixed model. Covariate columns carried by be_dataset() (.cov_<name>) enter every model as additive fixed effects.

Usage

be_fit_model_single(
  ds_ep,
  model_type = c("lmer", "nlme", "anova", "isc", "gls"),
  scaling = TRUE
)

Arguments

ds_ep

The standardized single-endpoint data.frame from be_dataset() (be_dataset(...)$data filtered to one endpoint).

model_type

One of "lmer", "nlme", "anova", "isc" (the intra-subject-contrast path, fit like "anova"), or "gls" (generalized least squares with treatment-specific residual variances, for parallel designs).

scaling

Logical; whether reference scaling is needed (controls whether the within-formulation variances are estimated).

Value

An object of class be_fit: a list with model_type, the fitted model, and (for lmer/anova/isc) ref_var/test_var within-formulation ANOVA variances. The endpoint's measurement units are attached as a units attribute (NULL when not provided).