| gof_test | R Documentation |
Debiased score test for goodness of fit
gof_test(object, ...)
object |
A fitted model object. Methods are provided for |
... |
Additional arguments passed to the dispatched method. |
An object of class "dScoreTest": a list whose key elements
are the debiased test statistic t.stat and the one-sided p-value
p.val (right tail of the standard normal), along with the test-set
score residuals, the hunted direction, and the call. It has
print,
summary and
plot methods.
Dhawan, A., Guo, F. R. and Shah, R. D. (2026). The debiased score test: hunt-and-test for semiparametric hypotheses. arXiv:2607.28861. https://arxiv.org/abs/2607.28861
gof_test.glm, gof_test.lm,
gof_test.gam,
compare_models, dScoreTest
set.seed(42)
n <- 500
X <- matrix(rnorm(n * 3), nrow = n)
# log(E[y]) ~ X well-specified
y0 <- 5 * exp(X[,1] + X[,3]) + rnorm(n) * 3
fit.0 <- glm(y0 ~ X, family = gaussian(link = "log"), start=rep(1,4))
gof_test(fit.0)
# log(E[y]) ~ X misspecified
y1 <- y0 + exp(6 * cos(X[,1]/6)^2) / sqrt(n)
fit.1 <- glm(y1 ~ X, family = gaussian(link = "log"), start=rep(1,4))
gof_test(fit.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.