Description Usage Arguments Details Value See Also Examples
View source: R/functions_exposure_simulation.R
These functions construct lists containing the structure for simulating exposure data and the objects needed for fitting the model to the data.
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
)
|
design |
String providing the study design. Currently only |
... |
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 |
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 |
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). |
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.
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
.
create_outcome_simulation_skeleton
, sample_exposure_model
Other exposure simulation functions:
expsim_sample_observations()
,
expsim_update_parameter()
,
sim_update_times()
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.