simlong: Simulate longitudinal data on an equally spaced grid.

Description Usage Arguments Value Author(s) References Examples

View source: R/simlong.R

Description

Allows simulation of a user-provided function on an equally spaced grid. Options for multiple groups and multiple subjects per group. Options for random dropout of observations, either binomially, geometric dropout, or a process based on an endpoint-driven hazard function so that once an observation is missed, that subject has no more observations. Also allows for linear random effects (random intecept and slope).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
simlong(
  grid_length = 11,
  number_groups = 3,
  subjects_per_group = 5,
  SD_intercept = 1e-04,
  SD_slope = 1e-04,
  SD_epsilon = 1e-04,
  xmin = 0,
  xmax = 1,
  dropout_scheme = c("binomial", "geometric", "endpoint_dependent"),
  binom_retention_prob = 1,
  geom_dropout_prob = NULL,
  size_based_dropout = TRUE,
  dropout_map = NULL,
  force_dropout = TRUE,
  with_dropout_annot = FALSE,
  response_func = function(x, ...) {     6 * x * (1 - x) }
)

Arguments

grid_length

integer number of equally-spaced points at which each subject is evaluated at the function.

number_groups

integer number of groups.

subjects_per_group

integer number of subjects per group.

SD_intercept

numeric Gaussian SD for random intercept term

SD_slope

numeric Gaussian SD for random slope term

SD_epsilon

numeric Gaussian SD for random within-subject "noise" term attached to each measurement.

xmin

numeric starting point of grid at which to evaluate the function for each subject.

xmax

numeric ending point of grid at which to evaluate the function for each subject.

dropout_scheme

character string specifying which dropout scheme is to be used.

binom_retention_prob

numeric probability of retaining an observation. Set between 0 and 1 for simple Bernoulli random thinning.

geom_dropout_prob

numeric geometric dropout probability in (0,1). Probability for subject to drop out at each post-baseline step. Set to non-NULL to override binomial thinning.

size_based_dropout

logical whether to determine dropout probability from current endpoint value.

dropout_map

data.frame mapping endpoint values to dropout probability values that can be used to interpolate dropout probability.

force_dropout

logical whether to force a dropout when the endpoint exceeds the upper end of the dropout map phenotype range.

with_dropout_annot

logical whether to skip filtering the data.frame and return everything along with columns to perform dropout filtering manually.

response_func

function to evaluate for each grid point, for each subject

Value

data.frame with simulated data set.

Author(s)

Bill Forrest <forrest@gene.com>

Bill Forrest forrest@gene.com

References

www.r-project.org

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
simlong_example_00  = simlong( number_groups = 1, subjects_per_group = 1,
                               response_func = function( x, ... ) { 1 + x } )

simlong_example_01  = simlong( grid_length = 25, number_groups = 2, subjects_per_group = 3,
                               SD_intercept = .1, SD_slope = .1, SD_epsilon = .01, 
                               response_func = function( x, group ) { 
                                                   1 + x * scale( as.numeric( group ) )
                                                                    }   
                              )
 

wfforrest/maeve documentation built on Jan. 1, 2021, 12:47 p.m.