mmrm_tmb_methods {mmrm} | R Documentation |
Methods for mmrm_tmb
Objects
Description
Usage
## S3 method for class 'mmrm_tmb'
coef(object, complete = TRUE, ...)
## S3 method for class 'mmrm_tmb'
fitted(object, ...)
## S3 method for class 'mmrm_tmb'
predict(
object,
newdata,
se.fit = FALSE,
interval = c("none", "confidence", "prediction"),
level = 0.95,
nsim = 1000L,
conditional = TRUE,
...
)
## S3 method for class 'mmrm_tmb'
model.frame(
formula,
data,
include = c("subject_var", "visit_var", "group_var", "response_var"),
full,
na.action = "na.omit",
...
)
## S3 method for class 'mmrm_tmb'
model.matrix(object, data, include = NULL, ...)
## S3 method for class 'mmrm_tmb'
terms(x, include = "response_var", ...)
## S3 method for class 'mmrm_tmb'
logLik(object, ...)
## S3 method for class 'mmrm_tmb'
formula(x, ...)
## S3 method for class 'mmrm_tmb'
vcov(object, complete = TRUE, ...)
## S3 method for class 'mmrm_tmb'
VarCorr(x, sigma = NA, ...)
## S3 method for class 'mmrm_tmb'
deviance(object, ...)
## S3 method for class 'mmrm_tmb'
AIC(object, corrected = FALSE, ..., k = 2)
## S3 method for class 'mmrm_tmb'
BIC(object, ...)
## S3 method for class 'mmrm_tmb'
print(x, ...)
## S3 method for class 'mmrm_tmb'
residuals(object, type = c("response", "pearson", "normalized"), ...)
## S3 method for class 'mmrm_tmb'
simulate(
object,
nsim = 1,
seed = NULL,
newdata,
...,
method = c("conditional", "marginal")
)
Arguments
object |
( |
complete |
( |
... |
mostly not used;
Exception is |
newdata |
( |
se.fit |
( |
interval |
( |
level |
( |
nsim |
( |
conditional |
( |
formula |
( |
data |
( |
include |
( |
full |
( |
na.action |
( |
x |
( |
sigma |
cannot be used (this parameter does not exist in MMRM). |
corrected |
( |
k |
( |
type |
( |
seed |
unused argument from |
method |
( |
Details
include
argument controls the variables the returned model frame will include.
Possible options are "response_var", "subject_var", "visit_var" and "group_var", representing the
response variable, subject variable, visit variable or group variable.
character
values in new data will always be factorized according to the data in the fit
to avoid mismatched in levels or issues in model.matrix
.
Value
Depends on the method, see Functions.
Functions
-
coef(mmrm_tmb)
: obtains the estimated coefficients. -
fitted(mmrm_tmb)
: obtains the fitted values. -
predict(mmrm_tmb)
: predict conditional means for new data; optionally with standard errors and confidence or prediction intervals. Returns a vector of predictions ifse.fit == FALSE
andinterval == "none"
; otherwise it returns a data.frame with multiple columns and one row per input data row. -
model.frame(mmrm_tmb)
: obtains the model frame. -
model.matrix(mmrm_tmb)
: obtains the model matrix. -
terms(mmrm_tmb)
: obtains the terms object. -
logLik(mmrm_tmb)
: obtains the attained log likelihood value. -
formula(mmrm_tmb)
: obtains the used formula. -
vcov(mmrm_tmb)
: obtains the variance-covariance matrix estimate for the coefficients. -
VarCorr(mmrm_tmb)
: obtains the variance-covariance matrix estimate for the residuals. -
deviance(mmrm_tmb)
: obtains the deviance, which is defined here as twice the negative log likelihood, which can either be integrated over the coefficients for REML fits or the usual one for ML fits. -
AIC(mmrm_tmb)
: obtains the Akaike Information Criterion, where the degrees of freedom are the number of variance parameters (n_theta
). Ifcorrected
, then this is multiplied withm / (m - n_theta - 1)
wherem
is the number of observations minus the number of coefficients, orn_theta + 2
if it is smaller than that (Hurvich and Tsai 1989; Burnham and Anderson 1998). -
BIC(mmrm_tmb)
: obtains the Bayesian Information Criterion, which is using the natural logarithm of the number of subjects for the penalty parameterk
. -
print(mmrm_tmb)
: prints the object. -
residuals(mmrm_tmb)
: to obtain residuals - either unscaled ('response'), 'pearson' or 'normalized'. -
simulate(mmrm_tmb)
: simulate responses from a fitted model according to the simulationmethod
, returning adata.frame
of dimension[n, m]
where n is the number of rows innewdata
, and m is the numbernsim
of simulated responses.
References
-
Hurvich CM, Tsai C (1989). “Regression and time series model selection in small samples.” Biometrika, 76(2), 297–307. doi:10.2307/2336663.
-
Burnham KP, Anderson DR (1998). “Practical use of the information-theoretic approach.” In Model selection and inference, 75–117. Springer. doi:10.1007/978-1-4757-2917-7_3.
-
GaĆecki A, Burzykowski T (2013). “Linear mixed-effects model.” In Linear mixed-effects models using R, 245–273. Springer.
See Also
mmrm_methods
, mmrm_tidiers
for additional methods.
Examples
formula <- FEV1 ~ RACE + SEX + ARMCD * AVISIT + us(AVISIT | USUBJID)
object <- fit_mmrm(formula, fev_data, weights = rep(1, nrow(fev_data)))
# Estimated coefficients:
coef(object)
# Fitted values:
fitted(object)
predict(object, newdata = fev_data)
# Model frame:
model.frame(object)
model.frame(object, include = "subject_var")
# Model matrix:
model.matrix(object)
# terms:
terms(object)
terms(object, include = "subject_var")
# Log likelihood given the estimated parameters:
logLik(object)
# Formula which was used:
formula(object)
# Variance-covariance matrix estimate for coefficients:
vcov(object)
# Variance-covariance matrix estimate for residuals:
VarCorr(object)
# REML criterion (twice the negative log likelihood):
deviance(object)
# AIC:
AIC(object)
AIC(object, corrected = TRUE)
# BIC:
BIC(object)
# residuals:
residuals(object, type = "response")
residuals(object, type = "pearson")
residuals(object, type = "normalized")