predict.eecop: Prediction of quantiles or expectiles

View source: R/predict.R

predict.eecopR Documentation

Prediction of quantiles or expectiles

Description

Predicts quantiles, expectiles, mean vectors, or covariate matrices from an eecop() model by solving a weighted estimating equations as in Nagler and Vatter (2020).

Usage

## S3 method for class 'eecop'
predict(object, x, type = "expectile", t = 0.5, trafo = function(y) y, ...)

Arguments

object

an eecop object.

x

covariate values to predict on; must match the format used for fitting the eecop() model.

type

either "quantile", "expectile", "mean", or "variance".

t

a vector of quantile/expectile levels.

trafo

a function with signature ⁠function(y)⁠ with y the response (vector or matrix). The function should return a vector of length NROW(object$y) or a matrix with NROW(object$y) rows.'

...

unused.

Value

For "quantile" and "expectile": a matrix of predictions, each column corresponding to one t (in the order they were supplied to predict(). For "mean", a matrix containing the predicted mean vectors in the rows. For "variance" an 3-dimensional array containing the predicted variance/covariance matrices.

References

Nagler, T. and Vatter, T. (2020). Solving estimating equations with copulas. arXiv:1801.10576

Examples

# univariate response
x <- matrix(rnorm(200), 100, 2)
y <- rowSums(x) + rnorm(100)

fit <- eecop(y, x)
predict(fit, x[1:3, ], t = c(0.5, 0.9), type = "quantile")
predict(fit, x[1:3, ], t = c(0.5, 0.9), type = "expectile")

# multivariate response
y <- cbind(y1 = y, y2 = y + rnorm(100))
fit <- eecop(y, x)

predict(fit, x[1:3, ], type = "mean")
predict(fit, x[1:3, ], type = "variance")
predict(fit, x[1:3, ], type = "quantile", trafo = function(y) y[, 1] + y[, 2])

tnagler/eecop documentation built on June 12, 2024, 12:57 a.m.