Skip to contents

Trivial accessors for a fitted "copreg" object, following the usual lm()-style generics. coef() returns the coefficients of the augmented regression (structural regressors and copula terms together), vcov() their bootstrap covariance matrix, nobs() the number of observations used, and formula() the two- or three-part Formula the model was fitted with.

Usage

# S3 method for class 'copreg'
coef(object, ...)

# S3 method for class 'copreg'
vcov(object, ...)

# S3 method for class 'copreg'
nobs(object, ...)

# S3 method for class 'copreg'
formula(x, ...)

Arguments

object, x

a fitted model of class "copreg", as returned by one of the cross-sectional estimator functions (e.g. CopRegPG(), CopReg2sCOPE()).

...

currently unused; present for method consistency.

Value

coef returns a named numeric vector of the augmented regression coefficients (the structural regressors' coefficients followed by the copula terms'). vcov returns the corresponding bootstrap covariance matrix, with matching row and column names. nobs returns the number of observations used in the fit, as a single integer. formula returns the two- or three-part Formula object (endogenous | exogenous | discrete) the model was fitted with.

References

Qian, Y., A. Koschmann, and H. Xie (2025). A practical guide to endogeneity correction using copulas. Journal of Marketing.

Examples

set.seed(1)
n  <- 150
w  <- rnorm(n)
p  <- 0.4 * w + rt(n, df = 3)
xi <- 0.5 * p + rnorm(n)
y  <- 1 + 2 * p + 1.5 * w + xi
dat <- data.frame(y = y, p = p, w = w)

fit <- endogCopula:::.copreg_fit(
  formula = y ~ p | w, data = dat,
  ctor = endogCopula:::.ctor_twostage(TRUE),
  method = "2sCOPE", cdf = "rank.n", ties = "max",
  nboots = 25, verbose = FALSE)

coef(fit)
#> (Intercept)           p           w       p_cop 
#>   0.8776032   2.8387045   1.4293344  -0.5092000 
vcov(fit)
#>               (Intercept)             p             w        p_cop
#> (Intercept)  0.0083106040 -0.0002842064  0.0009440729  0.003448208
#> p           -0.0002842064  0.0517789378 -0.0121223049 -0.079621463
#> w            0.0009440729 -0.0121223049  0.0134089215  0.017620101
#> p_cop        0.0034482078 -0.0796214629  0.0176201005  0.132615426
nobs(fit)
#> [1] 150
formula(fit)
#> y ~ p | w
#> <environment: 0x55e6efbc3640>