Transition intensity matrix from an msmbayes model
Arguments
- draws
Object returned by
msmbayes
.- new_data
Data frame with covariate values to predict for
- X
Lower-level alternative to specifying
new_data
, for developer use only.X
is a numeric matrix formed from column-binding the covariate design matrices for each transition in turn.- drop
Only used if there are no covariates supplied in
new_data
. Then ifdrop=TRUE
this returns anstates
xnstates
matrix, or ifdrop=FALSE
this returns a 3D array with first dimensionncovs=1
.
Value
An array or matrix of rvar
objects containing the
transition intensity matrix for each new prediction data point
See also
qdf
returns the same information in a
tidy data frame format
Examples
qmatrix(infsim_model)
#> rvar<1>[2,2] mean ± sd:
#> [,1] [,2]
#> [1,] -0.67 ± NA 0.67 ± NA
#> [2,] 3.86 ± NA -3.86 ± NA
summary(qmatrix(infsim_model))
#> # A tibble: 4 × 10
#> variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 qmatrix(infsi… -0.666 -0.666 NA 0 -0.666 -0.666 NA NA NA
#> 2 qmatrix(infsi… 3.86 3.86 NA 0 3.86 3.86 NA NA NA
#> 3 qmatrix(infsi… 0.666 0.666 NA 0 0.666 0.666 NA NA NA
#> 4 qmatrix(infsi… -3.86 -3.86 NA 0 -3.86 -3.86 NA NA NA
summary(qmatrix(infsim_model), median, ~quantile(.x, 0.025, 0.975))
#> # A tibble: 4 × 3
#> variable median `2.5%`
#> <chr> <dbl> <dbl>
#> 1 qmatrix(infsim_model)[1,1] -0.666 -0.666
#> 2 qmatrix(infsim_model)[2,1] 3.86 3.86
#> 3 qmatrix(infsim_model)[1,2] 0.666 0.666
#> 4 qmatrix(infsim_model)[2,2] -3.86 -3.86