Usage
procast(
object,
newdata = NULL,
na.action = na.pass,
type = "distribution",
at = 0.5,
drop = FALSE,
...
)
## Default S3 method:
procast(
object,
newdata = NULL,
na.action = na.pass,
type = c("distribution", "mean", "variance", "quantile", "probability", "density",
"loglikelihood", "parameters", "kurtosis", "skewness"),
at = 0.5,
drop = FALSE,
...
)
## S3 method for class 'lm'
procast(
object,
newdata = NULL,
na.action = na.pass,
type = "distribution",
at = 0.5,
drop = FALSE,
...,
sigma = "ML"
)
## S3 method for class 'glm'
procast(
object,
newdata = NULL,
na.action = na.pass,
type = "distribution",
at = 0.5,
drop = FALSE,
...,
dispersion = NULL
)
## S3 method for class 'bamlss'
procast(
object,
newdata = NULL,
na.action = na.pass,
type = "distribution",
at = 0.5,
drop = FALSE,
...,
distributions3 = FALSE
)
## S3 method for class 'disttree'
procast(
object,
newdata = NULL,
na.action = na.pass,
type = "distribution",
at = 0.5,
drop = FALSE,
...,
distributions3 = FALSE
)
Details
The function procast
provides a unified framework for probabilistic forcasting (or procasting, for short) based on probabilistic (regression) models, also known as distributional regression approaches. Typical types of predictions include quantiles, probabilities, (conditional) expectations, variances, and (log-)densities. Internally, procast
methods typically compute the predicted parameters for each observation and then compute the desired outcome for the distributions with the respective parameters.
Some quantities, e.g., the moments of the distribution (like mean or variance), can be computed directly from the predicted parameters of the distribution while others require an additional argument at
which the distribution is evaluated (e.g., the probability of a quantile or an observation of the response).
The default procast
method leverages the S3 classes and methods for probability distributions from the distributions3 package. In a first step the predicted probability distribution object is obtained and, by default (type = “distribution”
), returned in order to reflect the distributional nature of the forecast. For all other type
s (e.g., “mean”
, “quantile”
, or “density”
), the corresponding extractor methods (e.g., mean
, quantile
, or pdf
) are used to compute the desired quantity from the distribution objects. The examples provide some worked illustrations.
Package authors or users, who want to enable procast
for new types of model objects, only need to provide a suitable prodist
extractor for the predicted probability distribution. Then the default procast
works out of the box. However, if the distributions3 package does not support the necessary probability distribution, then it may also be necessary to implement a new distribution objects, see apply_dpqr
.