Description Usage Arguments Value Author(s) Examples
View source: R/simulate_priors.R
Function for simulating from the parameter prior distributions.
1 2 3 4 5  simulate_priors(
nsamples,
prior_par = list(mu_psi = 0, sigma_psi = 1, mu_beta = 0, sigma_beta = 1),
hypothesis = "H1"
)

nsamples 
number of samples. 
prior_par 
list with prior parameters. This list needs to contain the
following elements: 
hypothesis 
character specifying whether to sample from a twosided prior (i.e., "H1"), a onesided prior with lower truncation point (i.e., "H+"), or a onesided prior with upper truncation point (i.e., "H"). 
a data frame with prior samples for the following quantities (see
?ab_test
for a description of the underlying model):
beta
: prior samples for the grand mean of the log odds.
psi
: prior samples for the log odds ratio.
p1
: prior
samples for the latent "success" probability in the control group.
p2
: prior samples for the latent "success" probability in the
experimental group.
logor
: prior samples for the log odds
ratio (identical to psi
, only included for easier reference).
or
: prior samples for the odds ratio.
rrisk
: prior
samples for the relative risk (i.e., the ratio of the "success" probability
in the experimental and the control condition).
arisk
: prior
samples for the absolute risk (i.e., the difference of the "success"
probability in the experimental and control condition)
.
Quentin F. Gronau
1 2 3 4 5 6 7 8 9  # prior parameters
prior_par < list(mu_psi = 0, sigma_psi = 1,
mu_beta = 0, sigma_beta = 1)
# obtain prior samples
samples < simulate_priors(nsamples = 1000, prior_par = prior_par)
# plot, e.g., prior samples for absolute risk
hist(samples$arisk)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.