Learn R Programming

NAP (version 1.1)

HajnalBF_twoz: Hajnal's ratio in two-sample \(z\) tests

Description

In case of two independent populations \(N(\mu_1,\sigma_0^2)\) and \(N(\mu_2,\sigma_0^2)\) with known common variance \(\sigma_0^2\), consider the two-sample \(z\)-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 Hajnal's ratio in favor of \(H_1\) when the prior assumed under the alternative on the difference between standardized effect sizes \((\mu_2 - \mu_1)/\sigma_0\) places equal probability at \(+\delta\) and \(-\delta\) (\(\delta>0\) prefixed).

Usage

HajnalBF_twoz(obs1, obs2, n1Obs, n2Obs, mean.obs1, mean.obs2, 
              test.statistic, es1 = 0.3, sigma0 = 1)

Arguments

obs1

Numeric vector. Observed vector of data from Group-1.

obs2

Numeric vector. Observed vector of data from Group-2.

n1Obs

Numeric or numeric vector. Sample size(s) from Group-1. Same as length(obs1) when numeric.

n2Obs

Numeric or numeric vector. Sample size(s) from Group-2. Same as length(obs2) when numeric.

mean.obs1

Numeric or numeric vector. Sample mean(s) from Group-1. Same as mean(obs1) when numeric.

mean.obs2

Numeric or numeric vector. Sample mean(s) from Group-2. Same as mean(obs2) when numeric.

test.statistic

Numeric or numeric vector. Test-statistic value(s).

es1

Positive numeric. \(\delta\) as above. Default: \(0.3\). For this, the prior on \((\mu_2 - \mu_1)/\sigma_0\) takes values \(0.3\) and \(-0.3\) each with equal probability 1/2.

sigma0

Positive numeric. Known common standard deviation of the populations. Default: 1.

Value

Positive numeric or numeric vector. The Hajnal's ratio(s).

Details

  • A user can either specify obs1 and obs2, or n1Obs, n2Obs, mean.obs1 and mean.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 and mean.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.

References

Hajnal, J. (1961). A two-sample sequential t-test.Biometrika, 48:65-75, [Article].

Schnuerch, M. and Erdfelder, E. (2020). A two-sample sequential t-test.Biometrika, 48:65-75, [Article].

Examples

Run this code
# NOT RUN {
HajnalBF_twoz(obs1 = rnorm(100), obs2 = rnorm(100))
# }

Run the code above in your browser using DataLab