Description Usage Arguments Details See Also Examples
View source: R/functions_stan_objects.R
Sets prior distribution hyperparameters using defaults or provided values
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | add_priors(standata, ...)
add_priors_exposure_model(
standata,
etaG = 0,
sigmaG = c(0, 1),
reK = 0,
sigmaK = c(0, 1),
reI = 0,
sigmaI = c(0, 1),
sigmaW = c(0, 1),
theta = 0,
sigmaTheta = c(0, 1),
...
)
add_priors_outcome_model(
standata,
beta = 0,
sigmaBeta = c(0, 1),
gamma = 0,
sigmaGamma = c(0, 1),
delta = 0,
sigmaDelta = c(0, 1),
sigmaI = c(0, 1),
beta_nu = 1,
...
)
|
standata |
Either a |
... |
Arguments passed to |
etaG |
Prior mean and standard deviation for the group means parameter 'etaG'. |
sigmaG |
Prior mean and standard deviation for the group standard deviation parameter 'sigmaG'. |
reK |
Prior mean for cluster-level random effects. |
sigmaK |
Prior mean and standard deviation for the standard deviation of the cluster random effects, 'sigmaK'. |
reI |
Prior mean for household-level random effects. |
sigmaI |
Prior mean and standard deviation for the standard deviation of the subject-level random effect. |
sigmaW |
Prior mean and standard deviation for the residual standard deviation parameter 'sigmaW'. |
theta |
Prior mean and standard deviation for the time coefficients 'thetaG'. |
sigmaTheta |
Prior mean and standard deviation for the standard deviation parameter for time trends, 'sigmaTheta'. |
beta |
Prior mean for the exposure coefficient(s). |
sigmaBeta |
Prior mean and standard deviation for the standard deviation of exposure coefficient parameter. |
gamma |
Prior mean for the covariate coefficient(s). |
sigmaGamma |
Prior mean and standard deviation for the standard deviation of covariate coefficient parameter. |
delta |
Prior mean for the time coefficient(s). |
sigmaDelta |
Prior mean and standard deviation for the standard deviation of time coefficient parameter. |
beta_nu |
Prior value for the LKJ prior on the correlation between exposure coefficients from different studies. |
Based on its class, add_priors
calls add_priors_exposure_model
or add_priors_exposure_model
. For the variance parameters, the prior distributions are half-normal distributions parameterized by (mean, sd).
create_standata_exposure
, create_standata_outcome
, sample_exposure_model
, sample_outcome_model
1 2 3 4 5 6 7 8 9 | # 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 comnbination of default and custom prior
exp_data <- add_priors(exp_data,
sigmaI=c(0, 0.1),
sigmaK=c(0, 2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.