Learn R Programming

tscount (version 1.4.3)

marcal: Predictive Model Assessment with a Marginal Calibration Plot

Description

The function produces a marginal calibration plot.

Usage

# S3 method for tsglm
marcal(object, plot=TRUE, ...)
# S3 method for default
marcal(response, pred, distr=c("poisson", "nbinom"), distrcoefs, plot=TRUE, ...)

Arguments

object

an object of class "tsglm".

plot

logical. If plot=TRUE (the default), the marginal calibration is plotted and the underlying data are returned invisibly only.

response

integer vector. Vector of observed values.

pred

numeric vector. Vector of predicted values.

distr

character giving the conditional distribution. Currently implemented are the Poisson ("poisson")and the Negative Binomial ("nbinom") distribution.

distrcoefs

numeric vector of additional coefficients specifying the conditional distribution. For distr="poisson" no additional parameters need to be provided. For distr="nbinom" the additional parameter size needs to be specified (e.g. by distrcoefs=2), see tsglm for details.

...

additional arguments to be passed to plot.

Value

Produces a plot of the difference between the average predictive cumulative distribution function (c.d.f.) and the empirical c.d.f. of the observations at each value between the highest and lowest observation of the time series (only for plot=TRUE).

Returns a list with elements x and y, where x are the threshold values and y the respective differences of predictive and empirical cumulative distribution function (invisibly for plot=TRUE).

Details

Marginal Calibration can be assessed by taking the difference between the average predictive cumulative distribution function (c.d.f.) and the empirical c.d.f. of the observations. Minor fluctuations about zero are expected if the marginal calibration hypothesis is true. For more information about marginal calibration see the refererences listed below.

References

Christou, V. and Fokianos, K. (2013) On count time series prediction. Journal of Statistical Computation and Simulation (published online), http://dx.doi.org/10.1080/00949655.2013.823612.

Czado, C., Gneiting, T. and Held, L. (2009) Predictive model assessment for count data. Biometrics 65, 1254--1261, http://dx.doi.org/10.1111/j.1541-0420.2009.01191.x.

Gneiting, T., Balabdaoui, F. and Raftery, A.E. (2007) Probabilistic forecasts, calibration and sharpness. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 69, 243--268, http://dx.doi.org/10.1111/j.1467-9868.2007.00587.x.

See Also

tsglm for fitting a GLM for time series of counts.

pit and scoring for other predictive model assessment tools.

Examples

Run this code
# NOT RUN {
###Campylobacter infections in Canada (see help("campy"))
campyfit <- tsglm(ts=campy, model=list(past_obs=1, past_mean=c(7,13)))
marcal(campyfit)
# }

Run the code above in your browser using DataLab