solve_eecop: Generic solver for copula-based estimating equations

View source: R/predict.R

solve_eecopR Documentation

Generic solver for copula-based estimating equations

Description

Solves an estimating equation based on a fitted eecop model and user-supplied identifying function.

Usage

solve_eecop(object, x, idfun, theta_start, ...)

Arguments

object

a fitted eecop object.

x

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

idfun

a function with signature ⁠function(y, theta)⁠ with y the response (vector or matrix) and theta the parameter of interest. The function should return a vector of length NROW(object$y) or a matrix with NROW(object$y) rows.

theta_start

starting values for optimizing the parameter of interest.

...

further arguments passed to optim().

Value

The optimal parameter theta.

Examples

## fit dummy model
x <- matrix(rnorm(200), 100, 2)
y <- rowSums(x) + rnorm(100)
fit <- eecop(y, x)

## identifying function for 0.5 and 0.9 quantiles
idfun <- function(y, theta) {
  t <- c(0.5, 0.9)
  gmat <- matrix(NA, NROW(y), 2)
  for (j in 1:2) gmat[, j] <- (y <= theta[j]) - t[j]
  gmat
}

## solve estimating equation
solve_eecop(fit, x[1:3, ], idfun = idfun, theta_start = rep(0, 2))

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