Learn R Programming

glarma (version 1.6-0)

normRandPIT: Random normal probability integral transformation

Description

Function to create the normalized conditional (randomized) quantile residuals.

Usage

normRandPIT(object)

Arguments

object

an object of class "glarma"

Value

A list consisting of two elements:

rt

the normalized conditional (randomized) quantile residuals

rtMid

the midpoints of the predictive probability intervals

Details

The function glarmaPredProb produces the non-randomized probability integral transformation (PIT). It returns estimates of the cumulative predictive probabilities as upper and lower bounds of a collection of intervals. If the model is correct, a histogram drawn using these estimated probabilities should resemble a histogram obtained from a sample from the uniform distribution. This function aims to produce observations which instead resemble a sample from a normal distribution. Such a sample can then be examined by the usual tools for checking normality, such as histograms, Q-Q normal plots and for checking independence, autocorrelation and partial autocorrelation plots, and associated portmanteau statistics.

For each of the intervals produced by glarmaPredProb, a random uniform observation is generated, which is then converted to a normal observation by applying the inverse standard normal distribution function (that is qnorm). The vector of these values is returned by the function in the list element rt. In addition non-random observations which should appear similar to a sample from a normal distribution are obtained by applying qnorm to the mid-points of the predictive distribution intervals. The vector of these values is returned by the function in the list element rtMid.

References

Berkowitz, J. (2001) Testing density forecasts, with applications to risk management. Journal of Business \& Economic Statistics, 19, 465--474.

Dunn, Peter K. and Smyth, Gordon K. (1996) Randomized quantile residuals. Journal of Computational and Graphical Statistics, 5, 236--244.

See Also

See also as glarmaPredProb.

Examples

Run this code
# NOT RUN {
data(DriverDeaths)
y <- DriverDeaths[, "Deaths"]
X <- as.matrix(DriverDeaths[, 2:5])
Population <- DriverDeaths[, "Population"]

### Offset included
glarmamodOffset <- glarma(y, X, offset = log(Population/100000),
                          phiLags = c(12),
                          type = "Poi", method = "FS",
                          residuals = "Pearson", maxit = 100, grad = 1e-6)
rt <- normRandPIT(glarmamodOffset)$rt
par(mfrow = c(2,2))
hist(rt, main = "Histogram of Randomized Residuals",
     xlab = expression(r[t]))
box()
qqnorm(rt, main = "Q-Q Plot of  Randomized Residuals" )
abline(0, 1, lty = 2)
acf(rt, main = "ACF of Randomized Residuals")
pacf(rt, main = "PACF of Randomized Residuals")
# }

Run the code above in your browser using DataLab