| fit_mmrm {tern.mmrm} | R Documentation |
MMRM Analysis
Description
Does the MMRM analysis. Multiple other functions can be called on the result to produce
tables and graphs.
Usage
fit_mmrm(
vars = list(response = "AVAL", covariates = c(), id = "USUBJID", arm = "ARM", visit =
"AVISIT"),
data,
conf_level = 0.95,
cor_struct = "unstructured",
weights_emmeans = "proportional",
averages_emmeans = list(),
parallel = FALSE,
...
)
Arguments
vars |
(named
Note that the main effects and interaction of |
data |
( |
conf_level |
( |
cor_struct |
( |
weights_emmeans |
( |
averages_emmeans |
( |
parallel |
( |
... |
additional arguments for |
Details
Multiple different degree of freedom adjustments are available via the method argument
for mmrm::mmrm(). In addition, covariance matrix adjustments are available via vcov.
Please see mmrm::mmrm_control() for details and additional useful options.
For the covariance structure (cor_struct), the user can choose among the following options.
-
unstructured: Unstructured covariance matrix. This is the most flexible choice and default. If there areTvisits, thenT * (T+1) / 2variance parameters are used. -
toeplitz: Homogeneous Toeplitz covariance matrix, which usesTvariance parameters. -
heterogeneous toeplitz: Heterogeneous Toeplitz covariance matrix, which uses2 * T - 1variance parameters. -
ante-dependence: Homogeneous Ante-Dependence covariance matrix, which usesTvariance parameters. -
heterogeneous ante-dependence: Heterogeneous Ante-Dependence covariance matrix, which uses2 * T - 1variance parameters. -
auto-regressive: Homogeneous Auto-Regressive (order 1) covariance matrix, which uses 2 variance parameters. -
heterogeneous auto-regressive: Heterogeneous Auto-Regressive (order 1) covariance matrix, which usesT + 1variance parameters. -
compound symmetry: Homogeneous Compound Symmetry covariance matrix, which uses 2 variance parameters. -
heterogeneous compound symmetry: Heterogeneous Compound Symmetry covariance matrix, which usesT + 1variance parameters.
Value
A tern_mmrm object which is a list with MMRM results:
-
fit: Themmrmobject which was fitted to the data. Note that viammrm::component(fit, "optimizer")the finally used optimization algorithm can be obtained, which can be useful for refitting the model later on. -
cov_estimate: The matrix with the covariance matrix estimate. -
diagnostics: A list with model diagnostic statistics (REML criterion, AIC, corrected AIC, BIC). -
lsmeans: This is a list with data framesestimatesandcontrasts. The attributesaveragesandweightssave the settings used (averages_emmeansandweights_emmeans). -
vars: The variable list. -
labels: Corresponding list with variable labels extracted fromdata. -
cor_struct: input. -
parallel: input. -
ref_level: The reference level for the arm variable, which is always the first level. -
treatment_levels: The treatment levels for the arm variable. -
conf_level: The confidence level which was used to construct thelsmeansconfidence intervals. -
additional: List with any additional inputs passed via...
Examples
library(dplyr)
library(rtables)
mmrm_results <- fit_mmrm(
vars = list(
response = "FEV1",
covariates = c("RACE", "SEX"),
id = "USUBJID",
arm = "ARMCD",
visit = "AVISIT"
),
data = mmrm_test_data,
cor_struct = "unstructured",
weights_emmeans = "equal",
averages_emmeans = list(
"VIS1+2" = c("VIS1", "VIS2")
)
)