Score Test for Adding a Covariate to a GLM
Computes score test statistics (z-statistics) for adding covariates to a generalized linear model.
glm.scoretest(fit, x2, dispersion=NULL)
- generalized linear model fit object, of class
- vector or matrix with each column a covariate to be added.
- the dispersion for the generalized linear model family.
Rao's score statistic.
Is the locally most powerful test for testing vs a one-sided alternative.
Asympotically equivalent to likelihood ratio tests, but convenient for one-sided tests.
This function computes a score test statistics for adding each covariate individually.
The dispersion parameter is treated as for
NULL, the Pearson estimator is used, except for the binomial and Poisson
families, for which the dispersion is one.
- numeric vector containing the z-statistics, one for each covariate.
Lovison, G (2005). On Rao score and Pearson $X^2$ statistics in generalized linear models.
Statistical Papers, 46, 555-574.
Pregibon, D (1982). Score tests in GLIM with applications.
In GLIM82: Proceedings of the International Conference on Generalized Linear Models,
R Gilchrist (ed.), Lecture Notes in Statistics, Volume 14, Springer, New York, pages 87-97.
Smyth, G. K. (2003). Pearson's goodness of fit statistic as a score test statistic. In: Science and Statistics: A Festschrift for Terry Speed, D. R. Goldstein (ed.), IMS Lecture Notes - Monograph Series, Volume 40, Institute of Mathematical Statistics, Beachwood, Ohio, pages 115-126.
# Pearson's chisquare test for independence # in a contingency table is a score test. # First the usual test y <- c(20,40,40,30) chisq.test(matrix(y,2,2),correct=FALSE) # Now same test using glm.scoretest a <- gl(2,1,4) b <- gl(2,2,4) fit <- glm(y~a+b,family=poisson) x2 <- c(0,0,0,1) z <- glm.scoretest(fit,x2) z^2