eecop: Copula regression models based on estimating equations

View source: R/eecop.R

eecopR Documentation

Copula regression models based on estimating equations

Description

Implements the copula regression estimators of Nagler and Vatter (2020). A model for marginal distributions and copula between response and covariates is estimated. Predictions for quantiles or expectiles can then be derived from solving a weighted estimating equations.

Usage

eecop(
  y,
  x,
  copula_method = "vine",
  margin_method = "kde",
  weights = numeric(),
  ...
)

Arguments

y

vector with numeric response values.

x

vector, matrix, or data.frame with covariate values (rows are observations).

copula_method

method for estimating the copula(s); one of ⁠vine", "normal", "kde"⁠ for vine copula, Gaussian copula, and transformation kernel density method, respectively.

margin_method

method for estimating marginal distributions; one of ⁠"kde", "normal"⁠ for kernel density or Gaussian margins, respectively.

weights

optional; a vector of weights for each observation.

...

further arguments passed to rvinecopulib::vinecop().

Details

Both y and x may contain discrete variables, which must be passed as ordered() or factor() variables.

Value

An object of class eecop. Use predict.eecop() to predict quantiles or expectiles. For other estimating equations, the weights w(x) = c_{YX}(Y, x)/ c_Y(Y) can be computed from object$w(x).

References

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

See Also

predict.eecop()

Examples

# model with continuous variables
x <- matrix(rnorm(200), 100, 2)
y <- rowSums(x) + rnorm(100)

fit <- eecop(y, x)

predict(fit, x, t = c(0.5, 0.9), type = "quantile")
predict(fit, x, t = c(0.5, 0.9), type = "expectile")

# model with discrete covariates
x <- as.data.frame(matrix(rbinom(200, 5, 0.3), 100, 2))
y <- rowSums(x) + rnorm(100)
for (k in 1:2) {
  x[, k] <- ordered(x[, k], levels = 0:5)
}

fit <- eecop(y, x)

predict(fit, x, t = c(0.5, 0.9), type = "quantile")
predict(fit, x, t = c(0.5, 0.9), type = "expectile")

# multivariate responses
x1 <- rnorm(100, mean = 2)
x2 <- rnorm(100, sd = 2)
y1 <- x1 + abs(x2) * rnorm(100)
y2 <- -x1 + abs(x2) * rnorm(100)

y <- cbind(y1, y2)
x <- cbind(x1, x2)

fit <- eecop(y, x)

predict(fit, x[1:3, ], type = "mean")
predict(fit, x[1:3, ], type = "variance")

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