predict.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 |
forecast |
if |
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≤ft(y_{t}|Y_{t-1}\right)=a_{t|t-1}/b_{t|t-1}
and
Var≤ft(y_{t}|Y_{t-1}\right)=a_{t|t-1}≤ft(1+b_{t|t-1}\right)/b_{t|t-1}^{2}
Deviance components are estimated as follow
D≤ft(y;\hatμ\right)=2∑_{t=τ+1}^{n}{a_{t|t-1}\log ≤ft(\frac{a_{t|t-1}}{y_{t}b_{t|t-1}}\right)-≤ft(a_{t|t-1}+y_{t}\right)\log \frac{≤ft(y_{t}+a_{t|t-1}\right)}{≤ft(1+b_{t|t-1}\right)y_{t}}}
Generalized Pearson statistics has the form
X^{2}=∑_{t=τ+1}^{n}\frac{≤ft(y_{t}b_{t|t-1}-a_{t|t-1}\right)^{2}} {a_{t|t-1}≤ft(1+b_{t|t-1}\right)}
Approximate scale parameter is given by the expression
\hatφ=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) Semiparametric Poisson-Gamma models: a roughness penalty approach. MSc Dissertation. Rio de Janeiro, PUC-Rio, Department of Electrical Engineering.
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
pgam
, residuals.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") p <- predict(m)$yhat plot(ITRESP5) lines(p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.