qresiduals              package:statmod              R Documentation

_R_a_n_d_o_m_i_z_e_d _Q_u_a_n_t_i_l_e _R_e_s_i_d_u_a_l_s

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

     Compute randomized quantile residuals for generalized linear
     models.

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

     qresiduals(glm.obj,dispersion=NULL)
     qresid(glm.obj,dispersion=NULL)
     qres.binom(glm.obj)
     qres.pois(glm.obj)
     qres.nbinom(glm.obj)
     qres.gamma(glm.obj,dispersion=NULL)
     qres.invgauss(glm.obj,dispersion=NULL)
     qres.tweedie(glm.obj,dispersion=NULL)
     qres.default(glm.obj,dispersion=NULL)

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

 glm.obj: Object of class 'glm'. The generalized linear model family is
          assumed to be binomial for 'qres.binom', poisson for
          'qres.pois', negative binomial for 'qres.nbinom', Gamma for
          'qres.gamma', inverse Gaussian for 'qres.invgauss' or tweedie
          for 'qres.tweedie'.

dispersion: a positive real number. Specifies the value of the
          dispersion parameter for a Gamma or inverse Gaussian
          generalized linear model if known. If 'NULL', the dispersion
          will be estimated by its Pearson estimator.

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

     Quantile residuals are based on the idea of inverting the
     estimated distribution function for each observation to obtain
     exactly standard normal residuals. In the case of discrete
     distributions, such as the binomial and Poisson, some
     randomization is introduced to produce continuous normal
     residuals. Quantile residuals are the residuals of choice for
     generalized linear models in large dispersion situations when the
     deviance and Pearson residuals can be grossly non-normal. Quantile
     residuals are the only useful residuals for binomial or Poisson
     data when the response takes on only a small number of distinct
     values.

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

     Numeric vector of standard normal quantile residuals.

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

     Gordon Smyth

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

     Dunn, K. P., and Smyth, G. K. (1996). Randomized quantile
     residuals. _Journal of Computational and Graphical Statistics_
     *5*, 1-10. <URL: http://www.statsci.org/smyth/pubs/residual.html>

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

     'residuals.glm'

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

     #  Poisson example: quantile residuals show no granularity
     y <- rpois(20,lambda=4)
     x <- 1:20
     fit <- glm(y~x, family=poisson)
     qr <- qresiduals(fit)
     qqnorm(qr)
     abline(0,1)

     #  Gamma example:
     #  Quantile residuals are nearly normal while usual resids are not
     y <- rchisq(20, df=1)
     fit <- glm(y~1, family=Gamma)
     qr <- qresiduals(fit, dispersion=2)
     qqnorm(qr)
     abline(0,1)

