dprior {abtest} | R Documentation |
Function for evaluating the prior density.
dprior( x1, x2 = NULL, prior_par = list(mu_psi = 0, sigma_psi = 1, mu_beta = 0, sigma_beta = 1), what = "logor", hypothesis = "H1" )
x1 |
numeric vector with values at which the prior density should be evaluated. |
x2 |
if |
prior_par |
list with prior parameters. This list needs to contain the
following elements: |
what |
character specifying for which quantity the prior density should
be evaluated. Either |
hypothesis |
character specifying whether to evaluate the two-sided prior density (i.e., "H1"), the one-sided prior density with lower truncation point (i.e., "H+"), or the one-sided prior density with upper truncation point (i.e., "H-"). |
numeric vector with the values of the prior density.
Internally, the test-relevant prior is always a normal prior on the log
odds ratio, consequently, if what
is not "logor"
, the
implied prior density for the quantity is returned.
Quentin F. Gronau
# prior parameters prior_par <- list(mu_psi = 0, sigma_psi = 1, mu_beta = 0, sigma_beta = 1) # prior density dprior(x1 = 0.1, prior_par = prior_par, what = "logor") dprior(x1 = 1.1, prior_par = prior_par, what = "or") dprior(x1 = 0.49, x2 = 0.51, prior_par = prior_par, what = "p1p2") dprior(x1 = 0.45, prior_par = prior_par, what = "p1") dprior(x1 = 0.45, prior_par = prior_par, what = "p2") dprior(x1 = 0.49, x2 = 0.51, prior_par = prior_par, what = "p2givenp1") dprior(x1 = 1.05, prior_par = prior_par, what = "rrisk") dprior(x1 = 0.02, prior_par = prior_par, what = "arisk") # also works for vectors dprior(x1 = c(-0.1, 0, 0.1, 0.2), prior_par = prior_par, what = "logor")