hazard {SemiMarkov} | R Documentation |
Computes hazard rates using an object of class semiMarkov
or param.init
Description
For a given vector of times, the function computes the hazard rates values of an object of class semiMarkov
or param.init
(which provided the hazard rates). Both, values of hazard rate of waiting time of semi-Markov process can be obtained.
Usage
hazard(object, type = "alpha", time = NULL,
cov = NULL, s = 0, t = "last", Length = 1000)
Arguments
object |
Object of class |
type |
Type of hazard to be computed: |
time |
A vector containing the time values for which the hazard rate is computed.
Default value is a vector |
cov |
A list with one component for each covariate. Each component gives values of covariates that are to be used for the hazard rates computation. For a time-fixed covariate a single value can be given whereas a whole vector of values is required for time dependent covariates. Default is |
s |
Starting value of the time interval |
t |
Ending value of the time interval |
Length |
The number of points of the time interval |
Details
This function computes the hazard rates of waiting (or sojourn) times and the hazard rates of semi-Markov process defined in the parametric multi-state semi-Markov model described in Listwon and Saint-Pierre (2013). Additional details about the methodology behind the SemiMarkov
package can be found in Limnios and Oprisan (2001), Foucher et al. (2006) and Perez-Ocon and Ruiz-Castro (1999).
The hazard rate of waiting time at time t
represents the conditional probability that a transition from state h
to state j
is observed given that no event occurs until time t
. In a parametric framework, the expression of the hazard rates can easily be obtained as the distributions of waiting time belong to a parametric family. The hazard rate values are calculated using the chosen distribution and the given values of the parameters. The effects of both constant and time-varying covariates on the hazard of waiting time can be studied using a proportional intensities model. The effects of covariates can then be interpreted in terms of relative risk.
The hazard rate of the semi-Markov process at time t
represents the conditional probability that a transition into state j
is observed given that the subject is in state h
and that no event occurs until time t
. The hazard rate of the semi-Markov process can be interpreted as the subject's risk of passing from state h
to state j
. This quantity can be deduced from the transition probabilities of the embedded Markov chain and from the distributions of waiting times.
This function can be used to compute the hazard rates for different values of the covariates or different values of the parameters. These hazard rates can then be plotted using plot.hazard.
Objects of classes semiMarkov
and param.init
can be used in the function hazard
. These objects contain informations on the model and the values of the parameters for the waiting time distribution, the transition probability of Markov chain and the regression coefficients.
Value
Returns an object of class hazard
.
Type |
The type of hazard computed by the function |
vector |
A data frame containing one vector for each possible transition. A vector contains values of the hazard rate associated to the vector of times. |
Time |
The vector of times used to compute the hazard rate. |
Covariates |
A list containing the values of the covariates (fixed or time-dependent). |
Summary |
A list of data frames (one for each possible transition). A dataframe contains quantiles, means, minimums and maximums of the hazard rate values. |
Transition_matrix |
A matrix containing informations on the model: the possible transitions and the distribution of waiting times for each transition (Exponential, Weibull or Exponentiated Weibull). |
call |
Recall the name of the model. |
Author(s)
Agnieszka Listwon-Krol
References
Krol, A., Saint-Pierre P. (2015). SemiMarkov : An R Package for Parametric Estimation in Multi-State Semi-Markov Models. 66(6), 1-16.
Limnios, N., Oprisan, G. (2001). Semi-Markov processes and reliability. Statistics for Industry and Technology. Birkhauser Boston.
Foucher, Y., Mathieu, E., Saint-Pierre, P., Durand, J.F., Daures, J.P. (2006). A semi-Markov model based on Generalized Weibull distribution with an illustration for HIV disease. Biometrical Journal, 47(6), 825-833.
Perez-Ocon, R., Ruiz-Castro, J. E. (1999). Semi-markov models and applications, chapter 14, pages 229-238. Kluwer Academic Publishers.
See Also
plot.hazard, semiMarkov, param.init, summary.hazard, print.hazard
Examples
## Asthma control data
data(asthma)
## Definition of the model: states, names,
# possible transtions and waiting times distributions
states_1 <- c("1","2","3")
mtrans_1 <- matrix(FALSE, nrow = 3, ncol = 3)
mtrans_1[1, 2:3] <- c("E","E")
mtrans_1[2, c(1,3)] <- c("E","E")
mtrans_1[3, c(1,2)] <- c("W","E")
## semi-Markov model without covariates
fit1 <- semiMarkov(data = asthma, states = states_1, mtrans = mtrans_1)
## Hazard rates of waiting time
alpha1 <- hazard(fit1)
plot(alpha1)
## Hazard rates of the semi-Markov process
lambda1 <- hazard(fit1, type = "lambda")
plot(lambda1)
## Defining a vector of equally distributed times
alpha2 <- hazard(fit1, s=0, t=3, Length=300)
plot(alpha2)
## Considering times observed in the data set
alpha3 <- hazard(fit1, time=sort(unique(asthma$time)))
plot(alpha3)
## semi-Markov model with a covariate "BMI"
fit2 <- semiMarkov(data = asthma, cov = as.data.frame(asthma$BMI),
states = states_1, mtrans = mtrans_1)
## Time fixed covariate
## Covariate equal to 0 and 1 for each transition
alpha4 <- hazard(fit2)
alpha5 <- hazard(fit2, cov=1)
plot(alpha4,alpha5)
## Time dependent covariate
## Suppose that the covariate value is known for all times values
Time<-sort(unique(asthma$time)) # observed times in ascending order
Cov1<-sort(rbinom(length(Time), 1, 0.3)) # simulation of binary covariate
Cov2<-sort(rexp(length(Time), 5)) # simulation of numeric covariate
alpha6 <- hazard(fit2, time=Time, cov=Cov1)
plot(alpha6)
alpha7 <- hazard(fit2, time=Time, cov=Cov2)
plot(alpha7)
## semi-Markov model with two covariates
## "BMI" affects transitions "1->3" and "3->1"
## "Sex" affects transition "3->1"
SEX <- as.data.frame(asthma$Sex)
BMI <- as.data.frame(asthma$BMI)
fit3 <- semiMarkov(data = asthma, cov = as.data.frame(cbind(BMI,SEX)),
states = states_1, mtrans = mtrans_1,
cov_tra = list(c("13","31"),c("31")))
alpha8 <- hazard(fit3, cov=c(0,0))
alpha9 <- hazard(fit3, cov=c(1,1))
plot(alpha8,alpha9)