smmnonparametric {smmR} | R Documentation |
Non-parametric semi-Markov model specification
Description
Creates a non-parametric model specification for a semi-Markov model.
Usage
smmnonparametric(
states,
init,
ptrans,
type.sojourn = c("fij", "fi", "fj", "f"),
distr,
cens.beg = FALSE,
cens.end = FALSE
)
Arguments
states |
Vector of state space of length |
init |
Vector of initial distribution of length |
ptrans |
Matrix of transition probabilities of the embedded Markov
chain |
type.sojourn |
Type of sojourn time (for more explanations, see Details). |
distr |
|
cens.beg |
Optional. A logical value indicating whether or not sequences are censored at the beginning. |
cens.end |
Optional. A logical value indicating whether or not sequences are censored at the end. |
Details
This function creates a semi-Markov model object in the non-parametric case, taking into account the type of sojourn time and the censoring described in references. The non-parametric specification concerns sojourn time distributions defined by the user.
The difference between the Markov model and the semi-Markov model concerns the modeling of the sojourn time. With a Markov chain, the sojourn time distribution is modeled by a Geometric distribution (in discrete time). With a semi-Markov chain, the sojourn time can be any arbitrary distribution.
We define :
the semi-Markov kernel
;
the transition matrix
of the embedded Markov chain
,
;
the initial distribution
,
;
the conditional sojourn time distributions
, f is specified by the argument
distr
in the non-parametric case.
In this package we can choose different types of sojourn time. Four options are available for the sojourn times:
depending on the present state and on the next state (
);
depending only on the present state (
);
depending only on the next state (
);
depending neither on the current, nor on the next state (
).
Let define the maximum length of the sojourn times.
If
type.sojourn = "fij"
, distr
is an array of dimension .
If
type.sojourn = "fi"
or "fj"
, distr
must be a matrix of dimension .
If
type.sojourn = "f"
, distr
must be a vector of length .
If the sequence is censored at the beginning and/or at the end, cens.beg
must be equal to TRUE
and/or cens.end
must be equal to TRUE
.
All the sequences must be censored in the same way.
Value
Returns an object of class smm
, smmnonparametric.
References
V. S. Barbu, N. Limnios. (2008). Semi-Markov Chains and Hidden Semi-Markov Models Toward Applications - Their Use in Reliability and DNA Analysis. New York: Lecture Notes in Statistics, vol. 191, Springer.
See Also
simulate, fitsmm, smmparametric
Examples
states <- c("a", "c", "g", "t")
s <- length(states)
# Creation of the initial distribution
vect.init <- c(1 / 4, 1 / 4, 1 / 4, 1 / 4)
# Creation of the transition matrix
pij <- matrix(c(0, 0.2, 0.5, 0.3,
0.2, 0, 0.3, 0.5,
0.3, 0.5, 0, 0.2,
0.4, 0.2, 0.4, 0),
ncol = s, byrow = TRUE)
# Creation of a matrix corresponding to the
# conditional sojourn time distributions
kmax <- 6
nparam.matrix <- matrix(c(0.2, 0.1, 0.3, 0.2,
0.2, 0, 0.4, 0.2,
0.1, 0, 0.2, 0.1,
0.5, 0.3, 0.15, 0.05,
0, 0, 0.3, 0.2,
0.1, 0.2, 0.2, 0),
nrow = s, ncol = kmax, byrow = TRUE)
semimarkov <- smmnonparametric(states = states, init = vect.init, ptrans = pij,
type.sojourn = "fj", distr = nparam.matrix)
semimarkov