nbf01 | R Documentation |
This function computes the required sample size to obtain a
Bayes factor (bf01) more extreme than a threshold k
with a
specified target power.
nbf01(
k,
power,
usd,
null = 0,
pm,
psd,
dpm = pm,
dpsd = psd,
nrange = c(1, 10^5),
lower.tail = TRUE,
integer = TRUE,
analytical = TRUE,
...
)
k |
Bayes factor threshold |
power |
Target power |
usd |
Unit standard deviation, the (approximate) standard error of the
parameter estimate based on |
null |
Parameter value under the point null hypothesis. Defaults to
|
pm |
Mean of the normal prior assigned to the parameter under the alternative in the analysis |
psd |
Standard deviation of the normal prior assigned to the parameter
under the alternative in the analysis. Set to |
dpm |
Mean of the normal design prior assigned to the parameter.
Defaults to the same value as the analysis prior |
dpsd |
Standard deviation of the normal design prior assigned to the
parameter. Defaults to the same value as the analysis prior |
nrange |
Sample size search range over which numerical search is
performed. Defaults to |
lower.tail |
Logical indicating whether Pr( |
integer |
Logical indicating whether only integer valued sample sizes
should be returned. If |
analytical |
Logical indicating whether analytical (if available) or
numerical method should be used. Defaults to |
... |
Other arguments passed to |
It is assumed that the standard error of the future parameter
estimate is of the form \code{se} =\code{usd}/\sqrt{\code{n}}
. For example, for normally distributed data with known
standard deviation sd
and two equally sized groups of size
n
, the standard error of an estimated standardized mean difference
is \code{se} = \code{sd}\sqrt{2/n}
, so the
corresponding unit standard deviation is \code{usd} =
\code{sd}\sqrt{2}
. See the vignette for more
information.
The required sample size to achieve the specified power
A warning message will be displayed in case that the specified target power is not achievable under the specified analysis and design priors.
Samuel Pawel
pbf01, powerbf01, bf01
## point alternative (analytical and numerical solution available)
nbf01(k = 1/10, power = 0.9, usd = 1, null = 0, pm = 0.5, psd = 0,
analytical = c(TRUE, FALSE), integer = FALSE)
## standardized mean difference (usd = sqrt(2), effective sample size = per group size)
nbf01(k = 1/10, power = 0.9, usd = sqrt(2), null = 0, pm = 0, psd = 1)
## this is the sample size per group (assuming equally sized groups)
## z-transformed correlation (usd = 1, effective sample size = n - 3)
nbf01(k = 1/10, power = 0.9, usd = 1, null = 0, pm = 0.2, psd = 0.5)
## have to add 3 to obtain the actual sample size
## log hazard/odds ratio (usd = 2, effective sample size = total number of events)
nbf01(k = 1/10, power = 0.9, usd = 2, null = 0, pm = 0, psd = sqrt(0.5))
## have to convert the number of events to a sample size
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.