glm.scoretest            package:statmod            R Documentation

_S_c_o_r_e _T_e_s_t _f_o_r _A_d_d_i_n_g _a _C_o_v_a_r_i_a_t_e _t_o _a _G_L_M

_D_e_s_c_r_i_p_t_i_o_n:

     Computes score test statistics (z-statistics) for adding
     covariates to a generalized linear model.

_U_s_a_g_e:

     glm.scoretest(fit, x2, dispersion=NULL)

_A_r_g_u_m_e_n_t_s:

     fit: generalized linear model fit object, of class 'glm'.

      x2: vector or matrix with each column a covariate to be added.

dispersion: the dispersion for the generalized linear model family.

_D_e_t_a_i_l_s:

     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 'summary.glm'. If
     'NULL', the Pearson estimator is used, except for the binomial and
     Poisson families, for which the dispersion is one.

_V_a_l_u_e:

     numeric vector containing the z-statistics, one for each
     covariate.

_A_u_t_h_o_r(_s):

     Gordon Smyth

_R_e_f_e_r_e_n_c_e_s:

     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. <URL:
     http://www.statsci.org/smyth/pubs/goodness.pdf>

_S_e_e _A_l_s_o:

     'glm', 'add1'

_E_x_a_m_p_l_e_s:

     #  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

