## S3 method for class 'pgam':
residuals(object, type = "deviance", ...)
pgam
holding the fitted modeldeviance
. Options are described in Detailsresponse
These are raw residuals of the form $r_{t}=y_{t}-E\left(y_{t}|Y_{t-1}\right)$.
pearson
Pearson residuals are quite known and for this model they take the form $r_{t}=\left(y_{t}-E\left(y_{t}|Y_{t-1}\right)\right)/Var\left(y_{t}|Y_{t-1}\right)$.
deviance
Deviance residuals are estimated by $r_{t}=sign\left(y_{t}-E\left(y_{t}|Y_{t-1}\right)\right)*sqrt\left(d_{t}\right)$, 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\left(y_{t}-E\left(y_{t}|Y_{t-1}\right)\right)*sqrt\left(d_{t}/\left(1-h_{t}\right)\right)$.
The element $h_{t}$ has the form $h_{t}=\omega\exp\left(\eta_{t+1}\right)/\sum_{j=0}^{t-1}\omega^{j}\exp\left(\eta_{t-j}\right)$, where $\eta$ is the predictor of the approximating linear model.
adj_deviance
These are the deviance residuals multiplied by the coefficient of skewness estimated from the distribution. So, considering the negative binomial predictive distribution, they take the form $r_{t}=sign\left(y_{t}-E\left(y_{t}|Y_{t-1}\right)\right)*sqrt\left(d_{t}\right)*K$, where $K$ is estimated by $K=\left(2-btt1\right)/sqrt\left(att1*\left(1-btt1\right)\right)$.
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
pgam
, pgam.fit
, predict.pgam
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)
Run the code above in your browser using DataLab