Learn R Programming

lifecontingencies (version 1.3.12)

rmdt: Simulate from a multiple decrement table

Description

Simulate from a multiple decrement table

Usage

rmdt(n = 1, object, x = 0, t = 1, t0 = "alive", include.t0 = TRUE)

Value

A matrix with n columns (the length of simulation) and either t (if initial status is not included) or t+1 rows.

Arguments

n

Number of simulations.

object

The mdt object to simulate from.

x

the period to simulate from.

t

the period until to simulate.

t0

initial status (default is "alive").

include.t0

should initial status to be included (default is TRUE)?

Author

Giorgio Spedicato

Details

The functin uses rmarkovchain function from markovchain package to simulate the chain

See Also

rLifeContingenciesXyz,rLifeContingencies

Examples

Run this code
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