pitresiduals | R Documentation |
Generic function and methods for computing PIT residuals.
pitresiduals(object, ...) ## Default S3 method: pitresiduals( object, newdata = NULL, scale = c("uniform", "normal"), type = c("random", "quantile"), nsim = 1L, delta = NULL, prob = NULL, ... )
object |
an object. For the |
... |
further parameters passed to methods. |
newdata |
optionally, a data frame in which to look for variables with which to predict. If omitted, the original observations are used. |
scale |
On which scale should the PIT residuals be shown; on the probability scale
( |
type |
character specifying whether - in the case of discrete response distributions - randomized quantile residuals or their corresponding quantiles should be computed. |
nsim |
numeric. The number of simulated randomized quantile residuals
per observation (for |
delta |
numeric. The minimal difference to compute the range of
proabilities corresponding to each observation according to get (randomized)
quantile residuals. For |
prob |
numeric. The probabilities at which quantile residuals should be
computed (for |
For regression models with a continuous response distribution, PIT residuals
are simply the predictive cumulative distribution (CDF) evaluated at the
observations (Dawid, 1984). For discrete distributions, a random value is drawn
from the range of probabilities corresponding to each observation similar to
the approach of Dunn and Smyth (1996) to gain (randomized) quantile residuals
(qresiduals
). PIT values have been used under various names, but
to emphasize their similar properties to residuals we follow Warton (2017) and
refer to them as PIT residuals.
With the method pitresiduals
, the PIT residuals can also be transformed
from the probability scale to another distribution scale. Supported quantile
scales are uniformly (uniform
) and normally (normal
) distributed.
Probabilites can be either a vector or a 2-column matrix of probabilities. The
latter offers to either draw "random"
samples from the distribution or
compute corresponding "quantile"
s such as the median etc. For
(randomized) quantile residuals (on the normal scale), as suggested by Dunn and Smyth (1996),
the scale
must be set to "normal"
or
qresiduals
can be called directly.
A vector or matrix of PIT residuals.
Dunn KP, Smyth GK (1996). “Randomized Quantile Residuals.” Journal of Computational and Graphical Statistics, 5(3), 236–244. doi: 10.2307/1390802
Dawid AP (1984). “Present Position and Potential Developments: Some Personal Views: Statistical Theory: The Prequential Approach.” Journal of the Royal Statistical Society: Series A (General), 147(2), 278–92. doi: 10.2307/2981683.
Warton DI, Thibaut L, Wang YA (2017) “The Pit-Trap–a ‘Model-Free’ Bootstrap Procedure for Inference About Regression Models with Discrete, Multivariate Responses”. PLOS ONE, 12(7), 1–18. doi: 10.1371/journal.pone.0181790.
qnorm
, qqrplot
## linear regression models (homoscedastic Gaussian response) m <- lm(dist ~ speed, data = cars) pitresiduals(m)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.