Returns the variance-covariance matrix of the main parameters of a fitted PLN() model object. The main parameters of the model correspond to $$B$$, as returned by coef.PLNfit(). The function can also be used to return the variance-covariance matrix of the residuals. The latter matrix can also be accessed via sigma.PLNfit()

# S3 method for PLNfit
vcov(object, type = c("main", "covariance"), ...)

Arguments

object

an R6 object with class PLNfit

type

type of parameter that should be extracted. Either "main" (default) for $$B$$ or "covariance" for $$\Sigma$$

...

additional parameters for S3 compatibility. Not used

Value

A matrix of variance/covariance extracted from the PLNfit model. If type="main" and \(B\) is a matrix of size d * p, the result is a block-diagonal matrix with p (number of species) blocks of size d (number of covariates). if type="main", it is a symmetric matrix of size p. .

Examples

data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myPLN <- PLN(Abundance ~ 1 + offset(log(Offset)), data = trichoptera)
#> 
#>  Initialization...
#>  Adjusting a full covariance PLN model with nlopt optimizer
#>  Post-treatments...
#>  DONE!
vcov(myPLN, type = "covariance") ## Sigma
#>              Che          Hyc         Hym         Hys           Psy
#> Che  2.525696262 -0.008889967  0.36027330  0.44486018 -0.0178286663
#> Hyc -0.008889967  1.902834377  0.11148304  0.27076270 -0.1460638197
#> Hym  0.360273301  0.111483044  1.24452604  0.86586029 -0.1185245031
#> Hys  0.444860180  0.270762697  0.86586029  2.66473064 -0.1467390342
#> Psy -0.017828666 -0.146063820 -0.11852450 -0.14673903  0.0760951060
#> Aga  0.308718806 -0.132013432  0.51328365  0.42537030  0.0014322554
#> Glo  0.089491453  0.171747059  0.21033964  0.34353031 -0.0498965778
#> Ath  0.351997701  0.110806937  0.38595496  0.60848949 -0.0481522022
#> Cea -0.009267821  0.005493519 -0.02087036 -0.01572361  0.0002240197
#> Ced  0.337607492  0.222051227  0.50814378  0.68169904 -0.0982107956
#> Set -0.058763359  0.476607081 -0.18154484  0.13917373 -0.0913642510
#> All  0.272171175 -0.263256988  0.68023706  0.36946459 -0.0046224011
#> Han -0.183749462  0.623581723  0.20911232  0.13492705 -0.2887434511
#> Hfo -0.360194140  0.557687955 -0.38889288 -0.17842050 -0.1455521608
#> Hsp -0.441378467  0.671299294 -0.33075908 -0.17368654 -0.1916044191
#> Hve  0.311973113 -0.130460973  0.16145128  0.24183231  0.0453625525
#> Sta  0.363707224  0.255974709  0.47815928  0.61431349 -0.1213001472
#>              Aga          Glo          Ath           Cea         Ced
#> Che  0.308718806  0.089491453  0.351997701 -0.0092678210  0.33760749
#> Hyc -0.132013432  0.171747059  0.110806937  0.0054935194  0.22205123
#> Hym  0.513283648  0.210339636  0.385954958 -0.0208703617  0.50814378
#> Hys  0.425370300  0.343530307  0.608489489 -0.0157236060  0.68169904
#> Psy  0.001432255 -0.049896578 -0.048152202  0.0002240197 -0.09821080
#> Aga  1.101578757 -0.064094359  0.197020809 -0.0218363758  0.21879584
#> Glo -0.064094359  1.118559091  0.225551635  0.0016621253  0.22693613
#> Ath  0.197020809  0.225551635  1.374600282 -0.0065870434  0.44325799
#> Cea -0.021836376  0.001662125 -0.006587043  0.0420661716 -0.00737414
#> Ced  0.218795840  0.226936125  0.443257994 -0.0073741396  0.95835860
#> Set -0.301737821  0.293415478  0.097936608  0.0149285852  0.19523267
#> All  0.592832929 -0.077292625  0.088158499 -0.0242050007  0.08003542
#> Han -0.173249089 -0.189928168 -0.197882342  0.0044098369  0.05610323
#> Hfo -0.809757806  0.301569164 -0.154089568  0.0264132114 -0.12772661
#> Hsp -0.778892849  0.253818503 -0.214399448  0.0246539660 -0.11030576
#> Hve  0.186616730  0.088845278  0.241904609 -0.0068928218  0.20452202
#> Sta  0.440007243  0.016756529  0.308476215 -0.0133814740  0.43463890
#>             Set          All          Han         Hfo         Hsp          Hve
#> Che -0.05876336  0.272171175 -0.183749462 -0.36019414 -0.44137847  0.311973113
#> Hyc  0.47660708 -0.263256988  0.623581723  0.55768796  0.67129929 -0.130460973
#> Hym -0.18154484  0.680237057  0.209112319 -0.38889288 -0.33075908  0.161451277
#> Hys  0.13917373  0.369464586  0.134927055 -0.17842050 -0.17368654  0.241832309
#> Psy -0.09136425 -0.004622401 -0.288743451 -0.14555216 -0.19160442  0.045362552
#> Aga -0.30173782  0.592832929 -0.173249089 -0.80975781 -0.77889285  0.186616730
#> Glo  0.29341548 -0.077292625 -0.189928168  0.30156916  0.25381850  0.088845278
#> Ath  0.09793661  0.088158499 -0.197882342 -0.15408957 -0.21439945  0.241904609
#> Cea  0.01492859 -0.024205001  0.004409837  0.02641321  0.02465397 -0.006892822
#> Ced  0.19523267  0.080035419  0.056103234 -0.12772661 -0.11030576  0.204522016
#> Set  1.58461789 -0.682673708 -0.041649354  0.80528196  0.76519763 -0.040055945
#> All -0.68267371  1.806384100  0.028266637 -0.73716820 -0.65633758  0.146813706
#> Han -0.04164935  0.028266637  3.659210234  0.61884176  0.98573915 -0.600081826
#> Hfo  0.80528196 -0.737168205  0.618841759  2.71280679  1.61721155 -0.339587343
#> Hsp  0.76519763 -0.656337582  0.985739154  1.61721155  2.49943271 -0.478673075
#> Hve -0.04005595  0.146813706 -0.600081826 -0.33958734 -0.47867308  1.347221211
#> Sta  0.05519276  0.199649842  0.464261169 -0.25379463 -0.19247242  0.143839484
#>             Sta
#> Che  0.36370722
#> Hyc  0.25597471
#> Hym  0.47815928
#> Hys  0.61431349
#> Psy -0.12130015
#> Aga  0.44000724
#> Glo  0.01675653
#> Ath  0.30847621
#> Cea -0.01338147
#> Ced  0.43463890
#> Set  0.05519276
#> All  0.19964984
#> Han  0.46426117
#> Hfo -0.25379463
#> Hsp -0.19247242
#> Hve  0.14383948
#> Sta  1.02926865