| grass_power | R Documentation |
grass_power() plans a study's size. Assume a prevalence and a rough
rater quality, and it says what a design of a given size can show
about the panel, and how many more subjects or raters it would take to
show more. The result describes the design, how much a study of that
size can learn about its raters.
grass_power(
metric,
q = NULL,
q0 = NULL,
target = NULL,
pi_hat = NULL,
prevalence = NULL,
k = NULL,
N = NULL,
power = NULL
)
metric |
One of |
q |
Panel quality, the probability of a correct call on the
|
q0 |
The lower edge of the quality resolution the study is planned
for, in |
target |
A fixed coefficient value to reach. Give |
pi_hat |
Observed positive rate, the share of all |
prevalence |
True positive rate of the finding, in |
k |
Number of raters. Snaps to the nearest calibrated rater count (2, 3, 5, 8, 15, 25), as the surfaces do everywhere. |
N |
Number of subjects in |
power |
Probability, in |
A study sized to show that a panel of quality q is above q0
returns a 95% consistency band on quality whose lower edge lies above
q0. q0 sets the resolution of the plan. A panel weaker than
assumed returns a band that is lower and about as wide, so the
study reports the quality it finds at the precision it was planned
for. The convention follows stats::power.t.test(). Fix four of q,
the positive rate (prevalence or pi_hat), k, N, power, leave
one NULL, and the function solves for it.
Whether more subjects or more raters raises power depends on prevalence. At balanced prevalence a few more raters do the work of subjects. At a rare or very common finding they do not, because a small sample holds only a handful of the minority class, and the answer is more subjects.
The function also accepts target, a fixed coefficient value, for a
threshold imposed from outside (a journal's or regulator's band). A
fixed coefficient value means something different at each design.
When the value a panel of quality q produces at the design is
below target, power falls with N. Give q0 or target, not both.
An object of class grass_power: the design quantities with the
solved one filled in, solved naming it, mode ("quality" or
"value"), feasible, reason (when not feasible), expected (the
median coefficient a panel of quality q produces at the design, in
"value" mode), curve (power across the solved variable's range,
the data plot() draws), and notes from the surface lookup.
Every quantity is a direct read of the quality sweep that
position_on_surface() returns, p(q) = P(coefficient <= c | q, design).
Nothing is simulated at call time. For q0, by test inversion the lower
end of the band is above q0 exactly when the observed coefficient exceeds
the 97.5th percentile of the q0 distribution, c0, so
power = 1 - p_q(c0). For target, power = 1 - p_q(target).
N or kThe smallest value on the calibrated surface at which power is
reached. Below about 25 subjects the curve can step or dip between
adjacent sample sizes, because the coefficient takes few distinct
values there. When none reaches it the result carries NA,
feasible = FALSE, and the reason, including the best power any
design on the surface reaches.
Leave both pi_hat and prevalence NULL. The result is the range of
observed positive rates over which power is reached, solution holds
its two endpoints, and prevalence holds the same range converted at
q.
# Raters assumed near quality 0.90, prevalence 10%, three raters: how
# many subjects to show the panel is above quality 0.80, 80% power?
pw <- grass_power("fleiss_kappa", q = 0.90, q0 = 0.80, prevalence = 0.10,
k = 3, power = 0.80)
pw
if (requireNamespace("ggplot2", quietly = TRUE)) plot(pw)
# Leave `prevalence` out to get the range of positive rates over which
# a fixed design keeps that power; give `target =` instead of `q0` to
# size against a fixed coefficient value. Both are shown in the vignette.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.