| edge.gof | R Documentation |
edge.gof() is the primary interface to the EDGE test (Efficient Directed
Grouped Examination): a grouped, directed goodness-of-fit test
for binary logistic regression under sparse data. EDGE projects the grouped
standardized residuals onto a small pre-specified basis of calibration shapes
(cubic "poly3" by default) and refers the resulting quadratic form to
its closed-form weighted chi-squared null distribution – no refit, no
resampling, no tuning.
edge.gof() computes exactly the same statistic as the legacy name
def.gof (retained for backward compatibility); the returned
Test label is "EDGE".
edge.gof(
object,
predicted_probs = NULL,
X = NULL,
G = c("auto", 10),
basis = "poly3",
method = "satterthwaite",
weights = "unit",
external = FALSE,
y = NULL
)
object |
A fitted binary logistic |
predicted_probs |
Numeric predicted probabilities; required when
|
X |
Optional design matrix, used only with the |
G |
Number of groups: |
basis |
One of |
method |
One of |
weights |
|
external |
Logical, default |
y |
Optional alias for |
Two partitions, side by side. By default the test is reported at two
partitions, as the EDGE paper recommends. The default partition,
G = "auto" (\max(10, \lceil n/25 \rceil) groups), refines with the sample and has
more power, above all against misfit at the extremes of risk. Ten groups,
G = 10, keep many records in the extreme groups and so tolerate more
corrupted records, at some cost in power. Choose which one decides in the analysis
plan, from what is known about how the data were collected, not after seeing the
results. The first row is marked Role = "verdict" and the second
Role = "check": with the default G the default partition decides and
ten groups are the robustness check; to let ten groups decide, give
G = c(10, "auto"). If only the default partition rejects, the signal sits in the
extreme groups: check those records. Give a single G to get one row.
The picture. plot() on the result draws the grouped residuals of one row
with the shape the test looked for and the bands that say which groups are out of line;
see plot.edge_gof.
A data.frame of class c("edge_gof", "data.frame") with one row per
partition and columns Test ("EDGE"), Partition, Role
("verdict" for the first row, "check" for the second), Basis,
Test_Statistic, df, Method and p_value, as documented in
def.gof. It is a data frame in every respect; the class only adds a
plot method. The grouped pieces behind each row are kept in
attr(, "details"), a list with one element per row holding r (the grouped
residuals (O_g - E_g)/\sqrt{V_g}), Pz_r (their projection on the basis, whose
sum of squares is the unit-form statistic), O, E, V, size,
pbar (the mean predicted risk of each group), G, omega_diag (the null
variance of each residual: below one in-sample, one for frozen predictions),
external, adjusted, role, partition and statistic.
A row without a p-value, or with basis = "ensemble", has NULL there.
Rows selected or reordered with x[i, ] keep the attribute whole, and
plot() finds the pieces of a row by its partition, role and statistic.
subset() and merge() drop the attribute, and rows bound from another
result have no pieces of their own; plot() then stops with a message.
Ebrahim Khaled Ebrahim ebrahimkhaled@alexu.edu.eg
Ebrahim EK, Hussein OAE-A, El-Kotory A (2026). "A Grouped Calibration Test for Logistic Regression That Tolerates a Few Corrupted Records." arXiv:2608.20511 [stat.ME]. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2608.20511")}
Ebrahim EK, Khattab IG, El-Kotory A (2026). "A Modified Hosmer-Lemeshow Goodness-of-Fit Test for Asymmetric Links: Second-Order Power and Robustness." arXiv:2607.15454 [stat.ME]. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2607.15454")}
plot.edge_gof, def.gof (legacy name),
edge.belt, ef.gof, def.ensemble.gof,
run.all.gof.
set.seed(1)
x <- runif(500, -3, 3)
y <- rbinom(500, 1, plogis(0.6 * x))
fit <- glm(y ~ x, family = binomial())
edge.gof(fit) # cubic basis, at the default partition and at ten groups
edge.gof(fit, G = 10) # one partition only
edge.gof(fit, basis = "stukel") # Stukel-shape basis
edge.gof(fit, basis = "sym") # Stukel's symmetric direction, one column
edge.gof(fit, basis = "sym", weights = "score") # its score form
edge.gof(fit, G = "auto") # the default partition alone: max(10, ceiling(n / 25)) = 20 here
plot(edge.gof(fit)) # the verdict row, on the residual scale
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.