rmdt: Simulate from a multiple decrement table

View source: R/6_randomGenerationFunctions.R

rmdtR Documentation

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)

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)?

Value

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

Details

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

Author(s)

Giorgio Spedicato

See Also

rLifeContingenciesXyz,rLifeContingencies

Examples

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")


lifecontingencies documentation built on July 9, 2023, 6:10 p.m.