sample_exposure_model: Sample Exposure Model

Description Usage Arguments Details See Also Examples

View source: R/functions_exposure_model.R

Description

Samples from the posterior distribution of the exposure model, using STAN

Usage

1
2
3
4
5
6
7
8
sample_exposure_model(
  standata,
  B = 1000,
  warmup = B,
  chains = 4,
  control = list(adapt_delta = 0.9, max_treedepth = 12),
  ...
)

Arguments

standata

An object of class 'standata_exposure', typically created from create_standata_exposure. It should also include information on prior distributions, which can be added via add_priors

B

Number of post-warmup iterations.

warmup

Number of warmup iterations.

chains

Number of chains to sample.

control

List provided as the control argument of sampling

...

Additional arguments passed to sampling.

Details

This fits a hierarchical model designed for modeling exposure concentrations from a study that has irregularly-spaced, clustered measurements. The model for an observation w_{gkit} from exposure group g, cluster (e.g. neighborhood) k, unit (e.g. household) i, and time t is:

w_{gkit} = η_g + α_{0k} + α_{1i}+ H(t)*θ

Here, η_g is a group-specific mean, alpha_{0k} is a cluster-specific random effect, alpha_{1i} is a unit-specific random effect, and θ are coefficients for a temporal spline H(t).

See Also

create_standata_exposure, sample_outcome_model, add_priors, compute_fitted_mean

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Create simulated data
exp_data <- create_standata_exposure(group=rep(1, 10),
                                     conc=rnorm(10),
                                     unit_id=rep(0:1, 5),
                                     time=runif(10))
# Add default priors
exp_data <- add_priors(exp_data,
                       sigmaI=c(0, 0.1))
# Fit the model
exp_mod_fit <- sample_exposure_model(exp_data)
print(exp_mod_fit, pars=c("muW", "reI_raw", "etaG_raw"), include=FALSE)

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