Type: | Package |
Title: | Sample Size Calculations for Normal Means |
Version: | 1.2.3 |
Date: | 2023-08-22 |
Description: | Sample size requirements calculation using three different Bayesian criteria in the context of designing an experiment to estimate a normal mean or the difference between two normal means. Functions for calculation of required sample sizes for the Average Length Criterion, the Average Coverage Criterion and the Worst Outcome Criterion in the context of normal means are provided. Functions for both the fully Bayesian and the mixed Bayesian/likelihood approaches are provided. For reference see Joseph L. and Bélisle P. (1997) https://www.jstor.org/stable/2988525. |
Imports: | stats |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Repository: | CRAN |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2023-08-22 18:29:08 UTC; Patrick |
Author: | Lawrence Joseph [aut], Patrick Bélisle [aut, cre] |
Maintainer: | Patrick Bélisle <patrickb.stat@gmail.com> |
Date/Publication: | 2023-08-23 00:00:28 UTC |
Bayesian Sample Sizes Calculations Based on Highest Posterior Density Intervals for Normal Means and Differences between Normal Means
Description
Sample size determination based on highest posterior density intervals for normal means and difference between normal means using three different Bayesian approaches
Details
Package: | SampleSizeMeans |
Type: | Package |
Version: | 1.2.3 |
Date: | 2023-08-22 |
License: | GLP (version 2 or later) |
URL: | http://www.medicine.mcgill.ca/epidemiology/Joseph/Methodological-Publications-Bayesian-Sample-Size.html |
A set of R functions for calculating sample size requirements using
three different Bayesian criteria in the context of designing an
experiment to estimate normal means or the difference between two normal
means. Criteria include the Average Length Criterion, the Average
Coverage Criterion and the Modified Worst Outcome Criterion. Functions for both
the fully Bayesian and the mixed Bayesian/likelihood approaches are
provided.
See the related package SampleSizeProportions for Bayesian sample size determination for the difference between two binomial proportions
https://CRAN.R-project.org/package=SampleSizeProportions
Author(s)
Lawrence Joseph and Patrick Bélisle
Maintainer: Patrick Bélisle patrickb.stat@gmail.com
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.freq
Bayesian sample size determination for estimating a single normal mean using the Average Coverage Criterion
Description
The function mu.acc
returns the required sample size
to reach a given coverage probability on average for a posterior credible interval of fixed length for a normal mean.
Usage
mu.acc(len, alpha, beta, n0, level=0.95)
Arguments
len |
The desired fixed length of the posterior credible interval for the mean |
alpha |
First parameter of the Gamma prior density for the precision (reciprocal of the variance) |
beta |
Second parameter of the Gamma prior density for the precision (reciprocal of the variance) |
n0 |
Prior sample size equivalent for the mean |
level |
The desired average coverage probability of the posterior credible interval (e.g., 0.95) |
Details
Assume that a sample will be collected in order to estimate
the mean of a normally distributed random variable. Assume that the precision (reciprocal of the variance) of
this random variable is unknown, but has prior information in the form of a
Gamma(alpha, beta) density. Assume that the mean is unknown, but has
prior information equivalent to n0 previous observations . The function mu.acc
returns the
required sample size to attain the desired average coverage probability level
for the posterior credible interval of fixed length len for the unknown mean.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample size given the inputs to the function.
Note
The sample size returned by this function is exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.freq
Examples
mu.acc(len=0.2, alpha=2, beta=2, n0=10)
Bayesian sample size determination for estimating a single normal mean using the Average Length Criterion
Description
The function mu.alc
returns the required sample size
to reach a given posterior credible interval length on average for a fixed coverage probability for a normal mean.
Usage
mu.alc(len, alpha, beta, n0, level = 0.95)
Arguments
len |
The desired average length of the posterior credible interval for the mean |
alpha |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) |
beta |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) |
n0 |
Prior sample size equivalent for the mean |
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) |
Details
Assume that a sample will be collected in order to estimate
the mean of a normally distributed random variable. Assume that the precision (reciprocal of the variance) of
this random variable is unknown, but has prior information in the form of a
Gamma(alpha, beta) density. Assume that the mean is unknown, but has
prior information equivalent to n0 previous observations.
The function mu.alc
returns the required sample size
to attain the desired average length len for the posterior credible interval
of fixed coverage probability level for the unknown mean.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample size given the inputs to the function.
Note
The sample size returned by this function is exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.acc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.freq
Examples
mu.alc(len=0.2, alpha=2, beta=2, n0=10)
Frequentist sample size determination for normal means
Description
The function mu.freq
returns the required sample size
to obtain a confidence interval of given length and confidence level for a normal mean.
Usage
mu.freq(len, lambda, level = 0.95)
Arguments
len |
The desired total length of the confidence interval for the mean |
lambda |
Known precision (reciprocal of variance) |
level |
The desired confidence level (e.g., 0.95) |
Details
Assume that a random sample will be collected in order to estimate
the mean of a normally distributed random variable with known precision lambda (precision is the reciprocal of the variance).
The function mu.freq
returns the required sample size to attain the
desired length len and confidence level level for a confidence interval
for the mean from a frequentist point of view.
Value
The required sample size given the inputs to the function.
Note
The sample size returned by this function is exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Lemeshow S, Hosmer Jr DW, Klar J, Lwanga SK.
Adequacy of Sample Size in Health Studies. Wiley and Sons, New York, 1990.
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mudiff.freq
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
Examples
# Suppose the variance = 4
mu.freq(len=0.2, lambda=1/4)
Bayesian sample size determination for estimating a single normal mean with known variance using the Mixed Bayesian/Likelihood criteria
Description
The function mu.mbl.varknown
returns the required sample size
to reach a desired posterior credible interval length and coverage probability for a normal mean - using a mixed Bayesian/likelihood approach - when the variance is known.
Usage
mu.mbl.varknown(len, lambda, level = 0.95)
Arguments
len |
The desired total length of the posterior credible interval for the mean |
lambda |
The known precision (reciprocal of variance) |
level |
The desired coverage probability of the posterior credible interval (e.g., 0.95) |
Details
Assume that a sample will be collected in order to estimate
the mean of a normally distributed random variable with known precision lambda (where the precision is the reciprocal of the variance).
The function mu.mbl.varknown
returns the
required sample size to attain the desired length len and
coverage probability level for the posterior credible interval for the unknown mean.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution of the data, but use only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior information is important for planning purposes but prefer to base final inferences only on the data.
Value
The required sample size given the inputs to the function.
Note
The sample size returned by this function is exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.freq
, mudiff.mbl.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.varknown
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.freq
Examples
mu.mbl.varknown(len=0.2, lambda=1/4)
Bayesian sample size determination for estimating a single normal mean using the Mixed Bayesian/Likelihood Average Coverage Criterion
Description
The function mu.mblacc
returns the required sample size
to reach a given coverage probability on average - using a mixed Bayesian/likelihood approach - for a posterior credible interval of fixed length for a normal mean.
Usage
mu.mblacc(len, alpha, beta, level = 0.95, m = 10000, mcs = 3)
Arguments
len |
The desired fixed length of the posterior credible interval for the mean |
alpha |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) |
beta |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) |
level |
The desired average coverage probability of the posterior credible interval (e.g., 0.95) |
m |
The number of points simulated from the preposterior distribution of the data. For each point, the probability coverage of the highest posterior density interval of fixed length len is estimated, in order to approximate the average coverage probability. Usually 10000 is sufficient, but one can increase this number at the expense of program running time. |
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample will be collected in order to estimate
the mean of a normally distributed random variable. Assume that the precision (reciprocal of the variance) of
this random variable is unknown, but has prior information in the form of a
Gamma(alpha, beta) density.
The function mu.mblacc
returns the
required sample size to attain the desired average coverage probability level
for the posterior credible interval of fixed length len
for the unknown mean.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution of the data, but use only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior information is important for planning purposes but prefer to base final inferences only on the data.
Value
The required sample size given the inputs to the function.
Note
The sample size is calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.freq
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.freq
Examples
mu.mblacc(len=0.2, alpha=2, beta=2)
Bayesian sample size determination for estimating a single normal mean using the Mixed Bayesian/Likelihood Average Length Criterion
Description
The function mu.mblalc
returns the required sample size
to reach a given posterior credible interval length on average - using a mixed Bayesian/likelihood approach - for a fixed coverage probability for a normal mean.
Usage
mu.mblalc(len, alpha, beta, level = 0.95)
Arguments
len |
The desired average length of the posterior credible interval for the mean |
alpha |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) |
beta |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) |
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) |
Details
Assume that a sample will be collected in order to estimate
the mean of a normally distributed random variable. Assume that the precision (reciprocal of the variance) of
this random variable is unknown, but has prior information in the form of a
Gamma(alpha, beta) density.
The function mu.mblalc
returns the
required sample size to attain the desired average length len
for the posterior credible interval of fixed coverage probability level
for the unknown mean.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution of the data, but use only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior information is important for planning purposes but prefer to base final inferences only on the data.
Value
The required sample size given the inputs to the function.
Note
The sample size returned by this function is exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.mblacc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.freq
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.freq
Examples
mu.mblalc(len=0.2, alpha=2, beta=2)
Bayesian sample size determination for estimating a single normal mean using the Mixed Bayesian/Likelihood Modified Worst Outcome Criterion
Description
The function mu.mblmodwoc
uses a mixed Bayesian/likelihood approach to
determine conservative sample sizes, in the sense that the desired posterior credible interval coverage and length for a normal mean are guaranteed
over a given proportion of data sets that can arise according to the prior information.
Usage
mu.mblmodwoc(len, alpha, beta, level = 0.95, worst.level = 0.95, m = 50000, mcs = 3)
Arguments
len |
The desired total length of the posterior credible interval for the mean |
alpha |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) |
beta |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) |
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) |
worst.level |
The probability that the length of the posterior credible interval of fixed coverage probability level will be at most len |
m |
The number of points simulated from the preposterior distribution of the data. For each point, the length of the highest posterior density interval of fixed coverage probability level is estimated, in order to approximate the (100*worst.level)%-percentile of the posterior credible interval length. Usually 50000 is sufficient, but one can increase this number at the expense of program running time. |
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample will be collected in order to estimate
the mean of a normally distributed random variable. Assume that the precision (reciprocal of the variance) of
this random variable is unknown, but has prior information in the form of a
Gamma(alpha, beta) density.
The function mu.mblmodwoc
returns the required sample size to attain the desired length len
for the posterior credible interval of fixed coverage probability level for the unknown mean.
The Modified Worst Outcome Criterion used is conservative, in the sense that the posterior credible interval
length len is guaranteed over the worst.level proportion of all
possible data sets that can arise according to the prior information, for a fixed coverage probability level.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution
of the data, but uses only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior
information is important for planning purposes but prefer to base final
inferences only on the data.
Value
The required sample size given the inputs to the function.
Note
The sample size is calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
It is also correct to state that the coverage probability of the posterior credible interval of fixed length len will be at least level with probability worst.level with the sample size returned.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.mblacc
, mu.mblalc
, mu.mbl.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.freq
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.freq
Examples
mu.mblmodwoc(len=0.2, alpha=2, beta=2)
Bayesian sample size determination for estimating a single normal mean using the Modified Worst Outcome Criterion
Description
The function mu.modwoc
calculates conservative sample sizes, in the sense that the desired
posterior credible interval coverage and length for a normal mean are guaranteed over a given proportion of data sets that can arise according to the prior information.
Usage
mu.modwoc(len, alpha, beta, n0, level = 0.95, worst.level = 0.95)
Arguments
len |
The desired length of the posterior credible interval for the mean |
alpha |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) |
beta |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) |
n0 |
Prior sample size equivalent for the mean |
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) |
worst.level |
The probability that the length of the posterior credible interval of fixed coverage probability level will be at most len |
Details
Assume that a sample will be collected in order to estimate
the mean of a normally distributed random variable. Assume that the precision (reciprocal of the variance) of
this random variable is unknown, but has prior information in the form of a
Gamma(alpha, beta) density. Assume that the mean is unknown, but has
prior information equivalent to n0 previous observations. The function mu.modwoc
returns the required sample size to attain the desired length len
for the posterior credible interval of fixed coverage probability level
for the unknown mean.
The Modified Worst Outcome Criterion used is conservative, in the sense that the posterior credible interval
length len is guaranteed over the worst.level proportion of all
possible data sets that can arise according to the prior information, for a fixed coverage probability level.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample size given the inputs to the function.
Note
The sample size returned by this function is exact.
It is also correct to state that the coverage probability of the posterior credible interval of fixed length len will be at least level with probability worst.level with the sample size returned.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.acc
, mu.alc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.freq
Examples
mu.modwoc(len=0.2, alpha=2, beta=2, n0=10)
Bayesian sample size determination for estimating a single normal mean with known variance
Description
The function mu.varknown
returns the required sample size
to reach a desired posterior credible interval length and coverage probability for a normal mean when the variance is known.
Usage
mu.varknown(len, lambda, n0, level = 0.95)
Arguments
len |
The desired total length of the posterior credible interval for the mean |
lambda |
The known precision (reciprocal of variance) |
n0 |
Prior sample size equivalent for the mean |
level |
The desired coverage probability of the posterior credible interval (e.g., 0.95) |
Details
Assume that a sample will be collected in order to estimate
the mean of a normally distributed random variable with known precision lambda (where the precision is the reciprocal of the variance).
Assume that the mean is unknown, but has
prior information equivalent to n0 previous observations. The function mu.varknown
returns the
required sample size to attain the desired length len and
coverage probability level for the posterior credible interval for the unknown mean.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample size given the inputs to the function.
Note
The sample size returned by this function is exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mu.acc
, mu.alc
, mu.modwoc
, mu.mbl.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.freq
, mudiff.varknown
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.mbl.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.freq
Examples
mu.varknown(len=0.2, lambda=1/4, n0=10)
Bayesian sample size determination for differences in normal means using the Average Coverage Criterion
Description
The function mudiff.acc
returns the required sample sizes
to reach a given coverage probability on average for a posterior credible interval of fixed length for the difference between two normal means.
Usage
mudiff.acc(len, alpha1, beta1, alpha2, beta2, n01, n02, level = 0.95,
equal = TRUE, m = 10000, mcs = 3)
Arguments
len |
The desired fixed length of the posterior credible interval for the difference between the two unknown means | |||||||||
alpha1 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population | |||||||||
beta1 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population | |||||||||
alpha2 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population | |||||||||
beta2 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population | |||||||||
n01 |
Prior sample size equivalent for the mean for the first population | |||||||||
n02 |
Prior sample size equivalent for the mean for the second population | |||||||||
level |
The desired average coverage probability of the posterior credible interval (e.g., 0.95) | |||||||||
equal |
logical. Whether or not the final group sizes (n1, n2) are forced to be equal:
| |||||||||
m |
The number of points simulated from the preposterior distribution of the data. For each point, the probability coverage of the highest posterior density interval of fixed length len is estimated, in order to approximate the average coverage probability. Usually 10000 is sufficient, but one can increase this number at the expense of program running time. | |||||||||
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precision within each of the two the populations are
unknown, but have prior information in the form of
Gamma(alpha1, beta1) and Gamma(alpha2, beta2) densities, respectively.
Assume that the means are unknown, but have prior information equivalent to (n01, n02) previous observations, respectively.
The function mudiff.acc
returns the required sample sizes to attain the
average coverage probability level for the posterior credible interval of fixed length len
for the difference between the two unknown means.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes are calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.freq
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
Examples
mudiff.acc(len=0.2, alpha1=2, beta1=2, alpha2=3, beta2=3, n01=10, n02=25)
Bayesian sample size determination for differences in normal means when variances are equal using the Average Coverage Criterion
Description
The function mudiff.acc.equalvar
returns the required sample sizes
to reach a given coverage probability on average for a posterior credible interval of fixed length for the difference between two normal means, when variances are equal.
Usage
mudiff.acc.equalvar(len, alpha, beta, n01, n02, level = 0.95, equal = TRUE)
Arguments
len |
The desired fixed length of the posterior credible interval for the difference between the two unknown means | |||||||||
alpha |
First prior parameter of the Gamma density for the common precision (reciprocal of the variance) | |||||||||
beta |
Second prior parameter of the Gamma density for the common precision (reciprocal of the variance) | |||||||||
n01 |
Prior sample size equivalent for the mean for the first population | |||||||||
n02 |
Prior sample size equivalent for the mean for the second population | |||||||||
level |
The desired average coverage probability of the posterior credible interval (e.g., 0.95) | |||||||||
equal |
logical. Whether or not the final group sizes (n1, n2) are forced to be equal:
|
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precisions of the two normal sampling distributions are
unknown but equal, with prior information in the form of a Gamma(alpha,
beta) density. Assume that the means are unknown, but have
prior information equivalent to (n01, n02) previous observations, respectively.
The function mudiff.acc.equalvar
returns the required sample sizes to attain the
desired average coverage probability level for the posterior credible interval of fixed length len
for the difference between the two unknown means.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes returned by this function are exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.varknown
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mbl.varknown
, mudiff.freq
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
Examples
mudiff.acc.equalvar(len=0.2, alpha=2, beta=2, n01=10, n02=50)
Bayesian sample size determination for differences in normal means using the Average Length Criterion
Description
The function mudiff.alc
returns the required sample sizes
to reach a desired posterior credible interval length on average for a fixed coverage probability for the difference between two normal means.
Usage
mudiff.alc(len, alpha1, beta1, alpha2, beta2, n01, n02, level = 0.95,
equal = TRUE, m = 10000, mcs = 3)
Arguments
len |
The desired average length of the posterior credible interval for the difference between the two unknown means | |||||||||
alpha1 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population | |||||||||
beta1 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population | |||||||||
alpha2 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population | |||||||||
beta2 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population | |||||||||
n01 |
Prior sample size equivalent for the mean for the first population | |||||||||
n02 |
Prior sample size equivalent for the mean for the second population | |||||||||
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) | |||||||||
equal |
logical. Whether or not the final group sizes (n1, n2) are forced to be equal:
| |||||||||
m |
The number of points simulated from the preposterior distribution of the data. For each point, the length of the highest posterior density interval of fixed coverage probability level is estimated, in order to approximate the average length. Usually 10000 is sufficient, but one can increase this number at the expense of program running time. | |||||||||
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precision within each of the two the populations are
unknown, but have prior information in the form of
Gamma(alpha1, beta1) and Gamma(alpha2, beta2) densities, respectively.
Assume that the means are unknown, but have
prior information equivalent to (n01, n02) previous observations, respectively. The function
mudiff.alc
returns the required sample sizes to attain the
desired average length len for the posterior credible interval of fixed coverage probability level
for the difference between the two unknown means.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes are calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.acc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.freq
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
Examples
mudiff.alc(len=0.2, alpha1=2, beta1=2, alpha2=3, beta2=3, n01=10, n02=25)
Bayesian sample size determination for differences in normal means when variances are equal using the Average Length Criterion
Description
The function mudiff.alc.equalvar
returns the required sample sizes
to reach a given posterior credible interval length on average for a fixed coverage probability for the difference between two normal means, when variances are equal.
Usage
mudiff.alc.equalvar(len, alpha, beta, n01, n02, level = 0.95, equal = TRUE)
Arguments
len |
The desired average length of the posterior credible interval for the difference between the two unknown means | |||||||||
alpha |
First prior parameter of the Gamma density for the common precision (reciprocal of the variance) | |||||||||
beta |
Second prior parameter of the Gamma density for the common precision (reciprocal of the variance) | |||||||||
n01 |
Prior sample size equivalent for the mean for the first population | |||||||||
n02 |
Prior sample size equivalent for the mean for the second population | |||||||||
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) | |||||||||
equal |
logical. Whether or not the final group sizes (n1, n2) are forced to be equal:
|
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precisions of the two normal sampling distributions are
unknown but equal, with prior information in the form of a Gamma(alpha,
beta) density. Assume that the means are unknown, but have
prior information equivalent to (n01, n02) previous observations, respectively. The function
mudiff.alc.equalvar
returns the required sample sizes to attain the
desired average length len for the posterior credible interval of fixed coverage probability level
for the difference between the two unknown means.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes returned by this function are exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.acc.equalvar
, mudiff.modwoc.equalvar
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.varknown
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mbl.varknown
, mudiff.freq
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
Examples
mudiff.alc.equalvar(len=0.2, alpha=2, beta=2, n01=10, n02=50)
Frequentist sample size determination for differences in normal means
Description
The function mudiff.freq
returns the required sample sizes
to get a confidence interval of given length and confidence level for the difference between two normal means.
Usage
mudiff.freq(len, lambda1, lambda2, level = 0.95, equal=TRUE)
Arguments
len |
The desired total length of the confidence interval for the difference between the two unknown means | |||||||||
lambda1 |
Known precision (reciprocal of the variance) for the first population | |||||||||
lambda2 |
Known precision (reciprocal of the variance) for the second population | |||||||||
level |
The desired confidence level (e.g., 0.95) | |||||||||
equal |
logical. Whether or not the final group sizes (n1, n2) are forced to be equal:
|
Details
Assume that a random sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume further that the two precisions lambda1 and lambda2 are known (where precision is the reciprocal of the variance).
The function mudiff.freq
returns the required sample sizes to attain the
desired length len and confidence level level for the confidence interval
for the difference between the two unknown means from a frequentist point of view.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes returned by this function are exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mu.freq
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
Examples
# Suppose variance1 = 2, variance2 = 4
mudiff.freq(len=0.2, lambda1=1/2, lambda2=1/4)
Bayesian sample size determination for differences in normal means when variances are known using the Mixed Bayesian/Likelihood criteria
Description
The function mudiff.mbl.varknown
returns the required sample sizes
to reach a given posterior credible interval length and coverage probability for the difference between two normal means - using a mixed Bayesian/likelihood approach - when variances are known.
Usage
mudiff.mbl.varknown(len, lambda1, lambda2, level = 0.95, equal = TRUE)
Arguments
len |
The desired total length of the posterior credible interval for the difference between the two unknown means | |||||||||
lambda1 |
The known precision (reciprocal of variance) for the first population | |||||||||
lambda2 |
The known precision (reciprocal of variance) for the second population | |||||||||
level |
The desired coverage probability of the posterior credible interval (e.g., 0.95) | |||||||||
equal |
logical. Whether or not the final group sizes (n1, n2) are forced to be equal:
|
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means
when the variances are known.
The function mudiff.mbl.varknown
returns the required sample sizes to attain the
desired length len and coverage probability level for the posterior credible interval
for the difference between the two unknown means.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution of the data, but use only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior information is important for planning purposes but prefer to base final inferences only on the data.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes returned by this function are exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.varknown
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.freq
, mu.mbl.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.freq
Examples
mudiff.mbl.varknown(len=0.2, lambda1=1, lambda2=1/1.5)
Bayesian sample size determination for differences in normal means using the mixed Bayesian/likelihood Average Coverage Criterion
Description
The function mudiff.mblacc
returns the required sample sizes
to reach a given coverage probability on average for a posterior credible interval of fixed length - using a mixed Bayesian/likelihood approach - for the difference between two normal means.
Usage
mudiff.mblacc(len, alpha1, beta1, alpha2, beta2, level = 0.95, m = 10000, mcs = 3)
Arguments
len |
The desired fixed length of the posterior credible interval for the difference between the two unknown means |
alpha1 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population |
beta1 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population |
alpha2 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population |
beta2 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population |
level |
The desired average coverage probability of the posterior credible interval (e.g., 0.95) |
m |
The number of points simulated from the preposterior distribution of the data. For each point, the probability coverage of the highest posterior density interval of fixed length len is estimated, in order to approximate the average coverage probability. Usually 10000 is sufficient, but one can increase this number at the expense of program running time. |
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precision within each of the two the populations are
unknown, but have prior information in the form of
Gamma(alpha1, beta1) and Gamma(alpha2, beta2) densities, respectively.
The function mudiff.mblacc
returns the required sample sizes to attain the
desired average coverage probability level for the posterior credible interval of fixed length len
for the difference between the two unknown means.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution of the data, but use only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior information is important for planning purposes but prefer to base final inferences only on the data.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes are calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.freq
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.freq
Examples
mudiff.mblacc(len=0.2, alpha1=2, beta1=2, alpha2=3, beta2=3)
Bayesian sample size determination for differences in normal means when variances are equal using the Mixed Bayesian/Likelihood Average Coverage Criterion
Description
The function mudiff.mblacc.equalvar
returns the required sample sizes
to reach a given coverage probability on average for a posterior credible interval of fixed length for the difference between two normal means using a mixed Bayesian/likelihood approach, when variances are equal.
Usage
mudiff.mblacc.equalvar(len, alpha, beta, level = 0.95, m = 10000, mcs = 3)
Arguments
len |
The desired fixed length of the posterior credible interval for the difference between the two unknown means |
alpha |
First prior parameter of the Gamma density for the common precision (reciprocal of the variance) |
beta |
Second prior parameter of the Gamma density for the common precision (reciprocal of the variance) |
level |
The desired average coverage probability of the posterior credible interval (e.g., 0.95) |
m |
The number of points simulated from the preposterior distribution of the data. For each point, the probability coverage of the highest posterior density interval of fixed length len is estimated, in order to approximate the average coverage probability. Usually 10000 is sufficient, but one can increase this number at the expense of program running time. |
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precision within each of the two the populations are
unknown but equal, with prior information in the form of a Gamma(alpha,
beta) density.
The function mudiff.mblacc.equalvar
returns the required sample sizes to attain the
average coverage probability level for the posterior credible interval of fixed length len
for the difference between the two unknown means.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution of the data, but use only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior information is important for planning purposes but prefer to base final inferences only on the data.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes are calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mbl.varknown
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.varknown
, mudiff.freq
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.freq
Examples
mudiff.mblacc.equalvar(len=0.2, alpha=2, beta=2)
Bayesian sample size determination for differences in normal means using the Mixed Bayesian/Likelihood Average Length Criterion
Description
The function mudiff.mblalc
returns the required sample sizes
to reach a given posterior credible interval length on average for a fixed coverage probability - using a mixed Bayesian/likelihood approach - for the difference between two normal means.
Usage
mudiff.mblalc(len, alpha1, beta1, alpha2, beta2, level = 0.95, m = 10000, mcs = 3)
Arguments
len |
The desired average length of the posterior credible interval for the difference between the two unknown means |
alpha1 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population |
beta1 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population |
alpha2 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population |
beta2 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population |
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) |
m |
The number of points simulated from the preposterior distribution of the data. For each point, the length of the highest posterior density interval of fixed coverage probability level is estimated, in order to approximate the average length. Usually 10000 is sufficient, but one can increase this number at the expense of program running time. |
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precision within each of the two the populations are
unknown, but have prior information in the form of
Gamma(alpha1, beta1) and Gamma(alpha2, beta2) densities, respectively.
The function mudiff.mblalc
returns the required sample sizes to attain the
desired average length len for the posterior credible interval of fixed coverage probability level
for the difference between the two unknown means.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution of the data, but use only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior information is important for planning purposes but prefer to base final inferences only on the data.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes are calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.mblacc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.freq
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.freq
Examples
mudiff.mblalc(len=0.2, alpha1=2, beta1=2, alpha2=3, beta2=3)
Bayesian sample size determination for differences in normal means when variances are equal using the Mixed Bayesian/Likelihood Average Length Criterion
Description
The function mudiff.mblalc.equalvar
returns the required sample sizes
to reach a given posterior credible interval length on average for a fixed coverage probability for the difference between two normal means - using a mixed Bayesian/likelihood approach - when variances are equal.
Usage
mudiff.mblalc.equalvar(len, alpha, beta, level = 0.95)
Arguments
len |
The desired average length of the posterior credible interval for the difference between the two unknown means |
alpha |
First prior parameter of the Gamma density for the common precision (reciprocal of the variance) |
beta |
Second prior parameter of the Gamma density for the common precision (reciprocal of the variance) |
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) |
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precisions of the two normal sampling distributions are
unknown but equal, with prior information in the form of a Gamma(alpha,
beta) density.
The function mudiff.mblalc.equalvar
returns the required sample sizes to attain the
desired average length len for the posterior credible interval of fixed coverage probability level
for the difference between the two unknown means.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution of the data, but use only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior information is important for planning purposes but prefer to base final inferences only on the data.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes returned by this function are exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.mblacc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mbl.varknown
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.varknown
, mudiff.freq
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.freq
Examples
mudiff.mblalc.equalvar(len=0.2, alpha=2, beta=2)
Bayesian sample size determination for differences in normal means using the Mixed Bayesian/Likelihood Modified Worst Outcome Criterion
Description
The function mudiff.mblmodwoc
uses a mixed Bayesian/likelihood approach to
determine conservative sample sizes, in the sense that the desired posterior credible interval coverage and length
for the difference between two normal means are guaranteed
over a given proportion of data sets that can arise according to the prior information.
Usage
mudiff.mblmodwoc(len, alpha1, beta1, alpha2, beta2, level = 0.95,
worst.level = 0.95, m = 50000, mcs = 3)
Arguments
len |
The desired total length of the posterior credible interval for the difference between the two unknown means |
alpha1 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population |
beta1 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population |
alpha2 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population |
beta2 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population |
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) |
worst.level |
The probability that the length of the posterior credible interval of fixed coverage probability level will be at most len |
m |
The number of points simulated from the preposterior distribution of the data. For each point, the length of the highest posterior density interval of fixed coverage probability level is estimated, in order to approximate the (100*worst.level)%-percentile of the posterior credible interval length. Usually 50000 is sufficient, but one can increase this number at the expense of program running time. |
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precision within each of the two the populations are
unknown, but have prior information in the form of
Gamma(alpha1, beta1) and Gamma(alpha2, beta2) densities, respectively.
The function mudiff.mblmodwoc
returns the required sample sizes to attain the desired length len
for the posterior credible interval of fixed coverage probability level
for the difference between the two unknown means.
The Modified Worst Outcome Criterion used is conservative, in the sense that the posterior credible interval
length len is guaranteed over the worst.level proportion of all
possible data sets that can arise according to the prior information, for a fixed coverage probability level.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution
of the data, but uses only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior
information is important for planning purposes but prefer to base final
inferences only on the data.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes are calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
It is also correct to state that the coverage probability of the posterior credible interval of fixed length len will be at least level with probability worst.level with the sample sizes returned.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.mblacc
, mudiff.mblalc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.freq
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.freq
Examples
mudiff.mblmodwoc(len=0.2, alpha1=2, beta1=2, alpha2=3, beta2=3, worst.level=0.95)
Bayesian sample size determination for differences in normal means when variances are equal using the Mixed Bayesian/Likelihood Modified Worst Outcome Criterion
Description
The function mudiff.mblmodwoc.equalvar
uses a mixed Bayesian/likelihood approach to
determine conservative sample sizes, in the sense that the desired posterior credible interval coverage and length
for the difference between two normal means are guaranteed over a given proportion of data sets that can arise according to the prior information, when variances are equal.
Usage
mudiff.mblmodwoc.equalvar(len, alpha, beta, level = 0.95,
worst.level = 0.95, m = 50000, mcs = 3)
Arguments
len |
The desired total length of the posterior credible interval for the difference between the two unknown means |
alpha |
First prior parameter of the Gamma density for the common precision (reciprocal of the variance) |
beta |
Second prior parameter of the Gamma density for the common precision (reciprocal of the variance) |
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) |
worst.level |
The probability that the length of the posterior credible interval of fixed coverage probability level will be at most len |
m |
The number of points simulated from the preposterior distribution of the data. For each point, the length of the highest posterior density interval of fixed coverage probability level is estimated, in order to approximate the (100*worst.level)%-percentile of the posterior credible interval length. Usually 50000 is sufficient, but one can increase this number at the expense of program running time. |
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precisions of the two normal sampling distributions are
unknown but equal, with prior information in the form of a Gamma(alpha,
beta) density.
The function mudiff.mblmodwoc.equalvar
returns the required sample sizes to attain the desired length len
for the posterior credible interval of fixed coverage probability level
for the difference between the two unknown means.
The Modified Worst Outcome Criterion used is conservative, in the sense that the posterior credible interval
length len is guaranteed over the worst.level proportion of all
possible data sets that can arise according to the prior information, for a fixed coverage probability level.
This function uses a Mixed Bayesian/Likelihood (MBL) approach.
MBL approaches use the prior information to derive the predictive distribution
of the data, but uses only the likelihood function for final inferences.
This approach is intended to satisfy investigators who recognize that prior
information is important for planning purposes but prefer to base final
inferences only on the data.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes are calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
It is also correct to state that the coverage probability of the posterior credible interval of fixed length len will be at least level with probability worst.level with the sample sizes returned.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mbl.varknown
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.varknown
, mudiff.freq
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.freq
Examples
mudiff.mblmodwoc.equalvar(len=0.2, alpha=2, beta=2)
Bayesian sample size determination for differences in normal means using the Modified Worst Outcome Criterion
Description
The function mudiff.modwoc
calculates conservative sample sizes, in the sense that the desired
posterior credible interval coverage and length for the difference between two normal means
are guaranteed over a given proportion of data sets that can arise according to the prior information.
Usage
mudiff.modwoc(len, alpha1, beta1, alpha2, beta2, n01, n02, level = 0.95,
worst.level = 0.95, equal = TRUE, m = 50000, mcs = 3)
Arguments
len |
The desired total length of the posterior credible interval for the difference between the two unknown means | |||||||||
alpha1 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population | |||||||||
beta1 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the first population | |||||||||
alpha2 |
First prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population | |||||||||
beta2 |
Second prior parameter of the Gamma density for the precision (reciprocal of the variance) for the second population | |||||||||
n01 |
Prior sample size equivalent for the mean for the first population | |||||||||
n02 |
Prior sample size equivalent for the mean for the second population | |||||||||
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) | |||||||||
worst.level |
The probability that the length of the posterior credible interval of fixed coverage probability level will be at most len | |||||||||
equal |
logical. Whether or not the final group sizes (n1, n2) are forced to be equal:
| |||||||||
m |
The number of points simulated from the preposterior distribution of the data. For each point, the length of the highest posterior density interval of fixed coverage probability level is estimated, in order to approximate the (100*worst.level)%-percentile of the posterior credible interval length. Usually 50000 is sufficient, but one can increase this number at the expense of program running time. | |||||||||
mcs |
The Maximum number of Consecutive Steps allowed in the same direction in the march towards the optimal sample size, before the result for the next upper/lower bound is cross-checked. In our experience, mcs = 3 is a good choice. |
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precision within each of the two the populations are
unknown, but have prior information in the form of
Gamma(alpha1, beta1) and Gamma(alpha2, beta2) densities, respectively.
Assume that the means are unknown, but have
prior information equivalent to (n01, n02) previous observations, respectively.
The function mudiff.modwoc
returns the required sample sizes to attain
the desired length len for the posterior credible interval of fixed coverage probability level
for the difference between the two unknown unknown means.
The Modified Worst Outcome Criterion used is conservative, in the sense that the posterior credible interval
length len is guaranteed over the worst.level proportion of all
possible data sets that can arise according to the prior information, for a fixed coverage probability level.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes are calculated via Monte Carlo simulations, and therefore may vary from one call to the next.
It is also correct to state that the coverage probability of the posterior credible interval of fixed length len will be at least level with probability worst.level with the sample sizes returned.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.acc
, mudiff.alc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mbl.varknown
, mudiff.freq
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
Examples
mudiff.modwoc(len=0.2, alpha1=2, beta1=2, alpha2=3, beta2=3, n01=10, n02=50)
Bayesian sample size determination for differences in normal means when variances are equal using the Modified Worst Outcome Criterion
Description
The function mudiff.modwoc.equalvar
calculates conservative sample sizes, in the sense that the desired
posterior credible interval coverage and length for the difference between two normal means
are guaranteed over a given proportion of data sets that can arise according to the prior information, when variances are equal.
Usage
mudiff.modwoc.equalvar(len, alpha, beta, n01, n02, level = 0.95,
worst.level = 0.95, equal = TRUE)
Arguments
len |
The desired total length of the posterior credible interval for the difference between the two unknown means | |||||||||
alpha |
First prior parameter of the Gamma density for the common precision (reciprocal of the variance) | |||||||||
beta |
Second prior parameter of the Gamma density for the common precision (reciprocal of the variance) | |||||||||
n01 |
Prior sample size equivalent for the mean for the first population | |||||||||
n02 |
Prior sample size equivalent for the mean for the second population | |||||||||
level |
The desired fixed coverage probability of the posterior credible interval (e.g., 0.95) | |||||||||
worst.level |
The probability that the length of the posterior credible interval of fixed coverage probability level will be at most len | |||||||||
equal |
logical. Whether or not the final group sizes (n1, n2) are forced to be equal:
|
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means.
Assume that the precisions of the two normal sampling distributions are
unknown but equal, with prior information in the form of a Gamma(alpha,
beta) density. Assume that the means are unknown, but have
prior information equivalent to (n01, n02) previous observations, respectively.
The function mudiff.modwoc.equalvar
returns the required sample sizes to attain the desired length len
for the posterior credible interval of fixed coverage probability level
for the difference between the two unknown means.
The Modified Worst Outcome Criterion used is conservative, in the sense that the posterior credible interval
length len is guaranteed over the worst.level proportion of all
possible data sets that can arise according to the prior information, for a fixed coverage probability level.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes returned by this function are exact.
It is also correct to state that the coverage probability of the posterior credible interval of fixed length len will be at least level with probability worst.level with the sample sizes returned.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.varknown
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mbl.varknown
, mudiff.freq
, mu.acc
, mu.alc
, mu.modwoc
, mu.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.mbl.varknown
, mu.freq
Examples
mudiff.modwoc.equalvar(len=0.2, alpha=2, beta=2, n01=10, n02=50)
Bayesian sample size determination for differences in normal means when variances are known
Description
The function mudiff.varknown
returns the required sample sizes
to reach a given posterior credible interval length and coverage probability for the difference between two normal means, when variances are known.
Usage
mudiff.varknown(len, lambda1, n01, lambda2, n02, level = 0.95, equal = TRUE)
Arguments
len |
The desired total length of the posterior credible interval for the difference between the two unknown means | |||||||||
lambda1 |
The known precision (reciprocal of variance) for the first population | |||||||||
n01 |
Prior sample size equivalent for the mean for the first population | |||||||||
lambda2 |
The known precision (reciprocal of variance) for the second population | |||||||||
n02 |
Prior sample size equivalent for the mean for the second population | |||||||||
level |
The desired coverage probability of the posterior credible interval (e.g., 0.95) | |||||||||
equal |
logical. Whether or not the final group sizes (n1, n2) are forced to be equal:
|
Details
Assume that a sample from each of two populations will be
collected in order to estimate the difference between two independent normal means
when the variances are known. Assume that the means are unknown, but have
prior information equivalent to (n01, n02) previous observations, respectively. The function
mudiff.varknown
returns the required sample sizes to attain the
desired length len and coverage probability level for the posterior credible interval
for the difference between the two unknown means.
This function uses a fully Bayesian approach to sample size determination.
Therefore, the desired coverages and lengths are only realized if the prior distributions input to the function
are used for final inferences. Researchers preferring to use the data only for final inferences are encouraged
to use the Mixed Bayesian/Likelihood version of the function.
Value
The required sample sizes (n1, n2) for each group given the inputs to the function.
Note
The sample sizes returned by this function are exact.
Author(s)
Lawrence Joseph lawrence.joseph@mcgill.ca and Patrick Bélisle
References
Joseph L, Bélisle P.
Bayesian sample size determination for Normal means and differences between Normal means
The Statistician 1997;46(2):209-226.
See Also
mudiff.acc
, mudiff.alc
, mudiff.modwoc
, mudiff.acc.equalvar
, mudiff.alc.equalvar
, mudiff.modwoc.equalvar
, mudiff.mbl.varknown
, mudiff.mblacc
, mudiff.mblalc
, mudiff.mblmodwoc
, mudiff.mblacc.equalvar
, mudiff.mblalc.equalvar
, mudiff.mblmodwoc.equalvar
, mudiff.freq
, mu.varknown
, mu.acc
, mu.alc
, mu.modwoc
, mu.mbl.varknown
, mu.mblacc
, mu.mblalc
, mu.mblmodwoc
, mu.freq
Examples
mudiff.varknown(len=0.2, lambda1=1, n01=10, lambda2=1/1.5, n02=25)