In case of two independent populations \(N(\mu_1,\sigma^2)\) and \(N(\mu_2,\sigma^2)\) with unknown common variance \(\sigma^2\), consider the two-sample \(t\)-test for testing the point null hypothesis of difference in their means \(H_0 : \mu_2 - \mu_1 = 0\) against \(H_1 : \mu_2 - \mu_1 \neq 0\). Based on an observed data, this function calculates the Bayes factor in favor of \(H_1\) when a normal moment prior is assumed on the difference between standardized effect sizes \((\mu_2 - \mu_1)/\sigma\) under the alternative. Under both hypotheses, the Jeffrey's prior \(\pi(\sigma^2) \propto 1/\sigma^2\) is assumed on \(\sigma^2\).
NAPBF_twot(obs1, obs2, n1Obs, n2Obs,
mean.obs1, mean.obs2, sd.obs1, sd.obs2,
test.statistic, tau.NAP = 0.3/sqrt(2))
Numeric vector. Observed vector of data from Group-1.
Numeric vector. Observed vector of data from Group-2.
Numeric or numeric vector. Sample size(s) from Group-1. Same as length(obs1)
when numeric.
Numeric or numeric vector. Sample size(s) from Group-2. Same as length(obs2)
when numeric.
Numeric or numeric vector. Sample mean(s) from Group-1. Same as mean(obs1)
when numeric.
Numeric or numeric vector. Sample mean(s) from Group-2. Same as mean(obs2)
when numeric.
Numeric or numeric vector. Sample standard deviations(s) from Group-1. Same as sd(obs1)
when numeric.
Numeric or numeric vector. Sample standard deviations(s) from Group-2. Same as sd(obs2)
when numeric.
Numeric or numeric vector. Test-statistic value(s).
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\).
Positive numeric or numeric vector. The Bayes factor value(s).
A user can either specify obs1
and obs2
, or n1Obs
, n2Obs
, mean.obs1
, mean.obs2
, sd.obs1
and sd.obs2
, or n1Obs
, n2Obs
, and test.statistic
.
If obs1
and obs2
are provided, it returns the corresponding Bayes factor value.
If n1Obs
, n2Obs
, mean.obs1
, mean.obs2
, sd.obs1
and sd.obs2
are provided, the function is vectorized over the arguments. Bayes factor values corresponding to the values therein are returned.
If n1Obs
, n2Obs
, and test.statistic
are provided, the function is vectorized over each of the arguments. Bayes factor values corresponding to the values therein are returned.
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]
# NOT RUN {
NAPBF_twot(obs1 = rnorm(100), obs2 = rnorm(100))
# }
Run the code above in your browser using DataLab