gof_test: Debiased score test for goodness of fit

View source: R/gof.R

gof_testR Documentation

Debiased score test for goodness of fit

Description

Debiased score test for goodness of fit

Usage

gof_test(object, ...)

Arguments

object

A fitted model object. Methods are provided for glm, lm and mgcv::gam fits.

...

Additional arguments passed to the dispatched method.

Value

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.

References

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

See Also

gof_test.glm, gof_test.lm, gof_test.gam, compare_models, dScoreTest

Examples

 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)


dScoreTest documentation built on Sept. 3, 2026, 1:06 a.m.