View source: R/fs_oc_predict.R
| fs_oc_predict | R Documentation |
Monte-Carlo prediction of the maxeffCons search's operating characteristics
– family declaration rate, per-candidate declaration, the selection
distribution, expected selected-subgroup size, sensitivity, specificity,
PPV, NPV, the oriented effect on the selected rule and the naive selection
bias – from the joint normal law of the candidates' fitted effects. The
family is a population enumeration from fs_oc_family_enumerate
or a supplied fs_oc_family object.
fs_oc_predict(
dgm = NULL,
forestsearch_args = list(),
n,
c1 = NULL,
c2 = NULL,
family = NULL,
consistency_method = c("resample", "split"),
pconsistency = NULL,
draws = 2e+05,
seed = NULL,
...
)
dgm |
An object of class |
forestsearch_args |
Named list of |
n |
Integer. Trial size. Overrides any size implied by the arguments; sets the size floor and the standard-error scale of an enumerated family and converts expected prevalence to expected subjects. |
c1 |
Numeric. Screening floor on the full-sample effect – the |
c2 |
Numeric. Consistency floor on each half-sample effect – the
|
family |
|
consistency_method |
|
pconsistency |
Numeric in (0, 1). Consistency-rate threshold
for the |
draws |
Integer. Number of Monte-Carlo draws. |
seed |
Integer or |
... |
Passed to |
The full-sample fitted effects of the M candidates are taken as
N(\beta_g, S_g) with S_g = \rho \circ (se_g se_g'),
\rho_{ij} = P(g_i \cap g_j) / \sqrt{P(g_i) P(g_j)}. Two independent
half-sample draws W1, W2, each with covariance 2 * Sg,
are generated through fs_sym_root; the full-sample effect is
Bhat = (W1 + W2) / 2.
The two gates. Family declaration is any candidate declaring; the selected rule is the effect maximiser among declaring candidates (maxeffCons).
"resample" – the package's production screenThe
consistency stage of forestsearch (default
consistency_method = "resample") represents the random 50/50
split's half effects as \hat\beta \pm D and computes the
consistency rate in closed form as
2\Phi((\hat\beta - c_2)/\sigma_D) - 1, a candidate passing when
that rate is at least pconsistency
(R/consistency_resample.R; R/subgroup_consistency_helpers.R
drops a candidate when p.consistency < pconsistency.threshold).
Inverting: \hat\beta \ge c_2 + z_p \sigma_D with
z_p = \Phi^{-1}((1+p)/2). \sigma_D is
sqrt(sum(dfbeta[i, treat]^2)), the sandwich standard error of the
subgroup treatment coefficient; in the draw model above the analogous
quantity is se_g, and on a simulated MD40 trial the two agree
within a few percent with no prevalence trend, so the
wrapper identifies \sigma_D = se_g. The gate is then a single
threshold on the full-sample draw,
(Bhat >= c1) & (Bhat - c2 >= z_p * se_g), and only
Bhat ~ N(beta_g, Sg) is drawn – one matrix, not two.
"split" – the analytic document's historical gateOne
half-sample pair W1, W2 stands in for the consistency
rate: (W1 + W2 >= 2 * c1) & (W1 >= c2) & (W2 >= c2), the
screening floor c1 on the full-sample effect and the consistency
floor c2 on each half. Kept bit-identical to the document's
worked-predictions chunk.
All expectations are selection-weighted population functionals of the
family, conditional on declaration. Monte-Carlo standard errors are given
for the proportions (sqrt(p (1 - p) / draws)).
An object of class c("fs_oc_predict", "list"):
det_rate, det_rate_seFamily declaration rate and its MC standard error.
P1, P1_sePer-candidate declaration probability.
p_sel, p_sel_sePer-candidate selection probability (unconditional).
sel_cSelection distribution given declaration.
EnHExpected selected-subgroup size in subjects,
n * sum(sel_c * Pg).
Esens, Espec, Eppv, EnpvExpected classification metrics of the selected rule against Q.
EbetaHExpected oriented true effect on the selected rule.
Enaive_biasExpected naive minus true effect on the selected rule.
mass_belowSelection mass on rules whose true mean is
below c1.
M, labFamily size and labels.
settingsn, c1, c2,
consistency_method, pconsistency (NA for
"split"), draws.
seedThe seed used.
familyThe family object.
fs_oc_family_enumerate, fs_sym_root
# A hand-built three-candidate family
piQ <- 0.34
fam <- structure(list(
lab = c("Q", "P", "D"), Pg = c(piQ, 0.45, 0.31),
PQg = c(1, 0.28 / 0.45, 1), sens_g = c(1, 0.28 / piQ, 0.31 / piQ),
spec_g = c(1, 1 - 0.17 / (1 - piQ), 1),
ovl = matrix(c(piQ, 0.28, 0.31, 0.28, 0.45, 0.28 * 0.31 / piQ,
0.31, 0.28 * 0.31 / piQ, 0.31), 3, 3),
M = 3L, PQ = piQ), class = c("fs_oc_family", "list"))
fam$beta_g <- 26 + 14 * fam$PQg
fam$se_g <- 13.7 * sqrt(2) * sqrt(piQ / fam$Pg)
fs_oc_predict(family = fam, n = 500, c1 = 30, c2 = 10,
consistency_method = "resample", draws = 2e4, seed = 1)
fs_oc_predict(family = fam, n = 500, c1 = 30, c2 = 10,
consistency_method = "split", draws = 2e4, seed = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.