| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/paths.R |
| 3 |
\name{paths} |
| 4 |
\alias{paths} |
| 5 |
\title{Find all possible trajectories through a given multi-state model} |
| 6 |
\usage{ |
| 7 |
paths(trans, start = 1) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{trans}{The transition matrix describing the multi-state model, see |
| 11 |
\code{\link{msprep}}} |
| 12 |
|
| 13 |
\item{start}{The starting state for the trajectories} |
| 14 |
} |
| 15 |
\value{ |
| 16 |
A matrix, each row of which specifies a possible path through the |
| 17 |
multi-state model. |
| 18 |
} |
| 19 |
\description{ |
| 20 |
For a given multi-state model, specified through a transition matrix, |
| 21 |
\code{paths} recursively finds all the possible trajectories or paths |
| 22 |
through that multi-state starting from a specified state. DO NOT USE for |
| 23 |
reversible or cyclic multi-state models. |
| 24 |
} |
| 25 |
\details{ |
| 26 |
The function is recursive. It starts in \code{start}, looks at what states |
| 27 |
can be visited from \code{start}, and appends the results of the next call |
| 28 |
to the current value (matrix). If the transition matrix contains loops, the |
| 29 |
function will find infinitely many paths, so do not use \code{paths} for |
| 30 |
reversible or cyclic multi-state models. A warning is not yet incorporated! |
| 31 |
} |
| 32 |
\examples{ |
| 33 |
|
| 34 |
tmat <- matrix(NA,5,5) |
| 35 |
tmat[1,2:3] <- 1:2 |
| 36 |
tmat[1,5] <- 3 |
| 37 |
tmat[2,4:5] <- 4:5 |
| 38 |
tmat[3,4:5] <- 6:7 |
| 39 |
tmat[4,5] <- 8 |
| 40 |
paths(tmat) |
| 41 |
paths(tmat, start=3) |
| 42 |
|
| 43 |
} |
| 44 |
\author{ |
| 45 |
Hein Putter <[email protected]> |
| 46 |
} |
| 47 |
\keyword{array} |