mmrm_tmb_methods {mmrm}R Documentation

Methods for mmrm_tmb Objects

Description

[Experimental]

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,
  ...
)

## 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

(mmrm_tmb)
the fitted MMRM object.

complete

(flag)
whether to include potential non-estimable coefficients.

...

mostly not used; Exception is model.matrix() passing ... to the default method.

newdata

(data.frame)
optional new data, otherwise data from object is used.

se.fit

(flag)
indicator if standard errors are required.

interval

(string)
type of interval calculation. Can be abbreviated.

level

(number)
tolerance/confidence level.

nsim

(count)
number of simulations to use.

formula

(mmrm_tmb)
same as object.

data

(data.frame)
object in which to construct the frame.

include

(character)
names of variable types to include. Must be NULL or one or more of c("subject_var", "visit_var", "group_var", "response_var").

full

(flag)
indicator whether to return full model frame (deprecated).

na.action

(string)
na action.

x

(mmrm_tmb)
same as object.

sigma

cannot be used (this parameter does not exist in MMRM).

corrected

(flag)
whether corrected AIC should be calculated.

k

(number)
the penalty per parameter to be used; default k = 2 is the classical AIC.

type

(string)
unscaled (response), pearson or normalized. Default is response, and this is the only type available for use with models with a spatial covariance structure.

seed

unused argument from stats::simulate().

method

(string)
simulation method to use. If "conditional", simulated values are sampled given the estimated covariance matrix of object. If "marginal", the variance of the estimated covariance matrix is taken into account.

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

References

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")

[Package mmrm version 0.3.11 Index]