expsim_update_parameter: Update Exposure Model Parameters

Description Usage Arguments Details See Also Examples

View source: R/functions_exposure_simulation.R

Description

Sets or overwrites data-generating parameters for an exposure model object

Usage

1
2
3
4
5
6
7
8
expsim_update_parameter(
  obj,
  param,
  level = c("group", "cluster", "unit", "observation", "correlation", "time"),
  type = c("mean", "sd", "re"),
  value = NULL,
  draw = is.null(value)
)

Arguments

obj

'expsim' object to update

param

character string giving name of parameter to update. If not provided, parameter name is taken from level and type

level

character string of model level being updated. Must be one of "group", "cluster", "unit", "observation", or "time". See Details.

type

character string giving type of parameter being updated. See Details.

value

value(s) to which parameter should be set

draw

if TRUE, then the parameter value is sampled instead of being set to value

Details

Only specific combinations of level and type are allowed. They are:

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Create simulation structure
es <- create_exposure_simulation_skeleton_parallel(ngroups=2, nunits=10)

# No standard deviation parameter set by default
es$structure$sigK
# Add standard deviation parameter value
es <- expsim_update_parameter(es, level="cluster", type="sd", value=1)
es$structure$sigK
# Sample random effect values
es <- expsim_update_parameter(es, level="cluster", type="re", draw=TRUE)

# Add time function
es <- expsim_update_parameter(es, level="time", type="mean", value=function(w) 2*cos(w))

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