residuals.AccurateGLM {aglm}R Documentation

Get residuals of various types

Description

Get residuals of various types

Usage

## S3 method for class 'AccurateGLM'
residuals(
  object,
  x = NULL,
  y = NULL,
  offset = NULL,
  weights = NULL,
  type = c("working", "pearson", "deviance"),
  s = NULL,
  ...
)

Arguments

object

A model object obtained from aglm() or cv.aglm().

x

A design matrix. If not given, x for fitting is used.

y

A response variable. If not given, y for fitting is used.

offset

An offset values. If not given, offset for fitting is used.

weights

Sample weights. If not given, weights for fitting is used.

type

A string representing type of deviance:

  • "working" get working residual \[r^W_i = (y_i - \mu_i) \left(\frac{\partial \eta}{\partial \mu}\right)_{\mu=\mu_i},\] where y_i is a response value, μ is GLM mean, and η=g^{-1}(μ) with the link function g.

  • "pearson" get Pearson residuals \[r^P_i = \frac{y_i - \mu_i}{\sqrt{V(\mu_i)}},\] where V is the variance function.

  • "deviance" get deviance residuals \[r^D_i = {\rm sign}(y_i - \mu_i) \sqrt{d_i},\] where d_i is the contribution to deviance.

s

A numeric value specifying λ at which residuals are calculated.

...

Other arguments are currently not used and just discarded.

Value

A numeric vector representing calculated residuals.

Author(s)

Kenji Kondo


[Package aglm version 0.4.0 Index]