fit_mmrm: Fit a MMRM model

View source: R/mmrm.R

fit_mmrmR Documentation

Fit a MMRM model

Description

Fits a MMRM model allowing for different covariance structures using mmrm::mmrm(). Returns a list of key model parameters beta, sigma and an additional element failed indicating whether or not the fit failed to converge. If the fit did fail to converge beta and sigma will not be present.

Usage

fit_mmrm(
  designmat,
  outcome,
  subjid,
  visit,
  group,
  cov_struct = c("us", "toep", "cs", "ar1"),
  REML = TRUE,
  same_cov = TRUE
)

Arguments

designmat

a data.frame or matrix containing the covariates to use in the MMRM model. Dummy variables must already be expanded out, i.e. via stats::model.matrix(). Cannot contain any missing values

outcome

a numeric vector. The outcome value to be regressed on in the MMRM model.

subjid

a character / factor vector. The subject identifier used to link separate visits that belong to the same subject.

visit

a character / factor vector. Indicates which visit the outcome value occurred on.

group

a character / factor vector. Indicates which treatment group the patient belongs to.

cov_struct

a character value. Specifies which covariance structure to use. Must be one of "us", "toep", "cs" or "ar1"

REML

logical. Specifies whether restricted maximum likelihood should be used

same_cov

logical. Used to specify if a shared or individual covariance matrix should be used per group


rbmi documentation built on Nov. 24, 2023, 5:11 p.m.