Predictions are made on the structural scale; the copula terms never
enter them, because they are endogeneity controls rather than part of
the causal model. With newdata = NULL the fitted values of the
structural model are returned. With newdata supplied,
structural must stay TRUE: predicting on the
transformed scale would need the whole panel of a unit, which single
new rows do not provide. Units in newdata that were not part of
the estimation sample have an unknown individual effect and get
NA, with a warning.
Usage
# S3 method for class 'copregpanel'
predict(object, newdata = NULL, structural = TRUE, ...)Arguments
- object
A fitted
"copregpanel"object.- newdata
An optional
data.framecarrying the panel identifier and the regressors of the model;NULL(the default) returns the fitted values on the estimation sample.- structural
Logical,
TRUEby default; must stayTRUEwhennewdatais supplied.- ...
Currently unused.
Value
A numeric vector of predictions, one per row of newdata
(or of the estimation sample when newdata is NULL).
Examples
# \donttest{
set.seed(1)
N <- 30L; Time <- 6L
d <- data.frame(id = rep(seq_len(N), each = Time),
year = rep(seq_len(Time), times = N))
alpha <- rep(rnorm(N), each = Time)
e <- rnorm(N * Time)
d$x <- exp(rnorm(N * Time) + 0.5 * e) # endogenous: correlated with e
d$z <- rnorm(N * Time) # exogenous
d$y <- alpha + 0.5 * d$x + d$z + e
fit <- CopRegPANEL(y ~ x | z, data = d, index = c("id", "year"),
nboots = 15, verbose = FALSE)
predict(fit)
#> 1 2 3 4 5 6
#> 1.44546508 0.66834012 0.81700289 -0.19393154 -0.06388554 0.29170856
#> 7 8 9 10 11 12
#> 2.21143700 0.59410300 1.31059876 1.90316677 1.51227529 2.63056302
#> 13 14 15 16 17 18
#> -0.87410321 -0.58578073 -0.95035574 1.00779036 -0.59976921 -0.80225815
#> 19 20 21 22 23 24
#> 3.50027530 1.89261933 1.44031839 2.22655252 2.95043812 1.33934141
#> 25 26 27 28 29 30
#> 1.22698873 2.44493012 2.44493085 0.63883846 1.33206461 2.84683909
#> 31 32 33 34 35 36
#> 4.22858964 0.30800598 0.44571812 -1.79427040 1.25513745 1.26183510
#> 37 38 39 40 41 42
#> -0.64900150 0.81571481 0.61504785 4.05177774 -0.44386507 1.76031252
#> 43 44 45 46 47 48
#> -0.36374619 0.69066427 1.55117364 2.02506470 1.35882592 1.30087191
#> 49 50 51 52 53 54
#> 0.46968085 1.20586812 0.88000368 2.33962301 0.99137415 1.69268676
#> 55 56 57 58 59 60
#> 3.83415034 -2.03811888 -0.69212694 -0.20820759 0.70273999 -1.93294449
#> 61 62 63 64 65 66
#> 3.57383759 3.10468263 2.03648039 10.45910667 2.24055340 4.38513030
#> 67 68 69 70 71 72
#> 0.22826332 -1.51152688 -1.15823497 1.16921727 -0.18726897 2.09044831
#> 73 74 75 76 77 78
#> 2.07604694 0.58334150 -0.03808712 0.45224286 -0.55262682 2.28755491
#> 79 80 81 82 83 84
#> 0.42048991 2.16924983 -2.40113479 -2.84654926 -0.72843123 -1.36798714
#> 85 86 87 88 89 90
#> 4.85874195 0.24559622 2.26001004 2.33992051 2.75126942 1.33860849
#> 91 92 93 94 95 96
#> 0.80423033 -0.51752863 2.81734769 0.19346548 4.82485567 5.63148702
#> 97 98 99 100 101 102
#> 0.06889917 -0.43478709 -2.01418626 0.77316922 0.08942130 2.27806512
#> 103 104 105 106 107 108
#> 0.02309268 0.68645784 4.60058022 0.06072587 1.00867305 -0.25631265
#> 109 110 111 112 113 114
#> 0.68075843 0.19079838 1.00648484 3.80408655 -0.39259449 0.32702344
#> 115 116 117 118 119 120
#> 1.55827824 2.20213119 -0.16806509 0.51367136 1.38145457 -0.45907742
#> 121 122 123 124 125 126
#> -1.62220450 -0.44880744 -0.29565493 1.55140666 0.11767292 1.13399108
#> 127 128 129 130 131 132
#> 2.62105901 1.70347148 0.82145285 2.83720508 1.53542667 1.42026956
#> 133 134 135 136 137 138
#> 0.59479256 1.14925179 0.38937395 -0.84306739 1.30809278 1.70593277
#> 139 140 141 142 143 144
#> 0.23645547 2.22302460 4.06117010 0.69644928 -0.44648191 -1.44462433
#> 145 146 147 148 149 150
#> 4.97700450 1.59750511 1.98096435 3.83592349 2.16195170 1.90179599
#> 151 152 153 154 155 156
#> -0.56496486 3.04032995 0.57736889 -0.02277345 1.57766638 0.55904076
#> 157 158 159 160 161 162
#> 1.07687753 0.86943548 -2.07420417 0.23660112 0.55426338 0.34484328
#> 163 164 165 166 167 168
#> -2.66878464 -1.45902655 -0.21300435 -2.18135847 -2.84926604 -0.74343717
#> 169 170 171 172 173 174
#> 0.15988673 1.94730481 0.24024089 3.47798535 1.21768370 0.05751085
#> 175 176 177 178 179 180
#> 0.67769444 3.37226437 0.61468208 1.49845779 0.24866535 1.89298101
predict(fit, newdata = d[1:6, ])
#> 1 2 3 4 5 6
#> 1.44546508 0.66834012 0.81700289 -0.19393154 -0.06388554 0.29170856
# }