Skip to contents

Two scales are available. With structural = TRUE (the default) these are the fitted values of y = alpha_i + x'beta + z'delta + e on the original rows; with structural = FALSE they are the fitted values of the FOD-transformed model on the transformed rows.

Usage

# S3 method for class 'copregpanel'
fitted(object, structural = TRUE, ...)

Arguments

object

A fitted "copregpanel" object.

structural

Logical; TRUE (the default) for the fitted values of the structural model, FALSE for the fitted values of the FOD-transformed model.

...

Currently unused.

Value

A named numeric vector of fitted values.

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)
fitted(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 
fitted(fit, structural = FALSE)
#>            1            2            3            4            5            7 
#>  1.042150047  0.407515811  0.697761626 -0.251352797 -0.251443003  0.567162723 
#>            8            9           10           11           13           14 
#> -1.113604754 -0.610319510 -0.137377493 -0.790748834 -0.445507047 -0.223278139 
#>           15           16           17           19           20           21 
#> -0.709225796  1.395232659  0.143181301  1.397077157 -0.086350935 -0.633750721 
#>           22           23           25           26           27           28 
#>  0.066677359  1.139217410 -0.652275397  0.562828927  0.726609861 -1.184420874 
#>           29           31           32           33           34           35 
#> -1.071107302  3.590599229  0.014222211  0.177377078 -2.492565390 -0.004735951 
#>           37           38           39           40           41           43 
#> -1.833774269 -0.608303018 -1.017026063  2.770825248 -1.558588917 -1.596671756 
#>           44           45           46           47           49           50 
#> -0.776648814 -0.009018673  0.567641315  0.040979674 -0.869263358 -0.241543441 
#>           51           52           53           55           56           57 
#> -0.688107089  0.814530910 -0.495902906  4.261173709 -1.346545934 -0.184165708 
#>           58           59           61           62           63           64 
#>  0.332228098  1.863710368 -0.795432907 -1.498733560 -3.168310406  5.834900791 
#>           65           67           68           69           70           71 
#> -1.516444874  0.134864241 -1.779970298 -1.889985417  0.177692193 -1.610589333 
#>           73           74           75           76           77           79 
#>  1.396292568  0.041206743 -0.664366279 -0.339026682 -2.008311763  1.328647512 
#>           80           81           82           83           85           86 
#>  3.582427260 -0.652531883 -1.468338524  0.452234327  2.804030048 -1.723432307 
#>           87           88           89           91           92           93 
#>  0.101103182  0.240851437  0.998902123 -1.630109157 -3.474239277 -0.634440139 
#>           94           95           97           98           99          100 
#> -4.110820123 -0.570374495 -0.063387285 -0.640771605 -2.650965659 -0.335232257 
#>          101          103          104          105          106          107 
#> -1.547604884 -1.092644600 -0.596546069  3.749501549 -0.257567383  0.894479966 
#>          109          110          111          112          113          115 
#> -0.279704851 -0.890359069 -0.207575023  3.132792933 -0.508846722  0.788953554 
#>          116          117          118          119          121          122 
#>  1.686116303 -0.560100134  0.042852017  1.301452651 -1.856712062 -0.962100776 
#>          123          124          125          127          128          129 
#> -1.065221481  0.755728543 -0.718645461  0.874068326  0.044616661 -0.960867536 
#>          130          131          133          134          135          136 
#>  1.109910313  0.081428373 -0.134305424  0.455414385 -0.289493912 -1.918832418 
#>          137          139          140          141          142          143 
#> -0.281315357 -0.713364882  1.347361822  3.861944239  1.340689342  0.705793271 
#>          145          146          147          148          149          151 
#>  2.447750539 -0.780525262 -0.564873189  1.473000371  0.183957867 -1.562188135 
#>          152          153          154          155          157          158 
#>  2.117560223 -0.110223963 -0.890901479  0.720277086  0.995658926  0.987500909 
#>          159          160          161          163          164          165 
#> -2.124164106 -0.173874750  0.148082372 -1.076791629  0.033755644  1.482360859 
#>          166          167          169          170          171          172 
#> -0.314356784 -1.489045872 -1.121241377  0.625159536 -1.164070130  2.319167155 
#>          173          175          176          177          178          179 
#>  0.820366088 -0.773855003  2.064845822 -0.518477259  0.349162199 -1.162706751 
# }