twophase {msm} | R Documentation |
Coxian phase-type distribution with two phases
Description
Density, distribution, quantile functions and other utilities for the Coxian phase-type distribution with two phases.
Usage
d2phase(x, l1, mu1, mu2, log = FALSE)
p2phase(q, l1, mu1, mu2, lower.tail = TRUE, log.p = FALSE)
q2phase(p, l1, mu1, mu2, lower.tail = TRUE, log.p = FALSE)
r2phase(n, l1, mu1, mu2)
h2phase(x, l1, mu1, mu2, log = FALSE)
Arguments
x , q |
vector of quantiles. |
l1 |
Intensity for transition between phase 1 and phase 2. |
mu1 |
Intensity for transition from phase 1 to exit. |
mu2 |
Intensity for transition from phase 2 to exit. |
log |
logical; if TRUE, return log density or log hazard. |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. |
log.p |
logical; if TRUE, probabilities p are given as log(p). |
p |
vector of probabilities. |
n |
number of observations. If |
Details
This is the distribution of the time to reach state 3 in a continuous-time
Markov model with three states and transitions permitted from state 1 to
state 2 (with intensity ) state 1 to state 3
(intensity
) and state 2 to state 3 (intensity
). States 1 and 2 are the two "phases" and state 3 is the
"exit" state.
The density is
if , and
otherwise. The distribution function is
if , and
otherwise. Quantiles are calculated by numerically inverting the distribution function.
The mean is .
The variance is .
If it reduces to an exponential distribution with
rate
, and the parameter
is redundant.
Or also if
.
The hazard at is
, and smoothly increasing if
. If
it increases to an asymptote of
, and if
it increases to an
asymptote of
. The hazard is decreasing if
, to an asymptote of
.
Value
d2phase
gives the density, p2phase
gives the
distribution function, q2phase
gives the quantile function,
r2phase
generates random deviates, and h2phase
gives the
hazard.
Alternative parameterisation
An individual following this distribution can be seen as coming from a mixture of two populations:
1) "short stayers" whose mean sojourn time is and sojourn
distribution is exponential with rate
.
2) "long stayers" whose mean sojourn time and sojourn
distribution is the sum of two exponentials with rate
and
respectively. The
individual is a "long stayer" with probability
.
Thus a two-phase distribution can be more intuitively parameterised by the
short and long stay means and the long stay probability
. Given these parameters, the transition intensities are
,
, and
. This can be useful for choosing
intuitively reasonable initial values for procedures to fit these models to
data.
The hazard is increasing at least if , and also
only if
.
For increasing hazards with , the maximum hazard ratio between any time
and time 0 is
.
For increasing hazards with , the maximum hazard ratio is
. This is the minimum hazard ratio for
decreasing hazards.
Author(s)
C. H. Jackson chris.jackson@mrc-bsu.cam.ac.uk
References
C. Dutang, V. Goulet and M. Pigeon (2008). actuar: An R Package for Actuarial Science. Journal of Statistical Software, vol. 25, no. 7, 1-37. URL http://www.jstatsoft.org/v25/i07