simulate: Simulate a 'daps' object.

Description Usage Arguments Value

View source: R/model_simulation.R

Description

Simulates data from from to to for each subject using the metastate model provided in add_metastate_model() and the trained model fits created during train().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
simulate(
  daps,
  static = NULL,
  longitudinal = NULL,
  from,
  to,
  h = NULL,
  forward = NULL,
  impute = FALSE,
  lookback_steps = 5L,
  s = 1L,
  seed = NULL
)

Arguments

daps

A daps-class object to simulate. Must have a daps_trained_fits component and a daps_metastate_model component, added with train() and add_metastate_model(), respectively.

static

A data frame with a unique numeric column id.

longitudinal

A data frame with a numeric id column and an integerish t column.

from, to

Each should be a nonzero integer corresponding to the time point (i.e., the value of t as in the longitudinal data set) when simulation should begin and end. These can both be higher than the highest value(s) of the t column in longitudinal. to must not be smaller than from.

s

A nonzero integer indicating the number of simulations to perform.

start_metastate

A character string indicated the initial state of the subjects (i.e., at t = from - 1). Must be one of the states specified in add_metastate_model().

Value

A list of tibbles with length s with simulated data.


NikKrieger/daps documentation built on March 4, 2020, 1:28 p.m.