valueTest_SDDR: Test Specific Parameter Value

View source: R/TestFunctions.R

valueTest_SDDRR Documentation

Test Specific Parameter Value

Description

Performs a hypothesis test of whether a single parameter, P, has a given value, with the value chosen with testVal. Uses the Savage-Dickey density ratio.

Usage

valueTest_SDDR(prior, posterior, testVal, pKept = 0.96, bounds = TRUE)

Arguments

prior

A vector of samples from the prior of the parameter.

posterior

A vector of samples from the posterior of the parameter.

testVal

The value that will be tested. The null hypothesis is that P == testVal and the alternative hypothesis is that P =/= testVal.

pKept

The proportion of the prior and posterior distributions that will be kept. The rest will be discarded from the tails.

bounds

If TRUE, bounds are based on pKept. If FALSE, no bounds are used. If a length 2 numeric vector, those are the bounds that are used.

Details

This function assumes that the prior and posterior are both unbounded and potentially diffuse. To account for diffuse priors, it truncates both the prior and posterior in some way. By default, it keeps some proportion of the prior and posterior, which is set by the pKept argument. You use some combination of the pKept and bounds arguments to set the bounds.

Value

A list with several elements:

  • success: Whether density estimation was successful. If FALSE, all of the other values will be NA or NULL.

  • bf10: The Bayes factor in favor of the hypothesis that P == testVal.

  • bf01: The Bayes factor in favor of the hypothesis that P =/= testVal.

  • prior_pKept: The actual proportion of the prior that was kept. Should usually be equal to pKept.

  • post_pKept: The actual proportion of the posterior that was kept. Should usually be equal to pKept.


hardmanko/CMBBHT documentation built on June 9, 2022, 12:44 a.m.