This function computes the required sample size to obtain a
normal moment prior Bayes factor (nbf01) more extreme than a
threshold k with a specified target power.
nnmbf01(
k,
power,
usd,
null = 0,
psd,
dpm,
dpsd,
nrange = c(1, 10^5),
lower.tail = TRUE,
integer = TRUE,
...
)The required sample size to achieve the specified power
Bayes factor threshold
Target power
Unit standard deviation, the (approximate) standard error of the parameter estimate based on \(\code{n}=1\), see details
Parameter value under the point null hypothesis. Defaults to
0
Spread of the normal moment prior assigned to the parameter under the alternative in the analysis. The modes of the prior are located at \(\pm\sqrt{2}\,\code{psd}\)
Mean of the normal design prior assigned to the parameter
Standard deviation of the normal design prior assigned to the parameter. Set to 0 to obtain a point prior at the design prior mean
Sample size search range over which numerical search is
performed. Defaults to c(1, 10^5)
Logical indicating whether Pr(\(\mathrm{BF}_{01}\)
\(\leq\) k) (TRUE) or Pr(\(\mathrm{BF}_{01}\)
\(>\) k) (FALSE) should be computed. Defaults to
TRUE
Logical indicating whether only integer valued sample sizes
should be returned. If TRUE the required sample size is rounded to
the next larger integer. Defaults to TRUE
Other arguments passed to stats::uniroot
Samuel Pawel
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.
nmbf01, pnmbf01, powernmbf01
nnmbf01(k = 1/10, power = 0.9, usd = 1, null = 0, psd = 0.5/sqrt(2), dpm = 0.5, dpsd = 0)
Run the code above in your browser using DataLab