powered by
Simulate from a multiple decrement table
rmdt(n = 1, object, x = 0, t = 1, t0 = "alive", include.t0 = TRUE)
A matrix with n columns (the length of simulation) and either t (if initial status is not included) or t+1 rows.
Number of simulations.
The mdt object to simulate from.
mdt
the period to simulate from.
the period until to simulate.
initial status (default is "alive").
should initial status to be included (default is TRUE)?
Giorgio Spedicato
The functin uses rmarkovchain function from markovchain package to simulate the chain
rmarkovchain
rLifeContingenciesXyz,rLifeContingencies
rLifeContingenciesXyz
rLifeContingencies
mdtDf<-data.frame(x=c(0,1,2,3),death=c(100,50,30,10),lapse=c(150,20,2,0)) myMdt<-new("mdt",name="example Mdt",table=mdtDf) ciao<-rmdt(n=5,object = myMdt,x = 0,t = 4,include.t0=FALSE,t0="alive")
Run the code above in your browser using DataLab