Fine-grained specification of the MMRM fit details is possible using this
control function.
mmrm_control(
n_cores = 1L,
method = c("Satterthwaite", "Kenward-Roger", "Residual", "Between-Within"),
vcov = NULL,
start = std_start,
accept_singular = TRUE,
drop_visit_levels = TRUE,
disable_theta_vcov = FALSE,
...,
optimizers = h_get_optimizers(...)
)List of class mmrm_control with the control parameters.
(count)
number of cores to be used.
(string)
adjustment method for degrees of freedom.
(string)
coefficients covariance matrix adjustment method.
(NULL, numeric or function)
optional start values for variance
parameters. See details for more information.
(flag)
whether singular design matrices are reduced
to full rank automatically and additional coefficient estimates will be missing.
(flag)
whether to drop levels for visit variable,
if visit variable is a factor, see details.
(flag)
whether to disable calculation of
variance-covariance matrix for variance parameters. This can speed up fitting
when there are many variance parameters, see details.
additional arguments passed to h_get_optimizers().
(list)
optimizer specification, created with h_get_optimizers().
Please note that optimizers using the Hessian will not be compatible with
disable_theta_vcov = TRUE and an error will be raised in that case.
For example, if the data only has observations at visits VIS1, VIS3 and VIS4, by default
they are treated to be equally spaced, the distance from VIS1 to VIS3, and from VIS3 to VIS4,
are identical. However, you can manually convert this visit into a factor, with
levels = c("VIS1", "VIS2", "VIS3", "VIS4"), and also use drop_visits_levels = FALSE,
then the distance from VIS1 to VIS3 will be double, as VIS2 is a valid visit.
However, please be cautious because this can lead to convergence failure
when using an unstructured covariance matrix and there are no observations
at the missing visits.
The method and vcov arguments specify the degrees of freedom and coefficients
covariance matrix adjustment methods, respectively.
Allowed vcov includes: "Asymptotic", "Kenward-Roger", "Kenward-Roger-Linear", "Empirical" (CR0),
"Empirical-Jackknife" (CR3), and "Empirical-Bias-Reduced" (CR2).
Allowed method includes: "Satterthwaite", "Kenward-Roger", "Between-Within" and "Residual".
If method is "Kenward-Roger" then only "Kenward-Roger" or "Kenward-Roger-Linear" are allowed for vcov.
The vcov argument can be NULL to use the default covariance method depending on the method
used for degrees of freedom, see the following table:
method | Default vcov |
| Satterthwaite | Asymptotic |
| Kenward-Roger | Kenward-Roger |
| Residual | Empirical |
| Between-Within | Asymptotic |
Please note that "Kenward-Roger" for "Unstructured" covariance gives different results
compared to SAS; Use "Kenward-Roger-Linear" for vcov instead for better matching
of the SAS results.
The argument start is used to facilitate the choice of initial values for fitting the model.
If function is provided, make sure its parameter is a valid element of mmrm_tmb_data
or mmrm_tmb_formula_parts and it returns a numeric vector.
By default or if NULL is provided, std_start will be used.
Other implemented methods include emp_start.
Disabling the theta_vcov calculation can speed up the fitting process when there are many variance
parameters. However, this has also drawbacks. We can no longer check that the variance parameter estimates
are indeed at a local maximum of the log-likelihood surface, and therefore convergence issues might go unnoticed.
In addition, some covariance matrix adjustment methods (e.g., Kenward-Roger) require theta_vcov to be calculated.
These will then raise errors.
mmrm_control(
optimizer_fun = stats::optim,
optimizer_args = list(method = "L-BFGS-B")
)
Run the code above in your browser using DataLab