residuals.pgam {pgam} | R Documentation |
Method for residuals extraction.
## S3 method for class 'pgam': residuals(object, type = "deviance", ...)
object |
object of class pgam holding the fitted model |
type |
type of residuals to be extracted. Default is deviance . Options are described in Details |
... |
further arguments passed to method |
The types of residuals available and a brief description are the following:
response
These are raw residuals of the form r_{t}=y_{t}-E(y_{t}|Y_{t-1}).
pearson
Pearson residuals are quite known and for this model they take the form r_{t}=(y_{t}-E(y_{t}|Y_{t-1}))/Var(y_{t}|Y_{t-1}).
deviance
Deviance residuals are estimated by r_{t}=sign(y_{t}-E(y_{t}|Y_{t-1}))*sqrt(d_{t}), where d_{t} is the deviance contribution of the t-th observation. See deviance.pgam
for details on deviance component estimation.
std_deviance
Same as deviance, but the deviance component is divided by (1-h_{t}), where h_{t} is the t-th element of the diagonal of the pseudo hat matrix of the approximating linear model. So they turn into r_{t}=sign(y_{t}-E(y_{t}|Y_{t-1}))*sqrt(d_{t}/(1-h_{t})).
The element h_{t} has the form h_{t}=omegaexp(eta_{t+1})/sum_{j=0}^{t-1}omega^{j}exp(eta_{t-j}), where eta is the predictor of the approximating linear model.
Vector of residuals of the model fitted.
Washington Leite Junger
wjunger@ims.uerj.br
Harvey, A. C., Fernandes, C. (1989) Time series models for count data or qualitative observations. Journal of Business and Economic Statistics, 7(4):407–417
Campos, E. L., De Leon, A. C. M. P., Fernandes, C. A. C. (2003) Modelo Poisson-Gama para Séries Temporais de Dados de Contagem - Teoria e Aplicações. 10a ESTE - Escola de Séries Temporais e Econometria
Junger, W. L. (2004) Modelo Poisson-Gama Semi-Paramétrico: Uma Abordagem de Penalização por Rugosidade. MSc Thesis. Rio de Janeiro, PUC-Rio, Departamento de Engenharia Elétrica
McCullagh, P., Nelder, J. A. (1989). Generalized Linear Models. Chapman and Hall, 2nd edition, London
Pierce, D. A., Schafer, D. W. (1986) Residuals in generalized linear models. Journal of the American Statistical Association, 81(396),977-986
library(pgam) data(aihrio) attach(aihrio) form <- ITRESP5~f(WEEK)+HOLIDAYS+rain+PM+g(tmpmax,7)+g(wet,3) m <- pgam(form,aihrio,omega=.8,beta=.01,maxit=1e2,eps=1e-4,optim.method="BFGS",partial.resid="response") r <- resid(m,"pearson") plot(r)