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

# S3 method for 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

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")
#> , , 1 #> #> [,1] [,2] [,3] #> [1,] -0.4381051 0.43802597 7.908247e-05 #> [2,] 0.0000000 -0.08275169 8.275169e-02 #> [3,] 0.0000000 0.00000000 0.000000e+00 #>
qmatrix(fit, newdata = data.frame(age = 55, strategy_name = "New 1"), uncertainty = "normal", n = 3)
#> , , 1 #> #> [,1] [,2] [,3] #> [1,] -0.4373615 0.43722582 0.0001356349 #> [2,] 0.0000000 -0.08824339 0.0882433860 #> [3,] 0.0000000 0.00000000 0.0000000000 #> #> , , 2 #> #> [,1] [,2] [,3] #> [1,] -0.5147023 0.51470228 1.010117e-08 #> [2,] 0.0000000 -0.08154997 8.154997e-02 #> [3,] 0.0000000 0.00000000 0.000000e+00 #> #> , , 3 #> #> [,1] [,2] [,3] #> [1,] -0.4893177 0.48930814 9.547637e-06 #> [2,] 0.0000000 -0.08225225 8.225225e-02 #> [3,] 0.0000000 0.00000000 0.000000e+00 #>