hazard_times: Latent CTMC hazard functions

Description Usage Arguments Value Author(s) Examples

View source: R/functionals.R

Description

Obtain hazard function based on specified starting states and destination state.

Usage

1
2
  hazard_times(start = 0, end, state_of_interest,
    at_risk_states, alpha, rate, length.out = 1000)

Arguments

start

start time for the hazard estimates

end

end time for the hazard estimates

state_of_interest

destination state

at_risk_states

potential states of origin

alpha

starting distribution (vector)

rate

latent CTMC rate matrix to estimate the hazard

length.out

number of points between start and end times to estimate the hazard

Value

hazard

estimated hazard at different times

times

times at which hazard is estimated

.

Author(s)

Jane Lange

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
library(cthmm)
data(panel_demodata)

rates.list=get.rate.matrix.list(current.params=fit.4state$param[1:8],
rate.setup=rates.setup, do.list=T)
rate.firstpassage.AB_0=rates.list[[200]]
rate.firstpassage.AB_0[3:4,]=0
hazardA.B_0=hazard_times(start=.01,end=10,state_of_interest=c(3),
at_risk_states=c(1,2),alpha=c(1,0,0,0),rate.firstpassage.AB_0)

plot(hazardA.B_0$times,hazardA.B_0$haz,type="l",ylab="hazard",xlab="time since entrance in state A",
     main="Hazard function for first passage time from state A to B, for covariate X=0")

## End(Not run)

cthmm documentation built on May 2, 2019, 5:46 p.m.