Learn R Programming

NAP (version 1.1)

fixedNAP.twot_n: Fixed-design two-sample \(t\)-tests with NAP and a pre-fixed sample size

Description

In two-sided fixed design two-sample \(t\)-tests with normal moment prior assumed on the difference between standardized effect sizes \((\mu_2 - \mu_1)/\sigma\) under the alternative and a prefixed sample size, this function calculates the expected weights of evidence (that is, expected log(Bayes Factor)) of the test at a varied range of differences between standardized effect sizes.

Usage

fixedNAP.twot_n(es = c(0, 0.2, 0.3, 0.5), n1.fixed = 20, n2.fixed = 20,
                tau.NAP = 0.3/sqrt(2), nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect size differences \((\mu_2 - \mu_1)/\sigma\) where the expected weights of evidence is desired. Default: c(0, 0.2, 0.3, 0.5).

n1.fixed

Positive integer. Prefixed sample size from Group-1. Default: 20.

n2.fixed

Positive integer. Prefixed sample size from Group-2. Default: 20.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: \(0.3/\sqrt{2}\). This places the prior modes of \((\mu_2 - \mu_1)/\sigma\) at \(0.3\) and \(-0.3\).

nReplicate

Positve integer. Number of replicated studies based on which the expected weights of evidence is calculated. Default: 50,000.

nCore

Positive integer. Default: One less than the total number of available cores.

Value

A list with two components named summary and BF.

$summary is a data frame with columns effect.size containing the values in es and avg.logBF containing the expected weight of evidence values at those values.

$BF is a matrix of dimension length(es) by nReplicate. Each row contains the Bayes factor values at the corresponding standardized effec size differences in nReplicate replicated studies.

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 = fixedNAP.twot_n(n1.fixed = 20, n2.fixed = 20, es = c(0, 0.3), nCore = 1)
# }

Run the code above in your browser using DataLab