powerbinbf01 {bfpwr} | R Documentation |
Power and sample size calculations for binomial Bayes factor
Description
Compute probability that binomial Bayes factor (binbf01) is smaller than a specified threshold (the power), or determine sample size to obtain a target power.
Usage
powerbinbf01(
n = NULL,
power = NULL,
k = 1/10,
p0 = 0.5,
type = c("point", "direction"),
a = 1,
b = 1,
dp = NA,
da = a,
db = b,
dl = 0,
du = 1,
nrange = c(1, 10^4)
)
Arguments
n |
Sample size. Has to be |
power |
Target power. Has to be |
k |
Bayes factor threshold. Defaults to |
p0 |
Tested binomial proportion. Defaults to |
type |
Type of test. Can be |
a |
Number of successes parameter of the beta analysis prior
distribution. Defaults to |
b |
Number of failures parameter of the beta analysis prior
distribution. Defaults to |
dp |
Fixed binomial proportion assumed for the power calculation. Set to
|
da |
Number of successes parameter of the truncated beta design prior
distribution. Is only taken into account if |
db |
Number of failures parameter of the truncated beta design prior
distribution. Is only taken into account if |
dl |
Lower truncation limit of of the truncated beta design prior
distribution. Is only taken into account if |
du |
Upper truncation limit of of the truncated beta design prior
distribution. Is only taken into account if |
nrange |
Sample size search range over which numerical search is
performed (only taken into account when |
Details
This function provides a similar interface as
stats::power.prop.test
. For some users, the low-level functions
nbinbf01 (to directly compute the sample size for a fixed power)
and pbinbf01 (to directly compute the power for a fixed sample
size) may also be useful.
Value
Object of class "power.bftest"
, a list of the arguments
(including the computed one) augmented with method
and note
elements
Author(s)
Samuel Pawel
See Also
plot.power.bftest, pbinbf01, nbinbf01, binbf01
Examples
## determine sample size
(nres <- powerbinbf01(power = 0.8, p0 = 0.2, type = "direction", dl = 0.2))
## Not run:
plot(nres, nlim = c(1, 250), ngrid = 250, type = "s")
## End(Not run)
## determine power
(powres <- powerbinbf01(n = 100, type = "point"))
## Not run:
plot(powres)
## End(Not run)