| gof_test.glm | R Documentation |
Debiased score test for goodness of fit of GLM.
## S3 method for class 'glm'
gof_test(
object,
hunt.style = "optimal",
hunt.method = "grf",
hunt_fun = NULL,
trim.outlier.hunt = TRUE,
X.cols.exclude = NULL,
splits = c(0.5, 0.5),
arg.hunt_fun = NULL,
predict_fun_hunt = NULL,
verbose = FALSE,
...
)
object |
Fitted glm object. |
hunt.style |
Hunting algorithm with the following options.
|
hunt.method |
Built-in method for hunting. Currently available:
When this is set to any other value, arguments |
hunt_fun |
Default |
trim.outlier.hunt |
If |
X.cols.exclude |
Columns in |
splits |
Numeric vector of length 2 or 3 giving the relative sizes
of the sample splits; rescaled internally to sum to one.
Default is |
arg.hunt_fun |
Extra arguments (default |
predict_fun_hunt |
When a customized |
verbose |
Default |
... |
Unused; present for S3 generic/method consistency. |
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.
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.