create_outcome_simulation_skeleton: Create Skeleton for Outcome Simulations

Description Usage Arguments Details Value See Also

View source: R/functions_outcome_simulation.R

Description

These functions construct lists containing the structure and data for simulating exposure and outcome data.

Usage

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

create_outcome_simulation_skeleton_parallel(
  nstudies = 1,
  nclusters = 1,
  nunits = 1,
  nobs = 1,
  study_of_cluster,
  cluster_of_unit,
  unit_of_obs,
  beta0 = 0,
  x = 0,
  nT = NA,
  time = NA,
  verbose = TRUE,
  xfn = function(x) {     x },
  timefn = function(t) {     rep(0, length(t)) }
)

Arguments

design

String indicating trial design. Currently only 'parallel' is supported.

...

Additional arguments passed to the design-specific functions.

nstudies

Number of studies.

nclusters

Number of clusters per study. If not of length nstudies, the same value will be used for all studies.

nunits

Number of units.

nobs

Number of observations per unit. If length 1, value is repeated for all units. If length sum(nclusters), then each element is repeated for all units within the corresponding cluster.

study_of_cluster

optional vector of positive integers that provide the study number of each cluster. Should have length sum(nclusters).

cluster_of_unit

optional vector that provides the cluster number of each unit. Should have length sum(nunits).

unit_of_obs

optional vector that provides the unit number of each observation. Should have length sum(nobs).

beta0

Study-level intercept, on the logit scale. Defaults to 0 and can be updated later via outsim_update_covariate.

x

Exposure concentration values. Defaults to 0 and can be updated later via outsim_update_covariate.

nT

optional time-at-risk value. See outsim_update_atrisk

time

optional times for observations. Can be set later via sim_update_times.

verbose

should messages be printed.

xfn

Exposure-response function. Can be set later via outsim_update_parameter.

timefn

Function relating time to mean outcome. Can be set later via outsim_update_parameter.

Details

These functions create the blank structure of groups, clusters, households, and unit. 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.

For creating a standata_outcome object from an existing 'wide' format data frame, see create_standata_outcome.

Value

A list containing two sublists: structure, which contains settings and parameters for generating data, and standata which contains the study data in a format for sampling via STAN.

See Also

sample_outcome_model, create_exposure_simulation_skeleton

Other outcome simulation functions: outsim_sample_observations(), outsim_update_parameter(), sim_update_times()


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