Skip to contents

Exploratory data analysis

statetable()
Summarise intermittenly-observed multi-state data
msmhist()
Illustrate the empirical distribution of states against time in intermittently-observed multistate data
msmhist_bardata()
Estimate state occupation probabilities to be illustrated by a bar plot in msmhist

Fitting models

msmbayes()
Bayesian multi-state models for intermittently-observed data
msmprior()
Constructor for a prior distribution in msmbayes

Getting results from fitted models

General models

qdf()
Transition intensities from an msmbayes model, presented as a tidy data frame
qmatrix()
Transition intensity matrix from an msmbayes model
pmatrixdf()
Transition probabilities from an msmbayes model, presented as a tidy data frame
pmatrix()
Transition probability matrix from an msmbayes model
pnext()
Probabilities for the next state in a multi-state model
mean_sojourn()
Mean sojourn times from an msmbayes model
loghr() hr()
(Log) hazard ratios for covariates on transition intensities
soj_prob()
Sojourn probability in a state of a msmbayes model
totlos()
Total length of stay in each state over an interval
loglik() logLik(<msmbayes>)
Log likelihood from an msmbayes model
summary(<msmbayes>)
Summarise basic parameter estimates from an msmbayes model
standardise_to() standardize_to()
Constructor for a standardising population used for model outputs

Semi-Markov models

phaseapprox_pars()
Summarise posteriors for shape and scale parameters for the sojourn distribution in a semi-Markov msmbayes model
logtaf() taf()
(Log) time acceleration factors in semi-Markov models
logoddsnext()
Summarise posteriors for log odds of transitions from phase-type states
logrrnext() rrnext()
Effects of covariates on competing exit transitions in phase type models

Misclassification models

edf()
Misclassification error probabilities from an msmbayes model
ematrix()
Matrix of misclassification error probabilities from an msmbayes model

Simulation

msmbayes_prior_sample()
Generate a sample from the prior distribution in a msmbayes model
msmbayes_priorpred_sample()
Generate a dataset from the prior predictive distribution in a msmbayes model

Phase-type distribution utilities

dnphase() pnphase() hnphase() mean_nphase() var_nphase() skewness_nphase() ncmoment_nphase() rnphase() qnphase()
Density, probability distribution, quantile, moment, hazard and random number generation functions for the Coxian phase-type distribution with any number of phases.
canpars_to_rates() rates_to_canpars()
Convert between canonical parameters and rates for a phase-type distribution
shapescale_to_rates()
Determine parameters of a phase-type model that approximate a parametric shape-scale distribution
qphaseapprox()
Phase-type expansion of a transition intensity matrix to create a non-Markov multi-state model
nphase_Q()
Given a phase-type sojourn distribution, return the corresponding Markov intensity matrix where the last state is the absorbing state, and the the time to absorption is the sojourn distribution.
shape_ubound()
Upper bound for shape parameter in moment-based phase-type approximations
gamma_shape_in_bounds() weibull_shape_in_bounds()
Test whether a shape parameter of is in the bounds required for a valid phase-type approximation
n3_moment_bounds()
Bounds on normalised moments for phase-type approximations

Datasets

infsim infsim2
Simulated infection testing data
bigdat
A simulated multistate dataset with lots of observations and covariates
infsim_model infsim_modelc infsim_modelp infsim_modelpc
Example fitted model objects used for testing msmbayes
illdeath_data
A simulated dataset from an illness-death model

Package overview

msmbayes-package
The 'msmbayes' package for Bayesian multi-state modelling of intermittently-observed data