# Predicts Method for Time Series of Counts Following Generalised Linear Models

### Description

Predict future observations based on a fitted GLM-type model for time series of counts.

### Usage

1 2 3 4 5 6 |

### Arguments

`object` |
an object of class |

`n.ahead` |
positive integer value giving the number of steps ahead for which predictions should be made. |

`newobs` |
integer vector of known future observations of the time series. This argument is only relevant if more than one observation ahead is to be predicted ( |

`newxreg` |
matrix or vector containing new values for the covariates to be used for prediction. If |

`level` |
numeric value determining the desired coverage rate of prediction intervals. If |

`global` |
logical value saying whether the coverage rate for |

`type` |
character value saying how the prediction interval shall be constructed. If |

`method` |
character value saying which method to be used for computing the prediction intervals. If |

`B` |
positive integer value giving the number of samples of a parametric bootstrap to use for numerical determination of prediction intervals (only necessary if argument |

`estim` |
character value saying how the prediction intervals shall account for the additional uncertainty induced by the parameter estimation. This is particularly important if the model was fitted on a short time series. If |

`B_estim` |
positive integer value giving the number of parameters used for resampling to account for estimation uncertainty. Only necessary for |

`coefs_given` |
table with parameters in the rows. Only necessary for |

`...` |
further arguments are currently ignored. Only for compatibility with generic function. |

### Details

Returns predictions for the `n.ahead`

observations following the fitted time series contained in argument `object`

. The 1-step-ahead prediction is the conditional expectation of the observation to be predicted given the past. The true parameters are replaced by their estimations given in argument `object`

. For a 2-step-ahead-prediction the true previous observation is used when given in argument `newobs`

, otherwise it is replaced by the 1-step-ahead prediction computed before. For a 3-step-prediction this holds for the previous two observations, which are replaced by their respective predictions if not available, and so on.

Unless `level=0`

, the function also returns prediction intervals. Read the description of the arguments `type`

and`method`

for further details on the computation. Note that the prediction intervals do not reflect the additional uncertainty induced by the parameter estimation. However, for sufficiently long time series used for model fitting, it is expected that this uncertainty is negligible compared to the uncertainty of the predictive distribution. The argument `estim`

allows to account fot this additional estimation uncertainty if `method="bootstrap"`

, see the description of this argument.

If prediction intervals are computed the function additionally returns the median of the predictive distribution. If `method="conddistr"`

this is the analytical median of the conditional distribution, otherwise the empirical median of the simulated distribution.

### Value

A list with at least the following element:

`pred` |
a numeric vector of the predictions. Has class |

If prediction intervals are calculated, the list has the additional element:

`interval` |
a matrix with the columns |

`level` |
a numeric value determining the desired coverage rate of prediction intervals. |

`global` |
a logical value saying whether the coverage rate |

`type` |
a character value saying how the prediction intervals were computed. Possible values are |

`method` |
a character value saying which method were used for computation of prediction intervals. Possible values are |

`B` |
an integer value giving the number of bootstrap samples which were used for computing prediction intervals. Is |

`estim` |
a character value saying how the prediction intervals account for estimation uncertainty of the model parameters. Possible values are |

`B_estim` |
an integer value giving the number of parameter values used for resampling to account for estimation uncertainty. This value is zero if the estimation uncertainty is ignored. |

`warning_messages` |
a character vector containing warning messages. This should be |

`median` |
a vector giving the median of the predictive distribution for each of the future time points. Has class |

### Author(s)

Tobias Liboschik and Philipp Probst

### See Also

`tsglm`

for fitting a GLM for time series of counts.

### Examples

1 2 3 4 | ```
###Campylobacter infections in Canada (see help("campy"))
campyfit <- tsglm(ts=campy, model=list(past_obs=1, past_mean=c(7,13)))
predict(campyfit, n.ahead=1) #prediction interval using conditional distribution
predict(campyfit, n.ahead=5, global=TRUE) #prediction intervals using parametric bootstrap
``` |