Learn R Programming

NAP (version 1.1)

implement.SBFNAP_onez: Implement Sequential Bayes Factor using the NAP for one-sample \(z\)-tests

Description

In a \(N(\mu,\sigma_0^2)\) population with known variance \(\sigma_0^2\), consider the two-sided one-sample \(z\)-test for testing the point null hypothesis \(H_0 : \mu = 0\) against \(H_1 : \mu \neq 0\). For a sequentially observed data, this function implements the Sequential Bayes Factor design when a normal moment prior is assumed on the standardized effect size \(\mu/\sigma_0\) under the alternative.

Usage

implement.SBFNAP_onez(obs, sigma0 = 1, tau.NAP = 0.3/sqrt(2),
                      RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3),
                      batch.size, return.plot = TRUE, until.decision.reached = TRUE)

Arguments

obs

Numeric vector. The vector of sequentially observed data.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: \(0.3/\sqrt2\). This places the prior modes of the standardized effect size \(\mu/\sigma_0\) at \(0.3\) and \(-0.3\).

sigma0

Positive numeric. Known standard deviation in the population. Default: 1.

RejectH1.threshold

Positive numeric. \(H_0\) is accepted if \(BF \le\)RejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. \(H_0\) is rejected if \(BF \ge\)RejectH0.threshold. Default: exp(3).

batch.size

Integer vector. The vector of batch sizes at each sequential comparison. Default: rep(1, length(obs)).

return.plot

Logical. Whether a sequential comparison plot to be returned. Default: TRUE.

until.decision.reached

Logical. Whether the sequential comparison is performed until a decision is reached or until the data is observed. Default: TRUE. This means the comparison is performed until a decision is reached.

Value

A list with three components named N, BF, and decision.

$N contains the number of sample size used.

$BF contains the Bayes factor values at each sequential comparison.

$decision contains the decision reached. 'A' indicates acceptance of \(H_0\), 'R' indicates rejection of \(H_0\), and 'I' indicates inconclusive.

References

Pramanik, S. and Johnson, V. (2022). Efficient Alternatives for Bayesian Hypothesis Tests in Psychology. Psychological Methods. Just accepted.

Johnson, V. and Rossell, R. (2010). On the use of non-local prior densities in Bayesian hypothesis tests. Journal of the Royal Statistical Society: Series B, 72:143-170. [Article]

Examples

Run this code
# NOT RUN {
out = implement.SBFNAP_onez(obs = rnorm(100))
# }

Run the code above in your browser using DataLab