predict.merlin: predict.merlin - post-estimation tools for merlin

Description Usage Arguments Author(s) References See Also Examples

View source: R/merlin_predict.R

Description

predictions following the fit of a merlin model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S3 method for class 'merlin'
predict(
  object,
  stat = "eta",
  type = "fixedonly",
  predmodel = 1,
  causes = NULL,
  at = NULL,
  contrast = NULL,
  ...
)

Arguments

object

merlin model object

stat

specifies which prediction, which can be one of:

  • eta the expected value of the complex predictor

  • mu the expected value of the response variable

  • hazard the hazard function

  • chazard the cumulative hazard function

  • logchazard the log cumulative hazard function

  • survival the survival function

  • cif the cumulative incidence function

  • rmst calculates the restricted mean survival time, which is the integral of the survival function within the interval (0,t], where t is the time at which predictions are made. If multiple survival models have been specified in your merlin model, then it will assume all of them are cause-specific competing risks models, and include them in the calculation. If this is not the case, you can override which models are included by using the causes option. rmst = t - totaltimelost.

  • timelost calculates the time lost due to a particular event occurring, within the interval (0,t]. In a single event survival model, this is the integral of the cif between (0,t]. If multiple survival models are specified in the merlin model then by default all are assumed to be cause-specific event time models contributing to the calculation. This can be overridden using the causes option.

  • totaltimelost total time lost due to all competing events, within (0,t]. If multiple survival models are specified in the merlin model then by default all are assumed to be cause-specific event time models contributing to the calculation. This can be overridden using the causes option. totaltimelost is the sum of the timelost due to all causes.

  • cifdifference calculates the difference in cif predictions between values of a covariate specified using the contrast option.

  • hdifference calculates the difference in hazard predictions between values of a covariate specified using the contrast option.

  • rmstdifference calculates the difference in rmst predictions between values of a covariate specified using the contrast option.

  • mudifference calculates the difference in mu predictions between values of a covariate specified using the contrast option.

  • etadifference calculates the difference in eta predictions between values of a covariate specified using the contrast option.

type

the type of prediction, either:

  • fixedonly prediction calculated based only on the fixed effects; the default.

  • marginal prediction calculated marginally with respect to the latent variables. the stat is calculated by integrating the prediction function with respect to all the latent variables over their entire support.

predmodel

specifies which model to obtain predictions from; default is predmodel=1

causes

is for use when calculating predictions from a competing risks merlin model. By default, cif, rmst, timelost and totaltimelost assume that all survival models included in the merlin model are cause-specific hazard models contributing to the calculation. If this is not the case, then you can specify which models (indexed using the order they appear in your merlin model by using the causes option, e.g. causes=c(1,2).

at

specify covariate values for prediction. Fixed values of covariates should be specified in a list e.g. at = c("trt" = 1, "age" = 50).

contrast

specifies the values of a covariate to be used when comparing statistics, such as when using the cifdifference option to compare cumulative incidence functions, e.g. contrast = c("trt" = 0, "trt" = 1).

...

other options

Author(s)

Emma C. Martin, Alessandro Gasparini and Michael J. Crowther

References

Crowther MJ. Extended multivariate generalised linear and non-linear mixed effects models. https://arxiv.org/abs/1710.02223

Crowther MJ. merlin - a unified framework for data analysis and methods development in Stata. https://arxiv.org/abs/1806.01615

Martin EC, Gasparini A, Crowther MJ. merlin - an R package for mixed effects regression of linear, non-linear and user-defined models.

See Also

merlin

Examples

1
2
3
4
5
6
7
8
library(merlin)
data(pbc.merlin, package = "merlin")

# Linear fixed-effects model
mod <-merlin(model = list(logb ~ year),
             family = "gaussian",
             data = pbc.merlin)
predict(mod,stat="eta",type="fixedonly")

merlin documentation built on July 8, 2020, 7:31 p.m.