| gof_demo_grouped | R Documentation |
gof_demo (replicated covariate patterns)A companion dataset to gof_demo built from the same
data-generating process and seed discipline (see
data-raw/make_gof_demo.R), except that the covariates are coarsened
before the linear predictor is computed: age is rounded to
10-year bins (20, 30, ..., 70) and bmi to whole integers. The recorded
covariates are therefore exactly the covariates the outcome was generated
from, and many observations share a covariate pattern (328 distinct patterns
among 800 observations, versus one pattern per observation in
gof_demo).
gof_demo_grouped
A data frame with 800 rows and 5 variables:
binary response, 0/1 (event rate about 0.27).
age in years, rounded to 10-year bins (20, 30, ..., 70). The true model depends on (binned) age quadratically.
body mass index in kg/m^2, rounded to whole integers.
binary covariate, 0 = female, 1 = male.
binary covariate, 0 = control, 1 = treated.
Its purpose is to demonstrate the sparse-versus-grouped distinction that
run.all.gof surfaces: the battery reports the per-observation
("sparse") and per-covariate-pattern ("grouped") forms of the
pattern-sensitive tests (Pearson, deviance, McCullagh) side by side, and on
replicated-pattern data such as this the two forms can disagree on the same
fitted model. On the all-continuous gof_demo (every observation its
own pattern) the two forms coincide – the degenerate case.
The true data-generating linear predictor has the same form as for
gof_demo,
\eta = -0.6 + 0.8 z_a - 0.7 z_a^2 + 0.5 z_b + 0.4\,\mathrm{sex}
- 0.3\,\mathrm{treatment},
with z_a = (\mathrm{age} - 45)/14 and
z_b = (\mathrm{bmi} - 27)/4 computed from the binned
age and bmi, and
\Pr(\mathrm{outcome} = 1) = \mathrm{plogis}(\eta).
Simulated; see data-raw/make_gof_demo.R in the package sources.
gof_demo, run.all.gof
data("gof_demo_grouped", package = "ebrahim.gof")
fit <- glm(outcome ~ age + bmi + sex + treatment,
data = gof_demo_grouped, family = binomial)
# sparse and grouped forms reported side by side:
run.all.gof(fit, include_slow = FALSE, install = "no")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.