Log-likelihood scores for S-vine copula models

svinecop_scores(u, model, cores = 1)

Arguments

u

the data; should have approximately uniform margins..

model

model inheriting from class svinecop_dist.

cores

number of cores to use; if larger than one, computations are done in parallel on cores batches .

Value

A matrix containing the score vectors in its rows, where each row corresponds to one observation (row in u). The columns correspond to model parameters in the order: copula parameters of first tree, copula parameters of second tree, etc. Duplicated parameters in the copula model are omitted.

See also

Examples

# load data set
data(returns)  

# convert to uniform margins
u <- pseudo_obs(returns[1:100, 1:3])

# fit parametric S-vine copula model with Markov order 1
fit <- svinecop(u, p = 1, family_set = "parametric")

svinecop_loglik(u, fit)
#> [1] 87.19237
svinecop_scores(u, fit)
#>               [,1]          [,2]        [,3]         [,4]         [,5]
#>   [1,]  0.89796619 -0.0455069794  3.56297929 -0.053331168 -0.309469402
#>   [2,] -1.49893877  0.0459174078 -0.07135452 -0.009058333  0.232360235
#>   [3,] -1.87659023  0.0849433852 -1.95676219  0.060004787 -0.905300979
#>   [4,] -1.62335130  0.0415111356 -2.44881114  0.074151115  2.154558976
#>   [5,]  0.61986562 -0.0227630599  4.85469830 -0.039538035  1.209412557
#>   [6,] -1.72866801  0.0495296797  2.06103635 -0.120566303 -1.108936615
#>   [7,] -1.09665531  0.0058068143 -1.32026382  0.009859961  0.722070441
#>   [8,]  1.38235479 -0.1915837966  4.48864874 -0.210464538  0.800109212
#>   [9,] -1.29286144  0.0186438182 -2.46457875  0.068636257 -1.584175996
#>  [10,]  0.36053078 -0.0155213157 -1.66877626  0.036919904 -0.816085385
#>  [11,] -1.18940952  0.0406884362  1.88648641 -0.065872655 -0.563067327
#>  [12,] -0.87198790  0.0252322390  3.50308982 -0.079935464 -1.700259796
#>  [13,] -1.29564510  0.0238737576 -2.28794086  0.058072943 -2.258645444
#>  [14,]  3.50216865 -0.0717505727 -1.91221703  0.046274551 -0.022144550
#>  [15,]  0.13012107 -0.0100598608 -1.65161206  0.037414009  0.186971829
#>  [16,]  3.03950037 -0.0804492785  2.62180203 -0.067628774  0.312850852
#>  [17,] -0.44951331  0.0082729849  1.45383842 -0.042687598  0.658853754
#>  [18,] -0.31942553  0.0021796393  2.46988853 -0.110627615  0.739028525
#>  [19,] -2.08258421  0.0745408860  3.50308982 -0.079935464 -0.134551168
#>  [20,]  4.29003226 -0.0181678204 -0.99099354  0.009578960  0.006993861
#>  [21,] -1.45390056  0.0407002307 -2.22861635  0.053961614  0.648205545
#>  [22,] -1.65249609  0.0555190013 -2.03801747  0.047983471  0.524623031
#>  [23,] -0.57080914 -0.0128407031 -1.03613553  0.003276593 -0.443957063
#>  [24,] -0.96313770  0.0305323637  2.14435263 -0.044757889 -0.379302102
#>  [25,] -1.21307663  0.0093445844 -2.72995749  0.093060661 -1.527014171
#>  [26,]  5.01334743  0.0394738666 -2.44476697  0.066642077  1.465971485
#>  [27,]  0.22935586 -0.0196254202 -1.69942567  0.032402876  0.910689926
#>  [28,] -0.35560968 -0.0115355879  0.06523625 -0.026149137  0.783963175
#>  [29,] -0.57571042  0.0150118908  4.26863278 -0.041388696 -1.040630677
#>  [30,] -1.42162840  0.0303297884 -1.33085085  0.013015501  0.702022204
#>  [31,] -1.43624096  0.0513735528 -1.71732599  0.039870800 -0.166403719
#>  [32,]  4.64379496  0.0083664923  2.55907257 -0.086899893  0.289598043
#>  [33,] -0.03987825 -0.0101440761 -2.10438048  0.049616946 -0.129148946
#>  [34,] -1.23012570  0.0373326049  1.62767188 -0.085690937  0.727748495
#>  [35,] -1.05586201  0.0267832407 -1.83800453  0.041910436  0.477228414
#>  [36,] -0.85287584  0.0192967575 -1.36101672  0.025913027 -0.186042134
#>  [37,]  3.37827921 -0.1612497689  6.81003107  0.025353427  0.323507639
#>  [38,]  5.46930923  0.0983410702  5.50614928 -0.053799900  0.212060613
#>  [39,] -1.13822911  0.0353300754 -1.47776654  0.030615278  0.253569296
#>  [40,]  4.05507516 -0.0100897372 -0.89958612  0.009056546  0.291966175
#>  [41,] -1.46462339  0.0358813222 -0.49478921 -0.005400327  0.065799134
#>  [42,] -1.77874686  0.0570753616  0.48750958 -0.033084397  0.308202935
#>  [43,]  0.10448852 -0.0074229847 -1.47353010  0.031902509  0.212060613
#>  [44,] -1.48692402  0.0534616430  4.24248293 -0.094376827 -0.331033840
#>  [45,] -1.31126818  0.0457691076  3.81498142 -0.054275305 -1.851216971
#>  [46,]  0.92620802 -0.1012741274 -1.19518814  0.003015070  0.847477770
#>  [47,] -1.10506991  0.0029783192 -1.02920491 -0.006114619  1.209412557
#>  [48,] -0.59801574  0.0058656630  8.24729205  0.236742238  2.314868671
#>  [49,] -1.34967584  0.0373071638  4.20200691 -0.040024950 -2.404552076
#>  [50,]  3.54599410 -0.3051015130 -1.49907544  0.022940382  0.425031971
#>  [51,] -1.67896277  0.0498043401 -1.71032209  0.029223691  0.754631127
#>  [52,] -1.70334349  0.0567278477  3.18825341 -0.048144694  0.382338286
#>  [53,] -0.24856492  0.0038122996  1.22770054 -0.032801916  0.018709301
#>  [54,] -2.17429369  0.0857537961  2.15926109 -0.114039690 -0.156558601
#>  [55,] -1.16900422  0.0120247989  3.51774497 -0.097551560  0.306867211
#>  [56,] -0.89976768  0.0131457088  0.61392255 -0.048736971  0.228545126
#>  [57,] -1.61056880  0.0533649051 -1.99280131  0.046428387  0.490512310
#>  [58,] -1.58706975  0.0430387222 -2.32309217  0.058292159 -0.597707966
#>  [59,]  1.27403246 -0.0445105727  1.28264639 -0.040332509 -0.008677463
#>  [60,] -0.13616874 -0.0243865014 -1.96735067  0.045992092  0.190653183
#>  [61,]  0.05974575 -0.0343245364 -2.29834703  0.057000271  0.508738554
#>  [62,] -1.46998512  0.0380465325 -0.81408089 -0.001124650  0.555068515
#>  [63,] -1.04228288  0.0348602970 -1.64089030  0.037688643  0.191476239
#>  [64,] -1.12192509  0.0374927433 -1.64308313  0.037633981  0.249538306
#>  [65,] -1.12044007  0.0376589502 -1.64180683  0.037665880  0.198703867
#>  [66,] -1.11923336  0.0377914386 -1.64089030  0.037688643  0.212699228
#>  [67,] -1.05525930  0.0313543249  1.27988163 -0.070183513  0.066853255
#>  [68,] -1.38834214  0.0435285952 -1.93446729  0.044418197  0.455057476
#>  [69,]  3.09645105 -0.1223259822 -0.89467760  0.015278935  0.276620308
#>  [70,] -1.21708282  0.0385882967 -1.98403817  0.046935460  0.126756214
#>  [71,] -1.79355140  0.0590916458 -2.20465582  0.053131967 -0.287777227
#>  [72,] -0.78231592  0.0241568708 -1.56886191  0.034663113  0.355435259
#>  [73,] -0.79973904 -0.0102375062 -1.80050675  0.034399239  0.316824957
#>  [74,] -2.40544937  0.1220041287 -2.36963755  0.071850974 -2.718863600
#>  [75,] -1.81770002  0.0566887262 -1.37983335  0.019779692  0.649654304
#>  [76,] -0.45700786 -0.0093712915 -0.78476784 -0.013926425  0.657473413
#>  [77,] -0.93505544  0.0184997138 -1.46955897  0.027629595 -1.383113814
#>  [78,] -2.19523951  0.0839589470  1.23985769 -0.073299913 -0.348827375
#>  [79,]  1.37593703 -0.1338875229 -1.99652695  0.045391658 -0.290903192
#>  [80,] -1.84898430  0.0579767594 -0.88881885 -0.016132203  0.590403907
#>  [81,] -1.13041620  0.0004653472 -0.42271752 -0.045529426  1.756609085
#>  [82,] -0.37131485 -0.0407187655 -1.77951968  0.033113582 -2.512416224
#>  [83,]  1.63261650 -0.0770567315 -0.12907565 -0.049455420  1.357056269
#>  [84,]  0.93504965 -0.0335061583 -1.92432937  0.046541003 -0.103306439
#>  [85,]  0.92034552 -0.0323251066 -1.92106210  0.046380381  0.205883966
#>  [86,] -0.04896449 -0.0927214771 -0.98581054 -0.013360699 -1.063011702
#>  [87,]  3.11602760 -0.2150969074 -2.08661532  0.049140587  0.534080754
#>  [88,]  6.96475211  0.6550970397 -2.92924200  0.112490895 -1.891070226
#>  [89,]  2.84096449 -0.1904053518 -1.58876176  0.032424868 -1.369974010
#>  [90,]  3.54599410 -0.3051015130  6.24027309 -0.201216444  0.383313887
#>  [91,]  2.72183932 -0.1902712167 -1.82925906  0.038188058 -0.626457640
#>  [92,]  3.21362018 -0.0497226870  1.79454983 -0.056960312  0.179552524
#>  [93,]  1.50390385 -0.1495418485  5.82349776 -0.228372757 -1.505034680
#>  [94,]  0.01205395 -0.0230565054 -1.91528672  0.045267403 -0.212128294
#>  [95,]  2.94043679 -0.0595246510  5.63915855 -0.109570858 -1.369974010
#>  [96,] -1.57181614  0.0399897246 -3.00055444  0.123827025  2.409437745
#>  [97,]  0.74651691 -0.0257376269 -1.00999514  0.017540380 -0.777534730
#>  [98,] -0.58027157  0.0158771941 -0.85709850  0.012238608  0.216819889
#>  [99,] -1.53154631  0.0526894224 -0.60411142  0.006813654  0.241647205
#>                [,6]         [,7]         [,8]
#>   [1,] -0.165636494  -0.58957844  0.016269953
#>   [2,]  0.112915124   0.69224937  0.541753352
#>   [3,] -0.048223887  -1.01556066 -0.072329211
#>   [4,] -0.048242041   1.11141963 -0.362026496
#>   [5,] -0.217132829  -0.67623514 -0.143237351
#>   [6,]  0.025416445   2.30936280  0.090291218
#>   [7,] -0.052359490   2.21733501 -0.288106921
#>   [8,] -0.136834669   3.91702977 -0.361950399
#>   [9,] -0.036871054   1.37226598 -0.189521591
#>  [10,]  0.127677121   0.08323565  0.113257794
#>  [11,]  0.158856940  -0.34634164  1.133044207
#>  [12,] -0.129543652  -0.65771560 -0.453521199
#>  [13,]  0.011584904  -0.13300024 -0.430912843
#>  [14,]  0.087624348  -0.19542281  1.253033883
#>  [15,]  0.109208736  -0.18170356  2.367858159
#>  [16,]  0.502851781  -0.10255813 -1.451151365
#>  [17,]  0.278236969   0.68868093 -1.235968100
#>  [18,]  0.268685583   0.65449488 -0.987815639
#>  [19,]  0.163360843  -0.71400391  0.983091839
#>  [20,]  0.375421885   0.05241809  0.468313987
#>  [21,] -0.041166564  -0.20209251  0.215416811
#>  [22,] -0.062274681  -0.11355323 -0.318355686
#>  [23,] -0.061888832  -0.32616783 -0.410430938
#>  [24,] -0.065105666   0.98953927 -0.372067961
#>  [25,]  0.012521470   0.70839383 -0.361975488
#>  [26,]  0.165390683   0.13728851 -0.280901914
#>  [27,]  0.148036931  -0.06231383 -0.939888587
#>  [28,] -0.196381176  -0.20817827  1.022466387
#>  [29,] -0.096950215  -0.56906946  0.017855859
#>  [30,] -0.047413316  -0.70445641 -0.366426193
#>  [31,] -0.057169516  -0.12227408 -0.358893657
#>  [32,] -0.221936806   0.92690759  0.292184513
#>  [33,]  0.056524335   0.97515732  2.087585481
#>  [34,]  0.127963261  -0.02709280 -0.682934044
#>  [35,] -0.081542717   0.11858978  0.359047126
#>  [36,] -0.111524552  -0.26388785  0.436311575
#>  [37,] -0.251302527   3.75531010 -0.702987640
#>  [38,] -0.307921529 -10.23527689  1.760043794
#>  [39,] -0.057574659   1.30241816  1.506392458
#>  [40,] -0.061388729   0.14805671  0.940072925
#>  [41,]  0.126680041  -0.59026273 -1.305992535
#>  [42,]  0.033406278   0.99296015 -0.479485374
#>  [43,] -0.064473246  -0.13835640 -0.544325314
#>  [44,]  0.090511652   0.12826005  0.354997157
#>  [45,]  0.003159728  -0.75076087 -0.196243848
#>  [46,] -0.052538824  -0.72402711 -0.330856116
#>  [47,] -0.222592095  -0.39369824  1.018983823
#>  [48,] -0.047115133   2.24384055 -0.118474934
#>  [49,]  0.035716918  -5.51053684 -0.341656485
#>  [50,]  0.157397897  -0.80360522  4.719526273
#>  [51,] -0.014480913   0.06076266  0.986708850
#>  [52,]  0.143010161  -0.19596188 -0.368045078
#>  [53,] -0.127614882  -0.71387592 -0.551255300
#>  [54,]  0.090930676   2.15311506  0.172590482
#>  [55,]  0.001223506   2.29411574 -0.395662174
#>  [56,] -0.184353557  -0.61949090 -0.353313481
#>  [57,] -0.050074647  -0.40697223 -0.330725869
#>  [58,] -0.047201213  -0.38865976 -0.369937948
#>  [59,] -0.160489190   0.88779079 -0.233847053
#>  [60,] -0.060863294   0.42702324 -1.039877301
#>  [61,]  0.014994683  -0.22894236  0.852395442
#>  [62,] -0.038618493   0.55975405 -0.167776347
#>  [63,] -0.062873736  -0.06141078 -0.375119442
#>  [64,] -0.068974917  -0.12464808 -0.472590967
#>  [65,] -0.067676672  -0.30866849 -0.081656447
#>  [66,] -0.066444683  -0.31276192 -0.098608250
#>  [67,]  0.153938376   0.19756853  0.166197345
#>  [68,] -0.048073159  -0.22333365 -0.318095830
#>  [69,]  0.289049240  -0.22969011  2.274899964
#>  [70,] -0.039503849   0.03851031  0.865655962
#>  [71,] -0.061395943  -0.32252861 -0.404371026
#>  [72,]  0.059517983  -0.31711036 -0.016570356
#>  [73,] -0.163372329  -0.23200106  0.945169579
#>  [74,] -0.028479557  -0.22632305  1.418574974
#>  [75,]  0.036434514   0.50707714 -1.049475090
#>  [76,]  0.158595440  -0.13613753  0.732974391
#>  [77,] -0.119160027  -0.18630871 -0.677657996
#>  [78,]  0.118772815  -0.07998640  0.623762760
#>  [79,]  0.058244504  -0.52704564  1.685567563
#>  [80,] -0.004330557  -0.35029969  1.971128347
#>  [81,] -0.049077860  -0.41524054 -0.361612492
#>  [82,] -0.177243511  -0.21033779 -0.022586942
#>  [83,]  0.337283752  -0.23188422  2.114530017
#>  [84,]  0.049962309  -0.27976326 -1.872449152
#>  [85,]  0.037149792  -0.24991733  1.904600724
#>  [86,] -0.286648632  -0.17373165 -1.412215655
#>  [87,]  0.036115298  -0.18530808 -2.863960675
#>  [88,]  0.309127803  -0.21179775 -4.342396202
#>  [89,]  0.157094910  -0.29556854 -4.754437535
#>  [90,] -0.229564057   0.31704753  2.170759967
#>  [91,] -0.130901802  -0.20905745 -1.127294032
#>  [92,] -0.197706374   0.69307028  4.165764443
#>  [93,] -0.366661580   1.47822892 -2.162846466
#>  [94,] -0.046092306  -0.25258728 -1.390067940
#>  [95,]  0.541702369   0.84148838 -1.412280830
#>  [96,] -0.024722780  -0.19836356  0.045863801
#>  [97,] -0.091274037  -0.32178742  0.002632332
#>  [98,]  0.141428750  -0.26665916 -1.074521558
#>  [99,]  0.039703201   0.07060206 -0.608026300
svinecop_hessian(u, fit)
#>               [,1]          [,2]        [,3]          [,4]      [,5]
#> [1,] -3.896383e+00  0.0628972988  0.00000000  0.0000000000  0.000000
#> [2,]  6.289730e-02 -0.0076251195  0.00000000  0.0000000000  0.000000
#> [3,]  0.000000e+00  0.0000000000 -5.84245758  0.0414896789  0.000000
#> [4,]  0.000000e+00  0.0000000000  0.04148968 -0.0060639013  0.000000
#> [5,]  0.000000e+00  0.0000000000  0.00000000  0.0000000000 -1.006142
#> [6,]  3.568397e-05  0.0002391028 -0.03908895  0.0007626501  0.000000
#> [7,]  0.000000e+00  0.0000000000 -0.26477391 -0.0013786859  0.000000
#> [8,] -4.604411e-01  0.0047708430  0.01984588  0.0007009467  0.000000
#>              [,6]      [,7]      [,8]
#> [1,]  0.000000000  0.000000  0.000000
#> [2,]  0.000000000  0.000000  0.000000
#> [3,]  0.000000000  0.000000  0.000000
#> [4,]  0.000000000  0.000000  0.000000
#> [5,]  0.000000000  0.000000  0.000000
#> [6,] -0.024143498  0.000000  0.000000
#> [7,]  0.000000000 -2.052046  0.000000
#> [8,] -0.003965246  0.000000 -1.846482