create_exposure_simulation_skeleton: Create List Structure for Simulations

Description Usage Arguments Details Value See Also Examples

View source: R/functions_exposure_simulation.R

Description

These functions construct lists containing the structure for simulating exposure data and the objects needed for fitting the model to the data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
create_exposure_simulation_skeleton(design = "parallel", ...)

create_exposure_simulation_skeleton_parallel(
  ngroups = 1,
  nclusters = 1,
  nunits = 1,
  nobs = 1,
  verbose = TRUE
)

create_exposure_simulation_skeleton_crossover(
  ngroups = 2,
  nclusters = 1,
  nunits = 1,
  nobs1 = 1,
  nobs2 = 1,
  firstgroup = 1,
  verbose = TRUE
)

Arguments

design

String providing the study design. Currently only "parallel" and "crossover" is implemented.

...

Additional arguments passed to the design-specific functions.

ngroups

Number of groups.

nclusters

Number of clusters. Either a single value or a vector of length ngroups.

nunits

Number of units (e.g. households) in each cluster. If length 1, repeated for all clusters.

nobs

Number of observations in each unit. If length 1, repeated for all units and if length sum(nclusters), repeated for all units within each cluster.

verbose

Logical indicator for message printing.

nobs1

Number of observations in the first group for each unit (should have length equal to the number of units). Note that the "first" group might not be group 1.

nobs2

Number of observations in the second group for each unit (should have length equal to the number of units). Note that the "second" group might not be group 2.

firstgroup

Integer indicating which group a unit is in first (should have length equal to the number of units).

Details

These functions create the blank structure of groups, clusters, and units (e.g. households). Once parameters are set via expsim_update_parameter and related functions, then data can be sampled via expsim_sample_observations and posterior parameter estimates obtained from sample_exposure_model. See sample_exposure_model for a mathematical description of the model.

The crossover design is currently implemented with only 2 groups.

Value

A list containing two sublists: structure, which contains settings and parameters for generating data, and standata which contains the study data as a standata_exposure obejct for sampling via sample_exposure_model.

See Also

create_outcome_simulation_skeleton, sample_exposure_model

Other exposure simulation functions: expsim_sample_observations(), expsim_update_parameter(), sim_update_times()

Examples

1
2
3
4
5
6
# Create simulation structure
es <- create_exposure_simulation_skeleton_parallel(ngroups=2, nunits=3)
str(es)
# Create simulation structure
es <- create_exposure_simulation_skeleton_crossover(ngroups=2, nunits=3)
str(es)

jpkeller/bercs documentation built on March 24, 2021, 5:36 a.m.