Package 'NAP'

Title: Non-Local Alternative Priors in Psychology
Description: Conducts Bayesian Hypothesis tests of a point null hypothesis against a two-sided alternative using Non-local Alternative Prior (NAP) for one- and two-sample z- and t-tests (Pramanik and Johnson, 2022). Under the alternative, the NAP is assumed on the standardized effects size in one-sample tests and on their differences in two-sample tests. The package considers two types of NAP densities: (1) the normal moment prior, and (2) the composite alternative. In fixed design tests, the functions calculate the Bayes factors and the expected weight of evidence for varied effect size and sample size. The package also provides a sequential testing framework using the Sequential Bayes Factor (SBF) design. The functions calculate the operating characteristics (OC) and the average sample number (ASN), and also conducts sequential tests for a sequentially observed data.
Authors: Sandipan Pramanik [aut, cre], Valen E. Johnson [aut]
Maintainer: Sandipan Pramanik <[email protected]>
License: GPL (>= 2)
Version: 1.1
Built: 2024-11-26 06:26:02 UTC
Source: CRAN

Help Index


Non-Local Alternative Priors in Psychology

Description

Conducts Bayesian Hypothesis tests of a point null hypothesis against a two-sided alternative using Non-local Alternative Prior (NAP) for one- and two-sample z- and t-tests (Pramanik and Johnson, 2022). Under the alternative, the NAP is assumed on the standardized effects size in one-sample tests and on their differences in two-sample tests. The package considers two types of NAP densities: (1) the normal moment prior, and (2) the composite alternative. In fixed design tests, the functions calculate the Bayes factors and the expected weight of evidence for varied effect size and sample size. The package also provides a sequential testing framework using the Sequential Bayes Factor (SBF) design. The functions calculate the operating characteristics (OC) and the average sample number (ASN), and also conducts sequential tests for a sequentially observed data.

Details

Package: NAP
Type: Package
Version: 1.1
Date: 2022-1-6
License: GPL (>= 2)

Author(s)

Sandipan Pramanik [aut, cre], Valen E. Johnson [aut]

Maintainer: Sandipan Pramanik <[email protected]>

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]


Fixed-design one-sample tt-tests using Hajnal's ratio for varied sample sizes

Description

In two-sided fixed design one-sample tt-tests with composite alternative prior assumed on the standardized effect size μ/σ\mu/\sigma under the alternative, this function calculates the expected log(Hajnal's ratio) at a prefixed standardized effect size for a varied range of sample sizes.

Usage

fixedHajnal.onet_es(es = 0, es1 = 0.3, nmin = 20, nmax = 5000, 
                    batch.size.increment, nReplicate = 50000)

Arguments

es

Numeric. Standardized effect size where the expected weights of evidence is desired. Default: 0.

es1

Positive numeric. Default: 0.30.3. For this, the composite alternative prior on the standardized effect size μ/σ\mu/\sigma takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

nmin

Positive integer. Minimum sample size to be considered. Default: 20.

nmax

Positive integer. Maximum sample size to be considered. Default: 5000.

batch.size.increment

Positive numeric. Increment in sample size. The sequence of sample size thus considered for the fixed design test is from nmin to nmax with an increment of batch.size.increment. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

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

Value

A list with two components named summary and BF.

$summary is a data frame with columns n containing the values of sample sizes and avg.logBF containing the expected log(Hajnal's ratios) at those values.

$BF is a matrix of dimension number of sample sizes considered by nReplicate. Each row contains the Hajnal's ratios at the corresponding sample size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedHajnal.onet_es(nmax = 100)

Fixed-design one-sample tt-tests using Hajnal's ratio and a pre-fixed sample size

Description

In two-sided fixed design one-sample tt-tests with composite alternative prior assumed on the standardized effect size μ/σ\mu/\sigma under the alternative and a prefixed sample size, this function calculates the expected log(Hajnal's ratio) at a varied range of standardized effect sizes.

Usage

fixedHajnal.onet_n(es1 = 0.3, es = c(0, 0.2, 0.3, 0.5), 
                   n.fixed = 20, 
                   nReplicate = 50000, nCore)

Arguments

es1

Positive numeric. Default: 0.30.3. For this, the composite alternative prior on the standardized effect size μ/σ\mu/\sigma takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

es

Numeric vector. Standardized effect sizes μ/σ\mu/\sigma where the expected weights of evidence is desired. Default: c(0, 0.2, 0.3, 0.5).

n.fixed

Positive integer. Prefixed sample size. Default: 20.

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 log(Hajnal's ratios) at those values.

$BF is a matrix of dimension length(es) by nReplicate. Each row contains the Hajnal's ratios at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedHajnal.onet_n(n.fixed = 20, es = c(0, 0.3), nCore = 1)

Fixed-design one-sample zz-tests using Hajnal's ratio for varied sample sizes

Description

In two-sided fixed design one-sample zz-tests with composite alternative prior assumed on the standardized effect size μ/σ0\mu/\sigma_0 under the alternative, this function calculates the expected log(Hajnal's ratio) at a prefixed standardized effect size for a varied range of sample sizes.

Usage

fixedHajnal.onez_es(es = 0, es1 = 0.3, nmin = 20, nmax = 5000, 
                    sigma0 = 1, batch.size.increment, nReplicate = 50000)

Arguments

es

Numeric. Standardized effect size where the expected weights of evidence is desired. Default: 0.

es1

Positive numeric. Default: 0.30.3. For this, the composite alternative prior on the standardized effect size μ/σ0\mu/\sigma_0 takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

nmin

Positive integer. Minimum sample size to be considered. Default: 20.

nmax

Positive integer. Maximum sample size to be considered. Default: 5000.

sigma0

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

batch.size.increment

function. Increment in sample size. The sequence of sample size thus considered for the fixed design test is from nmin to nmax with an increment of batch.size.increment. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

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

Value

A list with two components named summary and BF.

$summary is a data frame with columns n containing the values of sample sizes and avg.logBF containing the expected log(Hajnal's ratios) at those values.

$BF is a matrix of dimension number of sample sizes considered by nReplicate. Each row contains the Hajnal's ratios at the corresponding sample size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedHajnal.onez_es(nmax = 100)

Fixed-design one-sample zz-tests using Hajnal's ratio and a pre-fixed sample size

Description

In two-sided fixed design one-sample zz-tests with composite alternative prior assumed on the standardized effect size μ/σ0\mu/\sigma_0 under the alternative and a prefixed sample size, this function calculates the expected log(Hajnal's ratio) at a varied range of standardized effect sizes.

Usage

fixedHajnal.onez_n(es1 = 0.3, es = c(0, 0.2, 0.3, 0.5), 
                   n.fixed = 20, sigma0 = 1,
                   nReplicate = 50000, nCore)

Arguments

es1

Positive numeric. Default: 0.30.3. For this, the composite alternative prior on the standardized effect size μ/σ0\mu/\sigma_0 takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

es

Numeric vector. Standardized effect sizes μ/σ0\mu/\sigma_0 where the expected weights of evidence is desired. Default: c(0, 0.2, 0.3, 0.5).

n.fixed

Positive integer. Prefixed sample size. Default: 20.

sigma0

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

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 log(Hajnal's ratios) at those values.

$BF is a matrix of dimension length(es) by nReplicate. Each row contains the Hajnal's ratios at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedHajnal.onez_n(n.fixed = 20, es = c(0, 0.3), nCore = 1)

Fixed-design two-sample tt-tests with NAP for varied sample sizes

Description

In two-sided fixed design two-sample tt-tests with composite alternative prior assumed on the difference between standardized effect sizes (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma under the alternative, this function calculates the expected log(Hajnal's ratio) at a prefixed standardized effect size for a varied range of sample sizes.

Usage

fixedHajnal.twot_es(es = 0, es1 = 0.3, n1min = 20, n2min = 20, 
                    n1max = 5000, n2max = 5000, 
                    batch1.size.increment, batch2.size.increment, 
                    nReplicate = 50000)

Arguments

es

Numeric. Difference between standardized effect sizes where the expected weights of evidence is desired. Default: 0.

es1

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

n1min

Positive integer. Minimum sample size from Grpup-1 to be considered. Default: 20.

n2min

Positive integer. Minimum sample size from Grpup-2 to be considered. Default: 20.

n1max

Positive integer. Maximum sample size from Grpup-1 to be considered. Default: 5000.

n2max

Positive integer. Maximum sample size from Grpup-2 to be considered. Default: 5000.

batch1.size.increment

Positive numeric. Increment in sample size from Group-1. The sequence of sample size thus considered from Group-1 for the fixed design test is from n1min to n1max with an increment of batch1.size.increment. Default: function(narg){20}. This means an increment of 20 samples from Group-1 at each step.

batch2.size.increment

Positive numeric. Increment in sample size from Group-2. The sequence of sample size thus considered from Group-2 for the fixed design test is from n2min to n2max with an increment of batch2.size.increment. Default: function(narg){20}. This means an increment of 20 samples from Group-2 at each step.

nReplicate

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

Value

A list with two components named summary and BF.

$summary is a data frame with columns n containing the values of sample sizes and avg.logBF containing the expected log(Hajnal's ratios) at those values.

$BF is a matrix of dimension number of sample sizes considered by nReplicate. Each row contains the Hajnal's ratios at the corresponding sample size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedHajnal.twot_es(n1max = 100, n2max = 100)

Fixed-design two-sample tt-tests using Hajnal's ratio and a pre-fixed sample size

Description

In two-sided fixed design two-sample tt-tests with composite alternative prior assumed on the standardized effect size (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma under the alternative and a prefixed sample size, this function calculates the expected log(Hajnal's ratio) at a varied range of differences between standardized effect sizes.

Usage

fixedHajnal.twot_n(es1 = 0.3, es = c(0, 0.2, 0.3, 0.5), 
                   n1.fixed = 20, n2.fixed = 20, 
                   nReplicate = 50000, nCore)

Arguments

es1

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

es

Numeric vector. Standardized effect size differences (μ2μ1)/σ(\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.

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 log(Hajnal's ratios) at those values.

$BF is a matrix of dimension length(es) by nReplicate. Each row contains the Hajnal's ratios at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedHajnal.twot_n(n1.fixed = 20, n2.fixed = 20, es = c(0, 0.3), nCore = 1)

Fixed-design two-sample zz-tests with NAP for varied sample sizes

Description

In two-sided fixed design two-sample zz-tests with composite alternative prior assumed on the difference between standardized effect sizes (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 under the alternative, this function calculates the expected log(Hajnal's ratio) at a prefixed standardized effect size for a varied range of sample sizes.

Usage

fixedHajnal.twoz_es(es = 0, es1 = 0.3, n1min = 20, n2min = 20, 
                    n1max = 5000, n2max = 5000, sigma0 = 1, 
                    batch1.size.increment, batch2.size.increment, 
                    nReplicate = 50000)

Arguments

es

Numeric. Difference between standardized effect sizes where the expected weights of evidence is desired. Default: 0.

es1

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

n1min

Positive integer. Minimum sample size from Grpup-1 to be considered. Default: 20.

n2min

Positive integer. Minimum sample size from Grpup-2 to be considered. Default: 20.

n1max

Positive integer. Maximum sample size from Grpup-1 to be considered. Default: 5000.

n2max

Positive integer. Maximum sample size from Grpup-2 to be considered. Default: 5000.

sigma0

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

batch1.size.increment

Positive numeric. Increment in sample size from Group-1. The sequence of sample size thus considered from Group-1 for the fixed design test is from n1min to n1max with an increment of batch1.size.increment. Default: function(narg){20}. This means an increment of 20 samples from Group-1 at each step.

batch2.size.increment

Positive numeric. Increment in sample size from Group-2. The sequence of sample size thus considered from Group-2 for the fixed design test is from n2min to n2max with an increment of batch2.size.increment. Default: function(narg){20}. This means an increment of 20 samples from Group-2 at each step.

nReplicate

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

Value

A list with two components named summary and BF.

$summary is a data frame with columns n containing the values of sample sizes and avg.logBF containing the expected log(Hajnal's ratios) at those values.

$BF is a matrix of dimension number of sample sizes considered by nReplicate. Each row contains the Hajnal's ratios at the corresponding sample size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedHajnal.twoz_es(n1max = 100, n2max = 100)

Fixed-design two-sample zz-tests using Hajnal's ratio and a pre-fixed sample size

Description

In two-sided fixed design two-sample zz-tests with composite alternative prior assumed on the standardized effect size (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 under the alternative and a prefixed sample size, this function calculates the expected log(Hajnal's ratio) at a varied range of differences between standardized effect sizes.

Usage

fixedHajnal.twoz_n(es1 = 0.3, es = c(0, 0.2, 0.3, 0.5), 
                   n1.fixed = 20, n2.fixed = 20, sigma0 = 1,
                   nReplicate = 50000, nCore)

Arguments

es1

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

es

Numeric vector. Standardized effect size differences (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 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.

sigma0

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

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 log(Hajnal's ratios) at those values.

$BF is a matrix of dimension length(es) by nReplicate. Each row contains the Hajnal's ratios at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedHajnal.twoz_n(n1.fixed = 20, n2.fixed = 20, es = c(0, 0.3), nCore = 1)

Fixed-design one-sample tt-tests with NAP for varied sample sizes

Description

In two-sided fixed design one-sample tt-tests with normal moment prior assumed on the standardized effect size μ/σ\mu/\sigma under the alternative, this function calculates the expected weights of evidence (that is, expected log(Bayes Factor)) of the test at a prefixed standardized effect size for a varied range of sample sizes.

Usage

fixedNAP.onet_es(es = 0, nmin = 20, nmax = 5000, 
                 tau.NAP = 0.3/sqrt(2),
                 batch.size.increment, nReplicate = 50000)

Arguments

es

Numeric. Standardized effect size where the expected weights of evidence is desired. Default: 0.

nmin

Positive integer. Minimum sample size to be considered. Default: 20.

nmax

Positive integer. Maximum sample size to be considered. Default: 5000.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ\mu/\sigma at 0.30.3 and 0.3-0.3.

batch.size.increment

Positive numeric. Increment in sample size. The sequence of sample size thus considered for the fixed design test is from nmin to nmax with an increment of batch.size.increment. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

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

Value

A list with two components named summary and BF.

$summary is a data frame with columns n containing the values of sample sizes and avg.logBF containing the expected weight of evidence values at those values.

$BF is a matrix of dimension number of sample sizes considered by nReplicate. Each row contains the Bayes factor values at the corresponding sample size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedNAP.onet_es(nmax = 100)

Fixed-design one-sample tt-tests with NAP and a pre-fixed sample size

Description

In two-sided fixed design one-sample tt-tests with normal moment prior assumed on the standardized effect size μ/σ\mu/\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 standardized effect sizes.

Usage

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

Arguments

es

Numeric vector. Standardized effect sizes μ/σ\mu/\sigma where the expected weights of evidence is desired. Default: c(0, 0.2, 0.3, 0.5).

n.fixed

Positive integer. Prefixed sample size. Default: 20.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ\mu/\sigma at 0.30.3 and 0.3-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 in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedNAP.onet_n(n.fixed = 20, es = c(0, 0.3), nCore = 1)

Fixed-design one-sample zz-tests with NAP for varied sample sizes

Description

In two-sided fixed design one-sample zz-tests with normal moment prior assumed on the standardized effect size μ/σ0\mu/\sigma_0 under the alternative, this function calculates the expected weights of evidence (that is, expected log(Bayes Factor)) of the test at a prefixed standardized effect size for a varied range of sample sizes.

Usage

fixedNAP.onez_es(es = 0, nmin = 20, nmax = 5000, 
                 tau.NAP = 0.3/sqrt(2), sigma0 = 1, 
                 batch.size.increment, nReplicate = 50000)

Arguments

es

Numeric. Standardized effect size where the expected weights of evidence is desired. Default: 0.

nmin

Positive integer. Minimum sample size to be considered. Default: 20.

nmax

Positive integer. Maximum sample size to be considered. Default: 5000.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ0\mu/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

batch.size.increment

function. Increment in sample size. The sequence of sample size thus considered for the fixed design test is from nmin to nmax with an increment of batch.size.increment. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

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

Value

A list with two components named summary and BF.

$summary is a data frame with columns n containing the values of sample sizes and avg.logBF containing the expected weight of evidence values at those values.

$BF is a matrix of dimension number of sample sizes considered by nReplicate. Each row contains the Bayes factor values at the corresponding sample size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedNAP.onez_es(nmax = 100)

Fixed-design one-sample zz-tests with NAP and a pre-fixed sample size

Description

In two-sided fixed design one-sample zz-tests with normal moment prior assumed on the standardized effect size μ/σ0\mu/\sigma_0 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 standardized effect sizes.

Usage

fixedNAP.onez_n(es = c(0, 0.2, 0.3, 0.5), n.fixed = 20, 
                tau.NAP = 0.3/sqrt(2), sigma0 = 1, 
                nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect sizes μ/σ0\mu/\sigma_0 where the expected weights of evidence is desired. Default: c(0, 0.2, 0.3, 0.5).

n.fixed

Positive integer. Prefixed sample size. Default: 20.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ0\mu/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

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 in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedNAP.onez_n(n.fixed = 20, es = c(0, 0.3), nCore = 1)

Fixed-design two-sample tt-tests with NAP for varied sample sizes

Description

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

Usage

fixedNAP.twot_es(es = 0, n1min = 20, n2min = 20, 
                 n1max = 5000, n2max = 5000, 
                 tau.NAP = 0.3/sqrt(2), 
                 batch1.size.increment, batch2.size.increment, 
                 nReplicate = 50000)

Arguments

es

Numeric. Difference between standardized effect sizes where the expected weights of evidence is desired. Default: 0.

n1min

Positive integer. Minimum sample size from Grpup-1 to be considered. Default: 20.

n2min

Positive integer. Minimum sample size from Grpup-2 to be considered. Default: 20.

n1max

Positive integer. Maximum sample size from Grpup-1 to be considered. Default: 5000.

n2max

Positive integer. Maximum sample size from Grpup-2 to be considered. Default: 5000.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma at 0.30.3 and 0.3-0.3.

batch1.size.increment

Positive numeric. Increment in sample size from Group-1. The sequence of sample size thus considered from Group-1 for the fixed design test is from n1min to n1max with an increment of batch1.size.increment. Default: function(narg){20}. This means an increment of 20 samples from Group-1 at each step.

batch2.size.increment

Positive numeric. Increment in sample size from Group-2. The sequence of sample size thus considered from Group-2 for the fixed design test is from n2min to n2max with an increment of batch2.size.increment. Default: function(narg){20}. This means an increment of 20 samples from Group-2 at each step.

nReplicate

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

Details

n1min, n1max, batch1.size.increment, and n2min, n2max, batch2.size.increment should be chosen such that the length of sample sizes considered from Group 1 and 2 are equal.

Value

A list with two components named summary and BF.

$summary is a data frame with columns n1 containing the sample sizes from Group-1, n2 containing the sample sizes from Group-2, and avg.logBF containing the expected weight of evidence values at those values.

$BF is a matrix of dimension number of sample sizes considered by nReplicate. Each row contains the Bayes factor values at the corresponding sample size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedNAP.twot_es(n1max = 100, n2max = 100)

Fixed-design two-sample tt-tests with NAP and a pre-fixed sample size

Description

In two-sided fixed design two-sample tt-tests with normal moment prior assumed on the difference between standardized effect sizes (μ2μ1)/σ(\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 (μ2μ1)/σ(\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/20.3/\sqrt{2}. This places the prior modes of (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma at 0.30.3 and 0.3-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.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedNAP.twot_n(n1.fixed = 20, n2.fixed = 20, es = c(0, 0.3), nCore = 1)

Fixed-design two-sample zz-tests with NAP for varied sample sizes

Description

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

Usage

fixedNAP.twoz_es(es = 0, n1min = 20, n2min = 20, 
                 n1max = 5000, n2max = 5000, 
                 tau.NAP = 0.3/sqrt(2), sigma0 = 1, 
                 batch1.size.increment, batch2.size.increment, 
                 nReplicate = 50000)

Arguments

es

Numeric. Difference between standardized effect sizes where the expected weights of evidence is desired. Default: 0.

n1min

Positive integer. Minimum sample size from Grpup-1 to be considered. Default: 20.

n2min

Positive integer. Minimum sample size from Grpup-2 to be considered. Default: 20.

n1max

Positive integer. Maximum sample size from Grpup-1 to be considered. Default: 5000.

n2max

Positive integer. Maximum sample size from Grpup-2 to be considered. Default: 5000.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

batch1.size.increment

Positive numeric. Increment in sample size from Group-1. The sequence of sample size thus considered from Group-1 for the fixed design test is from n1min to n1max with an increment of batch1.size.increment. Default: function(narg){20}. This means an increment of 20 samples from Group-1 at each step.

batch2.size.increment

Positive numeric. Increment in sample size from Group-2. The sequence of sample size thus considered from Group-2 for the fixed design test is from n2min to n2max with an increment of batch2.size.increment. Default: function(narg){20}. This means an increment of 20 samples from Group-2 at each step.

nReplicate

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

Details

n1min, n1max, batch1.size.increment, and n2min, n2max, batch2.size.increment should be chosen such that the length of sample sizes considered from Group 1 and 2 are equal.

Value

A list with two components named summary and BF.

$summary is a data frame with columns n1 containing the sample sizes from Group-1, n2 containing the sample sizes from Group-2, and avg.logBF containing the expected weight of evidence values at those values.

$BF is a matrix of dimension number of sample sizes considered by nReplicate. Each row contains the Bayes factor values at the corresponding sample size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedNAP.twoz_es(n1max = 100, n2max = 100)

Fixed-design two-sample zz-tests with NAP and a pre-fixed sample size

Description

In two-sided fixed design two-sample zz-tests with normal moment prior assumed on the difference between standardized effect sizes (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 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.twoz_n(es = c(0, 0.2, 0.3, 0.5), n1.fixed = 20, n2.fixed = 20,
                tau.NAP = 0.3/sqrt(2), sigma0 = 1, 
                nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect size differences (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 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/20.3/\sqrt2. This places the prior modes of (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

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.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = fixedNAP.twoz_n(n1.fixed = 20, n2.fixed = 20, es = c(0, 0.3), nCore = 1)

Hajnal's ratio in one-sample tt tests

Description

In a N(μ,σ2)N(\mu,\sigma^2) population with unknown variance σ2\sigma^2, consider the two-sided one-sample zz-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. Based on an observed data, this function calculates the Hajnal's ratio in favor of H1H_1 when the prior assumed on the standardized effect size μ/σ\mu/\sigma under the alternative places equal probability at +δ+\delta and δ-\delta (δ>0\delta>0 prefixed).

Usage

HajnalBF_onet(obs, nObs, mean.obs, sd.obs, test.statistic, es1 = 0.3)

Arguments

obs

Numeric vector. Observed vector of data.

nObs

Numeric or numeric vector. Sample size(s). Same as length(obs) when numeric.

mean.obs

Numeric or numeric vector. Sample mean(s). Same as mean(obs) when numeric.

sd.obs

Positive numeric or numeric vector. Sample standard deviation(s). Same as sd(obs) when numeric.

test.statistic

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

es1

Positive numeric. δ\delta as above. Default: 0.30.3. For this, the prior on the standardized effect size μ/σ\mu/\sigma takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

Details

  • Users can either specify obs, or nObs, mean.obs and sd.obs, or nObs and test.statistic.

  • If obs is provided, it returns the corresponding Bayes factor value.

  • If nObs, mean.obs and sd.obs are provided, the function is vectorized over the arguments. Bayes factor values corresponding to the values therein are returned.

  • If nObs and test.statistic are provided, the function is vectorized over the arguments. Bayes factor values corresponding to the values therein are returned.

Value

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

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

HajnalBF_onet(obs = rnorm(100))

Hajnal's ratio in one-sample zz tests

Description

In a N(μ,σ02)N(\mu,\sigma_0^2) population with known variance σ02\sigma_0^2, consider the two-sided one-sample zz-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. Based on an observed data, this function calculates the Hajnal's ratio in favor of H1H_1 when the prior assumed on the standardized effect size μ/σ0\mu/\sigma_0 under the alternative places equal probability at +δ+\delta and δ-\delta (δ>0\delta>0 prefixed).

Usage

HajnalBF_onez(obs, nObs, mean.obs, test.statistic, 
              es1 = 0.3, sigma0 = 1)

Arguments

obs

Numeric vector. Observed vector of data.

nObs

Numeric or numeric vector. Sample size(s). Same as length(obs) when numeric.

mean.obs

Numeric or numeric vector. Sample mean(s). Same as mean(obs) when numeric.

test.statistic

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

es1

Positive numeric. δ\delta as above. Default: 0.30.3. For this, the prior on the standardized effect size μ/σ0\mu/\sigma_0 takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

sigma0

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

Details

  • Users can either specify obs, or nObs and mean.obs, or nObs and test.statistic.

  • If obs is provided, it returns the corresponding Bayes factor value.

  • If nObs and mean.obs are provided, the function is vectorized over both arguments. Bayes factor values corresponding to the values therein are returned.

  • If nObs and test.statistic are provided, the function is vectorized over both arguments. Bayes factor values corresponding to the values therein are returned.

Value

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

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

HajnalBF_onez(obs = rnorm(100))

Hajnal's ratio in two-sample tt tests

Description

In case of two independent populations N(μ1,σ2)N(\mu_1,\sigma^2) and N(μ2,σ2)N(\mu_2,\sigma^2) with unknown common variance σ2\sigma^2, consider the two-sample tt-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. Based on an observed data, this function calculates the Hajnal's ratio in favor of H1H_1 when the prior assumed under the alternative on the difference between standardized effect sizes (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma places equal probability at +δ+\delta and δ-\delta (δ>0\delta>0 prefixed).

Usage

HajnalBF_twot(obs1, obs2, n1Obs, n2Obs, mean.obs1, mean.obs2,
              sd.obs1, sd.obs2, test.statistic, es1 = 0.3)

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.

sd.obs1

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

sd.obs2

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

test.statistic

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

es1

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

Details

  • 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.

Value

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

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

HajnalBF_twot(obs1 = rnorm(100), obs2 = rnorm(100))

Hajnal's ratio in two-sample zz tests

Description

In case of two independent populations N(μ1,σ02)N(\mu_1,\sigma_0^2) and N(μ2,σ02)N(\mu_2,\sigma_0^2) with known common variance σ02\sigma_0^2, consider the two-sample zz-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. Based on an observed data, this function calculates the Hajnal's ratio in favor of H1H_1 when the prior assumed under the alternative on the difference between standardized effect sizes (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 places equal probability at +δ+\delta and δ-\delta (δ>0\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.30.3. For this, the prior on (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

sigma0

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

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.

Value

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

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

HajnalBF_twoz(obs1 = rnorm(100), obs2 = rnorm(100))

Implement Sequential Bayes Factor using the Hajnal's ratio for one-sample tt-tests

Description

In a N(μ,σ2)N(\mu,\sigma^2) population with unknown variance σ2\sigma^2, consider the two-sided one-sample tt-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. For a sequentially observed data, this function implements the Sequential Bayes Factor design when the prior assumed on the standardized effect size μ/σ\mu/\sigma under the alternative places equal probability at +δ+\delta and δ-\delta (δ>0\delta>0 prefixed).

Usage

implement.SBFHajnal_onet(obs, es1 = 0.3, 
                         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.

es1

Positive numeric. δ\delta as above. Default: 0.30.3. For this, the prior on the standardized effect size μ/σ\mu/\sigma takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch.size

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

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 H0H_0, 'R' indicates rejection of H0H_0, and 'I' indicates inconclusive.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = implement.SBFHajnal_onet(obs = rnorm(100))

Implement Sequential Bayes Factor using the Hajnal's ratio for one-sample zz-tests

Description

In a N(μ,σ02)N(\mu,\sigma_0^2) population with known variance σ02\sigma_0^2, consider the two-sided one-sample zz-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. For a sequentially observed data, this function implements the Sequential Bayes Factor design when the prior assumed on the standardized effect size μ/σ0\mu/\sigma_0 under the alternative places equal probability at +δ+\delta and δ-\delta (δ>0\delta>0 prefixed).

Usage

implement.SBFHajnal_onez(obs, es1 = 0.3, sigma0 = 1, 
                         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.

es1

Positive numeric. δ\delta as above. Default: 0.30.3. For this, the prior on the standardized effect size μ/σ0\mu/\sigma_0 takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

sigma0

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.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 H0H_0, 'R' indicates rejection of H0H_0, and 'I' indicates inconclusive.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = implement.SBFHajnal_onez(obs = rnorm(100))

Implement Sequential Bayes Factor using the NAP for two-sample tt-tests

Description

In case of two independent populations N(μ1,σ2)N(\mu_1,\sigma^2) and N(μ2,σ2)N(\mu_2,\sigma^2) with unknown common variance σ2\sigma^2, consider the two-sample tt-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. For a sequentially observed data, this function implements the Sequential Bayes Factor design when a normal moment prior is assumed on the difference between standardized effect sizes (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma under the alternative.

Usage

implement.SBFHajnal_twot(obs1, obs2, es1 = 0.3, 
                         RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3),
                         batch1.size, batch2.size, return.plot = TRUE, 
                         until.decision.reached = TRUE)

Arguments

obs1

Numeric vector. The vector of sequentially observed data from Group-1.

obs2

Numeric vector. The vector of sequentially observed data from Group-2.

es1

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch1.size

Integer vector. The vector of batch sizes from Group-1 at each sequential comparison. The first element (the first batch size) needs to be at least 2. Default: c(2, rep(1, length(obs1)-2)).

batch2.size

Integer vector. The vector of batch sizes from Group-2 at each sequential comparison. The first element (the first batch size) needs to be at least 2. Default: c(2, rep(1, length(obs2)-2)).

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 N1, N2, BF, and decision.

$N1 and $N2 contains the number of sample size used from Group-1 and 2.

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

$decision contains the decision reached. 'A' indicates acceptance of H0H_0, 'R' indicates rejection of H0H_0, and 'I' indicates inconclusive.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = implement.SBFHajnal_twot(obs1 = rnorm(100), obs2 = rnorm(100))

Implement Sequential Bayes Factor using the NAP for two-sample zz-tests

Description

In case of two independent populations N(μ1,σ02)N(\mu_1,\sigma_0^2) and N(μ2,σ02)N(\mu_2,\sigma_0^2) with known common variance σ02\sigma_0^2, consider the two-sample zz-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. For a sequentially observed data, this function implements the Sequential Bayes Factor design when a normal moment prior is assumed on the difference between standardized effect sizes (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 under the alternative.

Usage

implement.SBFHajnal_twoz(obs1, obs2, es1 = 0.3, sigma0 = 1,
                         RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3), 
                         batch1.size, batch2.size, return.plot = TRUE, 
                         until.decision.reached = TRUE)

Arguments

obs1

Numeric vector. The vector of sequentially observed data from Group-1.

obs2

Numeric vector. The vector of sequentially observed data from Group-2.

es1

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

sigma0

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch1.size

Integer vector. The vector of batch sizes from Group-1 at each sequential comparison. Default: rep(1, length(obs1)).

batch2.size

Integer vector. The vector of batch sizes from Group-2 at each sequential comparison. Default: rep(1, length(obs2)).

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 N1, N2, BF, and decision.

$N1 and $N2 contains the number of sample size used from Group-1 and 2.

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

$decision contains the decision reached. 'A' indicates acceptance of H0H_0, 'R' indicates rejection of H0H_0, and 'I' indicates inconclusive.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = implement.SBFHajnal_twoz(obs1 = rnorm(100), obs2 = rnorm(100))

Implement Sequential Bayes Factor using the NAP for one-sample tt-tests

Description

In a N(μ,σ2)N(\mu,\sigma^2) population with unknown variance σ2\sigma^2, consider the two-sided one-sample tt-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_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 under the alternative.

Usage

implement.SBFNAP_onet(obs, 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/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ\mu/\sigma at 0.30.3 and 0.3-0.3.

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch.size

Integer vector. The vector of batch sizes at each sequential comparison. The first element (the first batch size) needs to be at least 2. Default: c(2, rep(1, length(obs)-2)).

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 H0H_0, 'R' indicates rejection of H0H_0, and 'I' indicates inconclusive.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = implement.SBFNAP_onet(obs = rnorm(100))

Implement Sequential Bayes Factor using the NAP for one-sample zz-tests

Description

In a N(μ,σ02)N(\mu,\sigma_0^2) population with known variance σ02\sigma_0^2, consider the two-sided one-sample zz-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_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 μ/σ0\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/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ0\mu/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.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 H0H_0, 'R' indicates rejection of H0H_0, and 'I' indicates inconclusive.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = implement.SBFNAP_onez(obs = rnorm(100))

Implement Sequential Bayes Factor using the NAP for two-sample tt-tests

Description

In case of two independent populations N(μ1,σ2)N(\mu_1,\sigma^2) and N(μ2,σ2)N(\mu_2,\sigma^2) with unknown common variance σ2\sigma^2, consider the two-sample tt-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. For a sequentially observed data, this function implements the Sequential Bayes Factor design when a normal moment prior is assumed on the difference between standardized effect sizes (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma under the alternative.

Usage

implement.SBFNAP_twot(obs1, obs2, tau.NAP = 0.3/sqrt(2), 
                      RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3),
                      batch1.size, batch2.size, return.plot = TRUE,
                      until.decision.reached = TRUE)

Arguments

obs1

Numeric vector. The vector of sequentially observed data from Group-1.

obs2

Numeric vector. The vector of sequentially observed data from Group-2.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the difference between standardized effect sizes (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma at 0.30.3 and 0.3-0.3.

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch1.size

Integer vector. The vector of batch sizes from Group-1 at each sequential comparison. The first element (the first batch size) needs to be at least 2. Default: c(2, rep(1, length(obs1)-2)).

batch2.size

Integer vector. The vector of batch sizes from Group-2 at each sequential comparison. The first element (the first batch size) needs to be at least 2. Default: c(2, rep(1, length(obs2)-2)).

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 N1, N2, BF, and decision.

$N1 and $N2 contains the number of sample size used from Group-1 and 2.

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

$decision contains the decision reached. 'A' indicates acceptance of H0H_0, 'R' indicates rejection of H0H_0, and 'I' indicates inconclusive.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = implement.SBFNAP_twot(obs1 = rnorm(100), obs2 = rnorm(100))

Implement Sequential Bayes Factor using the NAP for two-sample zz-tests

Description

In case of two independent populations N(μ1,σ02)N(\mu_1,\sigma_0^2) and N(μ2,σ02)N(\mu_2,\sigma_0^2) with known common variance σ02\sigma_0^2, consider the two-sample zz-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. For a sequentially observed data, this function implements the Sequential Bayes Factor design when a normal moment prior is assumed on the difference between standardized effect sizes (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 under the alternative.

Usage

implement.SBFNAP_twoz(obs1, obs2, sigma0 = 1, tau.NAP = 0.3/sqrt(2),
                      RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3),
                      batch1.size, batch2.size, return.plot = TRUE, 
                      until.decision.reached = TRUE)

Arguments

obs1

Numeric vector. The vector of sequentially observed data from Group-1.

obs2

Numeric vector. The vector of sequentially observed data from Group-2.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the difference between standardized effect sizes (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch1.size

Integer vector. The vector of batch sizes from Group-1 at each sequential comparison. Default: rep(1, length(obs1)).

batch2.size

Integer vector. The vector of batch sizes from Group-2 at each sequential comparison. Default: rep(1, length(obs2)).

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 N1, N2, BF, and decision.

$N1 and $N2 contains the number of sample size used from Group-1 and 2.

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

$decision contains the decision reached. 'A' indicates acceptance of H0H_0, 'R' indicates rejection of H0H_0, and 'I' indicates inconclusive.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = implement.SBFNAP_twoz(obs1 = rnorm(100), obs2 = rnorm(100))

Helper function

Description

Helper function for combining outputs from replicated studies in fixed design tests.

Usage

mycombine.fixed(...)

Arguments

...

Lists. Outputs from different replicated studies.

Value

A list with two components combining the outputs from replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson


Helper function

Description

Helper function for combining outputs from replicated studies in one-sample tests using Sequential Bayes Factor.

Usage

mycombine.seq.onesample(...)

Arguments

...

Lists. Outputs from different replicated studies.

Value

A list with three components combining the outputs from replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson


Helper function

Description

Helper function for combining results in two-sample tests using Sequential Bayes Factor.

Usage

mycombine.seq.twosample(...)

Arguments

...

Lists. Outputs from different replicated studies.

Value

A list with four components combining the outputs from replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson


Bayes factor in favor of the NAP in one-sample tt tests

Description

In a N(μ,σ2)N(\mu,\sigma^2) population with unknown variance σ2\sigma^2, consider the two-sided one-sample tt-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. Based on an observed data, this function calculates the Bayes factor in favor of H1H_1 when a normal moment prior is assumed on the standardized effect size μ/σ\mu/\sigma under the alternative. Under both hypotheses, the Jeffrey's prior π(σ2)1/σ2\pi(\sigma^2) \propto 1/\sigma^2 is assumed on σ2\sigma^2.

Usage

NAPBF_onet(obs, nObs, mean.obs, sd.obs, 
           test.statistic, tau.NAP = 0.3/sqrt(2))

Arguments

obs

Numeric vector. Observed vector of data.

nObs

Numeric or numeric vector. Sample size(s). Same as length(obs) when numeric.

mean.obs

Numeric or numeric vector. Sample mean(s). Same as mean(obs) when numeric.

sd.obs

Positive numeric or numeric vector. Sample standard deviation(s). Same as sd(obs) when numeric.

test.statistic

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

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ\mu/\sigma at 0.30.3 and 0.3-0.3.

Details

  • Users can either specify obs, or nObs, mean.obs and sd.obs, or nObs and test.statistic.

  • If obs is provided, it returns the corresponding Bayes factor value.

  • If nObs, mean.obs and sd.obs are provided, the function is vectorized over the arguments. Bayes factor values corresponding to the values therein are returned.

  • If nObs and test.statistic are provided, the function is vectorized over the arguments. Bayes factor values corresponding to the values therein are returned.

Value

Positive numeric or numeric vector. The Bayes factor value(s).

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

NAPBF_onet(obs = rnorm(100))

Bayes factor in favor of the NAP in one-sample zz tests

Description

In a N(μ,σ02)N(\mu,\sigma_0^2) population with known variance σ02\sigma_0^2, consider the two-sided one-sample zz-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. Based on an observed data, this function calculates the Bayes factor in favor of H1H_1 when a normal moment prior is assumed on the standardized effect size μ/σ0\mu/\sigma_0 under the alternative.

Usage

NAPBF_onez(obs, nObs, mean.obs, test.statistic,
           tau.NAP = 0.3/sqrt(2), sigma0 = 1)

Arguments

obs

Numeric vector. Observed vector of data.

nObs

Numeric or numeric vector. Sample size(s). Same as length(obs) when numeric.

mean.obs

Numeric or numeric vector. Sample mean(s). Same as mean(obs) when numeric.

test.statistic

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

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ0\mu/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

Details

  • Users can either specify obs, or nObs and mean.obs, or nObs and test.statistic.

  • If obs is provided, it returns the corresponding Bayes factor value.

  • If nObs and mean.obs are provided, the function is vectorized over both arguments. Bayes factor values corresponding to the values therein are returned.

  • If nObs and test.statistic are provided, the function is vectorized over both arguments. Bayes factor values corresponding to the values therein are returned.

Value

Positive numeric or numeric vector. The Bayes factor value(s).

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

NAPBF_onez(obs = rnorm(100))

Bayes factor in favor of the NAP in two-sample tt tests

Description

In case of two independent populations N(μ1,σ2)N(\mu_1,\sigma^2) and N(μ2,σ2)N(\mu_2,\sigma^2) with unknown common variance σ2\sigma^2, consider the two-sample tt-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. Based on an observed data, this function calculates the Bayes factor in favor of H1H_1 when a normal moment prior is assumed on the difference between standardized effect sizes (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma under the alternative. Under both hypotheses, the Jeffrey's prior π(σ2)1/σ2\pi(\sigma^2) \propto 1/\sigma^2 is assumed on σ2\sigma^2.

Usage

NAPBF_twot(obs1, obs2, n1Obs, n2Obs, 
           mean.obs1, mean.obs2, sd.obs1, sd.obs2, 
           test.statistic, tau.NAP = 0.3/sqrt(2))

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.

sd.obs1

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

sd.obs2

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

test.statistic

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

tau.NAP

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

Details

  • 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.

Value

Positive numeric or numeric vector. The Bayes factor value(s).

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

NAPBF_twot(obs1 = rnorm(100), obs2 = rnorm(100))

Bayes factor in favor of the NAP in two-sample zz tests

Description

In case of two independent populations N(μ1,σ02)N(\mu_1,\sigma_0^2) and N(μ2,σ02)N(\mu_2,\sigma_0^2) with known common variance σ02\sigma_0^2, consider the two-sample zz-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. Based on an observed data, this function calculates the Bayes factor in favor of H1H_1 when a normal moment prior is assumed on the difference between standardized effect sizes (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 under the alternative.

Usage

NAPBF_twoz(obs1, obs2, n1Obs, n2Obs, 
           mean.obs1, mean.obs2, test.statistic, 
           tau.NAP = 0.3/sqrt(2), 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).

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt{2}. This places the prior modes of (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

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.

Value

Positive numeric or numeric vector. The Bayes factor value(s).

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

NAPBF_twoz(obs1 = rnorm(100), obs2 = rnorm(100))

Sequential Bayes Factor using the Hajnal's ratio for one-sample tt-tests

Description

In a N(μ,σ2)N(\mu,\sigma^2) population with unknown variance σ2\sigma^2, consider the two-sided one-sample tt-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. This function calculates the operating characteristics (OC) and average sample number (ASN) of the Sequential Bayes Factor design when the prior assumed on the standardized effect size μ/σ\mu/\sigma under the alternative places equal probability at +δ+\delta and δ-\delta (δ>0\delta>0 prefixed).

Usage

SBFHajnal_onet(es = c(0, 0.2, 0.3, 0.5), es1 = 0.3, 
               nmin = 2, nmax = 5000, 
               RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3), 
               batch.size.increment, nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect sizes μ/σ\mu/\sigma where OC and ASN are desired. Default: c(0, 0.2, 0.3, 0.5).

es1

Positive numeric. δ\delta as above. Default: 0.30.3. For this, the prior on the standardized effect size μ/σ\mu/\sigma takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

nmin

Positive integer. Minimum sample size in the sequential comparison. Should be at least 2. Default: 1.

nmax

Positive integer. Maximum sample size in the sequential comparison. Default: 1.

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch.size.increment

function. Increment in sample size at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

Positve integer. Number of replicated studies based on which the OC and ASN are calculated. Default: 50,000.

nCore

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

Value

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

$summary is a data frame with columns effect.size containing the values in es. At those values, acceptH0 contains the proportion of times H_0 is accepted, rejectH0 contains the proportion of times H_0 is rejected, inconclusive contains the proportion of times the test is inconclusive, ASN contains the ASN, and avg.logBF contains the expected weight of evidence values.

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

$N is a matrix of the same dimension as $BF. Each row contains the sample size required to reach a decision at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = SBFHajnal_onet(nmax = 50, es = c(0, 0.3), nCore = 1)

Sequential Bayes Factor using the Hajnal's ratio for one-sample zz-tests

Description

In a N(μ,σ02)N(\mu,\sigma_0^2) population with known variance σ02\sigma_0^2, consider the two-sided one-sample zz-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. This function calculates the operating characteristics (OC) and average sample number (ASN) of the Sequential Bayes Factor design when the prior assumed on the standardized effect size μ/σ0\mu/\sigma_0 under the alternative places equal probability at +δ+\delta and δ-\delta (δ>0\delta>0 prefixed).

Usage

SBFHajnal_onez(es = c(0, 0.2, 0.3, 0.5), es1 = 0.3, 
               nmin = 1, nmax = 5000, sigma0 = 1, 
               RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3), 
               batch.size.increment, nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect sizes μ/σ0\mu/\sigma_0 where OC and ASN are desired. Default: c(0, 0.2, 0.3, 0.5).

es1

Positive numeric. δ\delta as above. Default: 0.30.3. For this, the prior on the standardized effect size μ/σ0\mu/\sigma_0 takes values 0.30.3 and 0.3-0.3 each with equal probability 1/2.

nmin

Positive integer. Minimum sample size in the sequential comparison. Default: 1.

nmax

Positive integer. Maximum sample size in the sequential comparison. Default: 1.

sigma0

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch.size.increment

function. Increment in sample size at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

Positve integer. Number of replicated studies based on which the OC and ASN are calculated. Default: 50,000.

nCore

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

Value

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

$summary is a data frame with columns effect.size containing the values in es. At those values, acceptH0 contains the proportion of times H_0 is accepted, rejectH0 contains the proportion of times H_0 is rejected, inconclusive contains the proportion of times the test is inconclusive, ASN contains the ASN, and avg.logBF contains the expected weight of evidence values.

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

$N is a matrix of the same dimension as $BF. Each row contains the sample size required to reach a decision at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = SBFHajnal_onez(nmax = 100, es = c(0, 0.3), nCore = 1)

Sequential Bayes Factor using the Hajnal's ratio for two-sample tt-tests

Description

In case of two independent populations N(μ1,σ2)N(\mu_1,\sigma^2) and N(μ2,σ2)N(\mu_2,\sigma^2) with unknown common variance σ2\sigma^2, consider the two-sample tt-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. This function calculates the operating characteristics (OC) and average sample number (ASN) of the Sequential Bayes Factor design when the prior assumed under the alternative on the difference between standardized effect sizes (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma places equal probability at +δ+\delta and δ-\delta (δ>0\delta>0 prefixed).

Usage

SBFHajnal_twot(es = c(0, 0.2, 0.3, 0.5), es1 = 0.3, 
               n1min = 2, n2min = 2, n1max = 5000, n2max = 5000,
               RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3), 
               batch1.size.increment, batch2.size.increment, 
               nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect size differences (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma where OC and ASN are desired. Default: c(0, 0.2, 0.3, 0.5).

es1

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

n1min

Positive integer. Minimum sample size from Group-1 in the sequential comparison. Should be at least 2. Default: 1.

n2min

Positive integer. Minimum sample size from Group-2 in the sequential comparison. Should be at least 2. Default: 1.

n1max

Positive integer. Maximum sample size from Group-1 in the sequential comparison. Default: 1.

n2max

Positive integer. Maximum sample size from Group-2 in the sequential comparison. Default: 1.

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch1.size.increment

function. Increment in sample size from Group-1 at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

batch2.size.increment

function. Increment in sample size from Group-2 at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

Positve integer. Number of replicated studies based on which the OC and ASN are calculated. Default: 50,000.

nCore

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

Value

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

$summary is a data frame with columns effect.size containing the values in es. At those values, acceptH0 contains the proportion of times H_0 is accepted, rejectH0 contains the proportion of times H_0 is rejected, inconclusive contains the proportion of times the test is inconclusive, ASN contains the ASN, and avg.logBF contains the expected weight of evidence values.

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

$N is a matrix of the same dimension as $BF. Each row contains the sample size required to reach a decision at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = SBFHajnal_twot(n1max = 100, n2max = 100, es = c(0, 0.3), nCore = 1)

Sequential Bayes Factor using the Hajnal's ratio for two-sample zz-tests

Description

In case of two independent populations N(μ1,σ02)N(\mu_1,\sigma_0^2) and N(μ2,σ02)N(\mu_2,\sigma_0^2) with known common variance σ02\sigma_0^2, consider the two-sample zz-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. This function calculates the operating characteristics (OC) and average sample number (ASN) of the Sequential Bayes Factor design when the prior assumed under the alternative on the difference between standardized effect sizes (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 places equal probability at +δ+\delta and δ-\delta (δ>0\delta>0 prefixed).

Usage

SBFHajnal_twoz(es = c(0, 0.2, 0.3, 0.5), es1 = 0.3,
               n1min = 1, n2min = 1, n1max = 5000, n2max = 5000, sigma0 = 1, 
               RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3),
               batch1.size.increment, batch2.size.increment, 
               nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect size differences (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 where OC and ASN are desired. Default: c(0, 0.2, 0.3, 0.5).

es1

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

n1min

Positive integer. Minimum sample size from Group-1 in the sequential comparison. Default: 1.

n2min

Positive integer. Minimum sample size from Group-2 in the sequential comparison. Default: 1.

n1max

Positive integer. Maximum sample size from Group-1 in the sequential comparison. Default: 1.

n2max

Positive integer. Maximum sample size from Group-2 in the sequential comparison. Default: 1.

sigma0

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch1.size.increment

function. Increment in sample size from Group-1 at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

batch2.size.increment

function. Increment in sample size from Group-2 at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

Positve integer. Number of replicated studies based on which the OC and ASN are calculated. Default: 50,000.

nCore

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

Value

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

$summary is a data frame with columns effect.size containing the values in es. At those values, acceptH0 contains the proportion of times H_0 is accepted, rejectH0 contains the proportion of times H_0 is rejected, inconclusive contains the proportion of times the test is inconclusive, ASN contains the ASN, and avg.logBF contains the expected weight of evidence values.

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

$N is a matrix of the same dimension as $BF. Each row contains the sample size required to reach a decision at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = SBFHajnal_twoz(n1max = 100, n2max = 100, es = c(0, 0.3), nCore = 1)

Sequential Bayes Factor using the NAP for one-sample tt-tests

Description

In a N(μ,σ2)N(\mu,\sigma^2) population with unknown variance σ2\sigma^2, consider the two-sided one-sample tt-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. This function calculates the operating characteristics (OC) and average sample number (ASN) of the Sequential Bayes Factor design when a normal moment prior is assumed on the standardized effect size μ/σ\mu/\sigma under the alternative.

Usage

SBFNAP_onet(es = c(0, 0.2, 0.3, 0.5), nmin = 2, nmax = 5000, 
            tau.NAP = 0.3/sqrt(2), 
            RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3),
            batch.size.increment, nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect sizes μ/σ\mu/\sigma where OC and ASN are desired. Default: c(0, 0.2, 0.3, 0.5).

nmin

Positive integer. Minimum sample size in the sequential comparison. Should be at least 2. Default: 1.

nmax

Positive integer. Maximum sample size in the sequential comparison. Default: 1.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ\mu/\sigma at 0.30.3 and 0.3-0.3.

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch.size.increment

function. Increment in sample size at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

Positve integer. Number of replicated studies based on which the OC and ASN are calculated. Default: 50,000.

nCore

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

Value

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

$summary is a data frame with columns effect.size containing the values in es. At those values, acceptH0 contains the proportion of times H_0 is accepted, rejectH0 contains the proportion of times H_0 is rejected, inconclusive contains the proportion of times the test is inconclusive, ASN contains the ASN, and avg.logBF contains the expected weight of evidence values.

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

$N is a matrix of the same dimension as $BF. Each row contains the sample size required to reach a decision at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = SBFNAP_onet(nmax = 100, es = c(0, 0.3), nCore = 1)

Sequential Bayes Factor using the NAP for one-sample zz-tests

Description

In a N(μ,σ02)N(\mu,\sigma_0^2) population with known variance σ02\sigma_0^2, consider the two-sided one-sample zz-test for testing the point null hypothesis H0:μ=0H_0 : \mu = 0 against H1:μ0H_1 : \mu \neq 0. This function calculates the operating characteristics (OC) and average sample number (ASN) of the Sequential Bayes Factor design when a normal moment prior is assumed on the standardized effect size μ/σ0\mu/\sigma_0 under the alternative.

Usage

SBFNAP_onez(es = c(0, 0.2, 0.3, 0.5), nmin = 1, nmax = 5000, 
            tau.NAP = 0.3/sqrt(2), sigma0 = 1, 
            RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3), 
            batch.size.increment, nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect sizes μ/σ0\mu/\sigma_0 where OC and ASN are desired. Default: c(0, 0.2, 0.3, 0.5).

nmin

Positive integer. Minimum sample size in the sequential comparison. Default: 1.

nmax

Positive integer. Maximum sample size in the sequential comparison. Default: 1.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt2. This places the prior modes of the standardized effect size μ/σ0\mu/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch.size.increment

function. Increment in sample size at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

Positve integer. Number of replicated studies based on which the OC and ASN are calculated. Default: 50,000.

nCore

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

Value

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

$summary is a data frame with columns effect.size containing the values in es. At those values, acceptH0 contains the proportion of times H_0 is accepted, rejectH0 contains the proportion of times H_0 is rejected, inconclusive contains the proportion of times the test is inconclusive, ASN contains the ASN, and avg.logBF contains the expected weight of evidence values.

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

$N is a matrix of the same dimension as $BF. Each row contains the sample size required to reach a decision at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = SBFNAP_onez(nmax = 100, es = c(0, 0.3), nCore = 1)

Sequential Bayes Factor using the NAP for two-sample tt-tests

Description

In case of two independent populations N(μ1,σ2)N(\mu_1,\sigma^2) and N(μ2,σ2)N(\mu_2,\sigma^2) with unknown common variance σ2\sigma^2, consider the two-sample zz-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. This function calculates the operating characteristics (OC) and average sample number (ASN) of the Sequential Bayes Factor design when a normal moment prior is assumed on the difference between standardized effect sizes (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma under the alternative.

Usage

SBFNAP_twot(es = c(0, 0.2, 0.3, 0.5), n1min = 2, n2min = 2,
            n1max = 5000, n2max = 5000,
            tau.NAP = 0.3/sqrt(2), 
            RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3),
            batch1.size.increment, batch2.size.increment, 
            nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect size differences (μ2μ1)/σ(\mu_2 - \mu_1)/\sigma where OC and ASN are desired. Default: c(0, 0.2, 0.3, 0.5).

n1min

Positive integer. Minimum sample size from Group-1 in the sequential comparison. Should be at least 2. Default: 1.

n2min

Positive integer. Minimum sample size from Group-2 in the sequential comparison. Should be at least 2. Default: 1.

n1max

Positive integer. Maximum sample size from Group-1 in the sequential comparison. Default: 1.

n2max

Positive integer. Maximum sample size from Group-2 in the sequential comparison. Default: 1.

tau.NAP

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch1.size.increment

function. Increment in sample size from Group-1 at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

batch2.size.increment

function. Increment in sample size from Group-2 at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

Positve integer. Number of replicated studies based on which the OC and ASN are calculated. Default: 50,000.

nCore

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

Value

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

$summary is a data frame with columns effect.size containing the values in es. At those values, acceptH0 contains the proportion of times H_0 is accepted, rejectH0 contains the proportion of times H_0 is rejected, inconclusive contains the proportion of times the test is inconclusive, ASN contains the ASN, and avg.logBF contains the expected weight of evidence values.

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

$N is a matrix of the same dimension as $BF. Each row contains the sample size required to reach a decision at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = SBFNAP_twot(n1max = 100, n2max = 100, es = c(0, 0.3), nCore = 1)

Sequential Bayes Factor using the NAP for two-sample zz-tests

Description

In case of two independent populations N(μ1,σ02)N(\mu_1,\sigma_0^2) and N(μ2,σ02)N(\mu_2,\sigma_0^2) with known common variance σ02\sigma_0^2, consider the two-sample zz-test for testing the point null hypothesis of difference in their means H0:μ2μ1=0H_0 : \mu_2 - \mu_1 = 0 against H1:μ2μ10H_1 : \mu_2 - \mu_1 \neq 0. This function calculates the operating characteristics (OC) and average sample number (ASN) of the Sequential Bayes Factor design when a normal moment prior is assumed on the difference between standardized effect sizes (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 under the alternative.

Usage

SBFNAP_twoz(es = c(0, 0.2, 0.3, 0.5), n1min = 1, n2min = 1, 
            n1max = 5000, n2max = 5000, 
            tau.NAP = 0.3/sqrt(2), sigma0 = 1, 
            RejectH1.threshold = exp(-3), RejectH0.threshold = exp(3), 
            batch1.size.increment, batch2.size.increment, 
            nReplicate = 50000, nCore)

Arguments

es

Numeric vector. Standardized effect size differences (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 where OC and ASN are desired. Default: c(0, 0.2, 0.3, 0.5).

n1min

Positive integer. Minimum sample size from Group-1 in the sequential comparison. Default: 1.

n2min

Positive integer. Minimum sample size from Group-2 in the sequential comparison. Default: 1.

n1max

Positive integer. Maximum sample size from Group-1 in the sequential comparison. Default: 1.

n2max

Positive integer. Maximum sample size from Group-2 in the sequential comparison. Default: 1.

tau.NAP

Positive numeric. Parameter in the moment prior. Default: 0.3/20.3/\sqrt{2}. This places the prior modes of (μ2μ1)/σ0(\mu_2 - \mu_1)/\sigma_0 at 0.30.3 and 0.3-0.3.

sigma0

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

RejectH1.threshold

Positive numeric. H0H_0 is accepted if BFBF \leRejectH1.threshold. Default: exp(-3).

RejectH0.threshold

Positive numeric. H0H_0 is rejected if BFBF \geRejectH0.threshold. Default: exp(3).

batch1.size.increment

function. Increment in sample size from Group-1 at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

batch2.size.increment

function. Increment in sample size from Group-2 at each sequential step. Default: function(narg){20}. This means an increment of 20 samples at each step.

nReplicate

Positve integer. Number of replicated studies based on which the OC and ASN are calculated. Default: 50,000.

nCore

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

Value

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

$summary is a data frame with columns effect.size containing the values in es. At those values, acceptH0 contains the proportion of times H_0 is accepted, rejectH0 contains the proportion of times H_0 is rejected, inconclusive contains the proportion of times the test is inconclusive, ASN contains the ASN, and avg.logBF contains the expected weight of evidence values.

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

$N is a matrix of the same dimension as $BF. Each row contains the sample size required to reach a decision at the corresponding standardized effec size in nReplicate replicated studies.

Author(s)

Sandipan Pramanik and Valen E. Johnson

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

out = SBFNAP_twoz(n1max = 100, n2max = 100, es = c(0, 0.3), nCore = 1)