A numerically efficient algorithm to calculate predictions from a continuous time, nonhomogeneous Markov multi-state model. The main inputs are are a list of Aalen's additive hazards models, the initial values, the transition matrix and the covariate patterns. The predictions include state occupancy probabilities and length of stay. Standard errors are calculated using the delta method. Includes differences and standardisation.
markov_sde(models, trans, newdata, init = NULL, nLebesgue = 10000 + 1, los = FALSE,
nOut = 300, weights = 1)
# S3 method for markov_sde
standardise(x, ...)
# S3 method for markov_sde
plot(x, y, stacked=TRUE, which=c("P","L"), index=NULL,
xlab="Time", ylab=NULL, col=2:6, border=col,
ggplot2=FALSE, lattice=FALSE, alpha=0.2,
strata=NULL,
...)
# S3 method for markov_sde
as.data.frame(x, row.names=NULL, optional=NULL, ci=TRUE,
P.conf.type="logit", L.conf.type="log",
P.range=c(0,1), L.range=c(0,Inf),
...)
markov_sde
returns an object of class
"markov_sde"
.
list of models. Currently allows only for aalen
regression models.
Transition matrix describing the states and transitions
in the multi-state model. If S is the number of states in the
multi-state model, trans
should be an S x S matrix,
with (i,j)-element a positive integer if a transition from i to j
is possible in the multi-state model, NA
otherwise. In particular,
all diagonal elements should be NA
. The
integers indicating the possible transitions in the multi-state
model should be sequentially numbered, 1,...,K, with K the number
of transitions. See msprep
data.frame
of the covariates to use in the predictions
vector of the initial values with the same length as the number of states. Defaults to the first state having an
initial value of 1 (i.e. "[<-"(rep(0,nrow(trans)),1,1)
).
Number of steps for the continuous integration
logical variable for whether to estimate the length of stay
number of rows to represent the continuous changes
numeric vector to represent differences or standardisation
For plot.markov_sde
:
(currently ignored)
logical for whether to stack the plots. Default: TRUE
indicator of which row of newdata
to plot
character to indicate either transition probabilities ("P"
) or length of stay ("L"
)). Default: "P"
.
x-axis label
x-axis label
colours (ignored if ggplot2=TRUE
)
border colours for the polygon
(ignored if ggplot=TRUE
)
use ggplot2
alpha value for confidence bands (ggplot)
use lattice
formula for the stratification factors for the plot
For as.data.frame.markov_sde
:
add in row names to the output data-frame
(not currently used)
logical for whether to include confidence intervals. Default: TRUE
type of transformation for the confidence interval
calculation for the state occupancy probabilities. Default: logit transformation. This is changed to "identity"
if any of the weights are negative
type of transformation for the confidence interval
calculation for the length of stay calculation. Default: log transformation. "identity"
if any of the weights are negative
valid values for the state occupancy probabilities. Default: (0,1).
valid values for the state occupancy probabilities. Default: (0,Inf).
For standardise.markov_sde
:
object to extract standardised values
other arguments. For plot.markov_sde
, these arguments are passed to plot.default
. For standardise.markov_sde
, these arguments are not used, as the standardisation must be done earlier in markov_sde
.
Mark Clements
Uses an approach developed by Ryalen and colleagues. This is a re-implementation in C++.
The current implementation only allows for a vector of initial values rather than a matrix. The predictions will need to be re-run for different vectors of initial values.
markov_msm