qmatrix.msm {hesim}R Documentation

Transition intensity matrix from msm object

Description

Draw transition intensity matrices for a probabilistic sensitivity analysis from a fitted msm object.

Usage

## S3 method for class 'msm'
qmatrix(x, newdata = NULL, uncertainty = c("normal", "none"), n = 1000, ...)

Arguments

x

A msm::msm object.

newdata

A data frame to look for variables with which to predict. A separate transition intensity matrix is predicted based on each row in newdata. Can be NULL if no covariates are included in the fitted msm object.

uncertainty

Method used to draw transition intensity matrices. If ⁠"none⁠", then point estimates are used. If "normal", then samples are drawn from the multivariate normal distribution of the regression coefficients.

n

Number of random observations of the parameters to draw.

...

Further arguments passed to or from other methods. Currently unused.

Value

An array of transition intensity matrices with the third dimension equal to the number of rows in newdata.

See Also

qmatrix.matrix()

Examples

library("msm")
set.seed(101)
 qinit <- rbind(
   c(0, 0.28163, 0.01239),
   c(0, 0, 0.10204),
   c(0, 0, 0)
 )
fit <- msm(state_id ~ time, subject = patient_id, 
           data = onc3p[patient_id %in% sample(patient_id, 100)],
           covariates = list("1-2" =~ age + strategy_name), 
           qmatrix = qinit)
qmatrix(fit, newdata = data.frame(age = 55, strategy_name = "New 1"),
        uncertainty = "none")
qmatrix(fit, newdata = data.frame(age = 55, strategy_name = "New 1"),
        uncertainty = "normal",  n = 3)


[Package hesim version 0.5.4 Index]