| legoft | R Documentation |
Combines eleven classical and directed goodness-of-fit statistics with weights that were fixed offline and ship frozen, and calibrates the combination by a parametric bootstrap at the fitted parameters. Nothing is retrained when you call it.
legoft(object, B = 199, seed = NULL, weights = NULL)
object |
a fitted binomial |
B |
number of parametric-bootstrap replicates for the reference distribution. 199 gives a smallest attainable p-value of 0.005; raise it for smaller p-values. |
seed |
optional integer for reproducibility. |
weights |
optional named vector of member weights; defaults to the frozen rule. Supplying your own makes the result no longer the shipped procedure – say so if you report it. |
The p-value is exact in finite samples when the null parameters are known. With the
parameters estimated – the case here – the calibration is asymptotic; simulation at
n = 500 put the empirical size at 0.037 against a nominal 0.05.
an object of class "legoft": the statistic, its bootstrap p-value,
the member p-values, and B_used.
legoft.localize for which domain of evidence carries the misfit.
set.seed(1)
x1 <- runif(300, -3, 3); x2 <- rnorm(300)
y <- rbinom(300, 1, plogis(0.3 + 0.8 * x1 - 0.5 * x2 + 0.25 * x1^2))
fit <- glm(y ~ x1 + x2, family = binomial())
legoft(fit, B = 99, seed = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.