md.simulate: md.simulate

Description Usage Arguments Examples

View source: R/library.R

Description

Creates a simulated dataset using the provided simulation parameters.

Usage

1
md.simulate(sim, N)

Arguments

sim

a md.simparams object containg simulation parameters

N

number of observations

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
library(missDeaths)
ratetable = survexp.us

sim = md.simparams() +
          md.sex("sex", 1) + 
          md.uniform("Z1") +
          md.mvnorm(c("Z2", "Z3"), c(100, 0), matrix(c(225, 3, 2, 1), 2, 2)) +
          md.sample("Z4", c(1, 2, 3, 4), c(0.25, 0.25, 0.25, 0.25)) +
          md.uniform("birth", as.Date("1930-1-1"), as.Date("1960-1-1")) +
          md.constant("start", as.Date("1990-1-1")) +
          md.death("death", ratetable, "sex", "birth", "start") +
          md.eval("age", "as.numeric(start - birth)/365.2425", 80, FALSE) + 
          md.exp("event", "start", c("age", "sex", "Z1", "Z2"), 
             c(0.1, 2, 1, 0.01), 0.0001)
          
data = md.simulate(sim, 1000)

## End(Not run)

missDeaths documentation built on May 29, 2017, 10:47 a.m.