predict.pgam {pgam} | R Documentation |
Prediction and forecasting of the fitted model.
## S3 method for class 'pgam': predict(object, forecast = FALSE, k = 1, x = NULL, ...)
object |
object of class pgam holding the fitted model |
forecast |
if TRUE the function tries to forecast |
k |
steps for forecasting |
x |
covariate values for forecasting if the model has covariates. Must have the k rows and p columns |
... |
further arguments passed to method |
It estimates predicted values, their variances, deviance components, generalized Pearson statistics components, local level, smoothed prediction and forecast.
Considering a Poisson process and a gamma priori, the predictive distribution of the model is negative binomial with parameters a_{t|t-1} and b_{t|t-1}. So, the conditional mean and variance are given by
E(y_{t}|Y_{t-1})=a_{t|t-1}/b_{t|t-1}
and
Var(y_{t}|Y_{t-1})=a_{t|t-1}(1+b_{t|t-1})/b_{t|t-1}^{2}
Deviance components are estimated as follow
D(y;hatμ)=2sum_{t=tau+1}^{n}{a_{t|t-1}log (frac{a_{t|t-1}}{y_{t}b_{t|t-1}})-(a_{t|t-1}+y_{t})log frac{(y_{t}+a_{t|t-1})}{(1+b_{t|t-1})y_{t}}}
Generalized Pearson statistics has the form
X^{2}=sum_{t=tau+1}^{n}frac{(y_{t}b_{t|t-1}-a_{t|t-1})^{2}} {a_{t|t-1}(1+b_{t|t-1})}
Approximate scale parameter is given by the expression
hatphi=frac{X^{2}}{edf}
where edf is the number o degrees of reedom of the fitted model.
List with those described in Details
Washington Leite Junger wjunger@ims.uerj.br and Antonio Ponce de Leon ponce@ims.uerj.br
Green, P. J., Silverman, B. W. (1994) Nonparametric Regression and Generalized Linear Models: a roughness penalty approach. Chapman and Hall, London
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
Junger, W. L. (2004) Modelo Poisson-Gama Semi-Parametrico: Uma Abordagem de Penalizacao por Rugosidade. MSc Thesis. Rio de Janeiro, PUC-Rio, Departamento de Engenharia Eletrica
Harvey, A. C. (1990) Forecasting, structural time series models and the Kalman Filter. Cambridge, New York
Hastie, T. J., Tibshirani, R. J.(1990) Generalized Additive Models. Chapman and Hall, London
McCullagh, P., Nelder, J. A. (1989). Generalized Linear Models. Chapman and Hall, 2nd edition, London
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") p <- predict(m)$yhat plot(ITRESP5) lines(p)