Description Usage Arguments Details See Also Examples
View source: R/functions_exposure_model.R
Samples from the posterior distribution of the exposure model, using STAN
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),
...
)
|
standata |
An object of class 'standata_exposure', typically created from |
B |
Number of post-warmup iterations. |
warmup |
Number of warmup iterations. |
chains |
Number of chains to sample. |
control |
List provided as the |
... |
Additional arguments passed to |
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).
create_standata_exposure
, sample_outcome_model
, add_priors
, compute_fitted_mean
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.