Predictions always use the structural model, y = mu + P alpha + W beta: copula terms are endogeneity controls, not part of the causal model, and never enter a prediction.
Usage
# S3 method for class 'copreg'
predict(object, newdata = NULL, ...)Value
A numeric vector of predictions (or, when newdata is
omitted, the in-sample structural fitted values).
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)
predict(fit)
#> 1 2 3 4 5 6
#> 0.85068540 7.04895584 -2.81162664 -2.04848540 3.18540066 1.32313294
#> 7 8 9 10 11 12
#> 1.10405874 -0.31002028 0.54931481 -3.69243248 4.43303094 -4.02853276
#> 13 14 15 16 17 18
#> 1.51118406 -7.67205027 6.63327181 0.47069046 -2.01427158 -0.23424496
#> 19 20 21 22 23 24
#> 13.84469473 -6.42280274 3.31077683 1.78387825 4.34309493 -5.03384945
#> 25 26 27 28 29 30
#> 2.74239239 -2.45514135 6.72623640 12.79649600 -6.36820854 -0.69218543
#> 31 32 33 34 35 36
#> -1.16748437 -4.46693794 3.05051984 1.67358862 -4.05530450 -0.20050702
#> 37 38 39 40 41 42
#> 3.10023466 -1.20625234 -5.85835504 2.48948123 -4.00150677 0.98452465
#> 43 44 45 46 47 48
#> 6.12052918 2.08515675 -3.81972778 0.02508309 -0.46536734 3.93194441
#> 49 50 51 52 53 54
#> -8.72992559 0.96632525 9.50402986 7.85172606 3.51676879 -4.97661479
#> 55 56 57 58 59 60
#> 6.05993621 12.63915717 2.63625388 2.54105987 -4.70102603 6.32479163
#> 61 62 63 64 65 66
#> 8.83875047 0.56942491 6.46083181 8.80851428 4.01932801 5.40518030
#> 67 68 69 70 71 72
#> -12.87024635 2.28732060 7.67943700 5.25789060 4.13811114 0.90652967
#> 73 74 75 76 77 78
#> -0.30742924 1.30502623 -1.35360496 -0.77523598 -0.07174603 -0.78742603
#> 79 80 81 82 83 84
#> 6.55936883 -0.57825607 -3.94039407 0.05643882 7.67717968 -1.05133558
#> 85 86 87 88 89 90
#> 2.02627600 6.74816817 2.33871459 -5.34174629 -0.98808690 -3.77956205
#> 91 92 93 94 95 96
#> -8.26467599 -1.90764388 1.36247908 -1.40301204 -2.02221435 6.74884502
#> 97 98 99 100 101 102
#> 4.78043114 1.05590645 -0.89631569 -0.80339379 8.15651091 0.51858941
#> 103 104 105 106 107 108
#> -2.17082349 0.06873905 -0.62668323 14.84571598 4.89528709 10.90939674
#> 109 110 111 112 113 114
#> 2.18863783 -2.35065035 0.45355978 -3.37032919 4.65889826 -1.01144688
#> 115 116 117 118 119 120
#> 4.40767377 3.01175228 -0.12534950 3.54845838 4.37386410 -0.22679330
#> 121 122 123 124 125 126
#> -0.78431716 2.74664688 -0.10360041 -5.53774736 2.28165444 0.66515976
#> 127 128 129 130 131 132
#> -1.28543167 -4.59754148 2.42571020 0.22834597 -3.53879026 5.22045623
#> 133 134 135 136 137 138
#> -0.67617643 26.71565565 -0.42919612 -5.98140876 -2.42170387 0.09698808
#> 139 140 141 142 143 144
#> -0.75033783 6.69653763 -20.55494277 7.47989237 -2.37242821 -3.23579033
#> 145 146 147 148 149 150
#> -8.98783718 -3.83464718 6.16761899 -1.91485820 -4.38562185 -6.94723040
predict(fit, newdata = data.frame(p = c(0, 1), w = c(0, 0)))
#> 1 2
#> 0.8776032 3.7163077
