View source: R/TestFunctions.R
testFunction_EPA | R Documentation |
See the "Encompassing Prior Approach" section of the package manual for an explanation of this approach to estimating Bayes factors. There is some encompassing model, M_1
, and a constrained model, M_0
, which is created by placing some constraint on some of the parameters of M_1
. The function I_M0
that is passed to this function determines whether the constraint is satisfied.
Note that you cannot pass this function directly as the testFunction
argument of testHypothesis
because there is no default value for I_M0
. Thus, you must create a curried function to pass to testHypothesis
or use create_EPA_intervalTF
. See the examples for an example of currying.
testFunction_EPA(priorEffects, postEffects, I_M0)
priorEffects |
A numeric matrix of prior effect parameters. Rows are samples and columns are parameters. |
postEffects |
A numeric matrix of posterior effect parameters. Rows are samples and columns are parameters. |
I_M0 |
The indicator function for the constrained model, |
A list for the following elements:
success
: Logical. Whether or not the test was successful. This is FALSE
if the Bayes factors are infinte, NaN, or NA, or TRUE
otherwise.
bf10
: The Bayes factor in favor of the encompassing/alternative model, M_1
.
bf01
: The Bayes factor in favor of the constrained/null model, M_0
.
prior_satisfied
, post_satisfied
: The proportions of the prior and posterior, respectively, that satisfy the constraint of I_M0
. If these are both low and the number of samples satisfying the constraint is small, it indicates that your constraint is possibly too restrictive and that the estimated Bayes factor may be noisy. You should either use a less-restrictive constraint or take more prior and posterior samples.
## Not run: curriedTestFun = function(priorEffects, postEffects) { #M_0: Constrain the effects to be less than 2 units from 0 I_M0 = function(eff) { all(abs(eff) < 2) } testFunction_EPA(priorEffects, postEffects, I_M0) } testHypothesis(..., testFunction = curriedTestFun) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.