Generate n random matrices, distributed according to the Wishart distribution with parameters Sigma and df, W_p(Sigma, df).

rFractionalWishart(n, df, Sigma, covariance = FALSE,
  simplify = "array")

Arguments

n

integer: the number of replications.

df

numeric parameter, “degrees of freedom”.

Sigma

positive definite (\(p\times p\)) “scale” matrix, the matrix parameter of the distribution.

covariance

logical on whether a covariance matrix should be generated

simplify

logical or character string; should the result be simplified to a vector, matrix or higher dimensional array if possible? For sapply it must be named and not abbreviated. The default value, TRUE, returns a vector or matrix if appropriate, whereas if simplify = "array" the result may be an array of “rank” (\(=\)length(dim(.))) one higher than the result of FUN(X[[i]]).

Value

A numeric array of dimension p * p * n, where each array is a positive semidefinite matrix, a realization of the Wishart distribution W_p(Sigma, df)

Details

If X_1, ..., X_m is a sample of m independent multivariate Gaussians with mean vector 0, and covariance matrix Sigma, the distribution of M = X'X is W_p(Sigma, m).

References

Adhikari, S. (2008). Wishart random matrices in probabilistic structural mechanics. Journal of engineering mechanics, 134(12), doi: 10.1061/(ASCE)0733-9399(2008)134:12(1029) .

Examples

rFractionalWishart(2, 22.5, diag(1, 20))
#> , , 1 #> #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 194.2795888 -6.1436438 8.2774508 1.35885715 3.7637609 3.53264145 #> [2,] -6.1436438 96.8328040 12.8211456 -4.80318531 -6.7641316 7.36070725 #> [3,] 8.2774508 12.8211456 200.4703334 -4.25390261 -16.0691027 0.81820760 #> [4,] 1.3588572 -4.8031853 -4.2539026 56.25138036 -12.5276574 -5.59478880 #> [5,] 3.7637609 -6.7641316 -16.0691027 -12.52765744 157.3990965 -13.24537812 #> [6,] 3.5326415 7.3607073 0.8182076 -5.59478880 -13.2453781 75.34101404 #> [7,] 6.2944596 -1.1549515 5.8690732 1.54895115 -1.2964583 6.38900082 #> [8,] -2.4213092 -11.6196979 3.0013677 -8.56821948 2.7696701 9.96628443 #> [9,] 3.9328134 3.7184794 18.5109583 -14.05599916 11.3915648 -7.86247203 #> [10,] -2.5891517 -3.3309050 -15.4262309 -0.12153899 4.1063721 2.83389119 #> [11,] 4.9703658 -7.5765161 0.3580921 -0.23038639 2.0293016 6.62998526 #> [12,] 0.1497424 0.5454951 -6.3311202 4.92355883 4.6105450 5.33031176 #> [13,] -0.6037924 -2.8428917 3.1343433 7.53605455 2.4288136 0.99456954 #> [14,] -1.2625863 -1.0891810 -6.5414311 2.04393687 3.8089017 5.31598076 #> [15,] 8.3517032 -2.5455139 -0.6444571 -4.14390146 -2.4528126 4.83231241 #> [16,] -2.7834114 1.9678941 -0.4843144 0.02399081 1.7355506 -4.67625160 #> [17,] 6.7156805 5.2134144 -0.3447658 -6.09605425 0.9657756 -0.78622340 #> [18,] 2.2463042 0.8286224 -0.3386988 3.83816070 -1.7272052 1.74122580 #> [19,] 1.2547171 0.6667781 -1.4804530 2.37643122 -2.0523979 0.02169224 #> [20,] -0.3692975 0.7011152 -0.1288633 -0.81811501 -0.6996017 0.21379574 #> [,7] [,8] [,9] [,10] [,11] [,12] #> [1,] 6.2944596 -2.42130917 3.9328134 -2.5891517 4.9703658 0.14974239 #> [2,] -1.1549515 -11.61969789 3.7184794 -3.3309050 -7.5765161 0.54549511 #> [3,] 5.8690732 3.00136767 18.5109583 -15.4262309 0.3580921 -6.33112024 #> [4,] 1.5489511 -8.56821948 -14.0559992 -0.1215390 -0.2303864 4.92355883 #> [5,] -1.2964583 2.76967010 11.3915648 4.1063721 2.0293016 4.61054501 #> [6,] 6.3890008 9.96628443 -7.8624720 2.8338912 6.6299853 5.33031176 #> [7,] 40.1914430 -1.97823466 12.1658463 -17.8774480 -1.8694269 10.65142322 #> [8,] -1.9782347 60.81794646 10.4880157 4.9725308 12.9793549 -1.06753350 #> [9,] 12.1658463 10.48801571 83.8679270 -9.1046381 -4.0893589 -1.42026561 #> [10,] -17.8774480 4.97253080 -9.1046381 58.8986401 6.5812510 10.33022798 #> [11,] -1.8694269 12.97935487 -4.0893589 6.5812510 33.9255514 -0.78354421 #> [12,] 10.6514232 -1.06753350 -1.4202656 10.3302280 -0.7835442 31.22263501 #> [13,] 4.6013620 1.15570257 16.5354779 -2.5537152 -2.9736796 15.98916049 #> [14,] 1.9327538 -0.03655289 3.7475581 0.4175282 2.3989016 4.51683111 #> [15,] 1.9649086 -0.85271199 -2.2993463 -3.4928614 8.2447834 0.71424145 #> [16,] 2.8556353 -2.39371644 1.8443525 -1.6687543 -2.3349719 0.62828708 #> [17,] 6.3135134 -0.10599540 6.6089396 -3.1032114 -0.1433287 -1.17992722 #> [18,] 0.8445806 -6.76622721 -6.9293741 2.5199181 1.9393010 -0.04102748 #> [19,] -2.3481943 -0.77500255 -3.4190217 0.4598210 0.5342220 0.61379998 #> [20,] 0.6485197 -0.84967005 -0.8413197 -1.0629135 -0.3654430 0.62181362 #> [,13] [,14] [,15] [,16] [,17] [,18] #> [1,] -0.6037924 -1.26258630 8.3517032 -2.78341136 6.7156805 2.246304235 #> [2,] -2.8428917 -1.08918101 -2.5455139 1.96789406 5.2134144 0.828622358 #> [3,] 3.1343433 -6.54143107 -0.6444571 -0.48431437 -0.3447658 -0.338698780 #> [4,] 7.5360545 2.04393687 -4.1439015 0.02399081 -6.0960542 3.838160700 #> [5,] 2.4288136 3.80890166 -2.4528126 1.73555057 0.9657756 -1.727205213 #> [6,] 0.9945695 5.31598076 4.8323124 -4.67625160 -0.7862234 1.741225800 #> [7,] 4.6013620 1.93275375 1.9649086 2.85563531 6.3135134 0.844580555 #> [8,] 1.1557026 -0.03655289 -0.8527120 -2.39371644 -0.1059954 -6.766227206 #> [9,] 16.5354779 3.74755808 -2.2993463 1.84435251 6.6089396 -6.929374098 #> [10,] -2.5537152 0.41752820 -3.4928614 -1.66875431 -3.1032114 2.519918070 #> [11,] -2.9736796 2.39890160 8.2447834 -2.33497189 -0.1433287 1.939301018 #> [12,] 15.9891605 4.51683111 0.7142415 0.62828708 -1.1799272 -0.041027483 #> [13,] 43.0209996 1.77974635 0.2674958 1.96058239 -0.8229591 -9.249623647 #> [14,] 1.7797463 21.54893100 -0.9184086 -2.39067617 3.0323487 -1.471907482 #> [15,] 0.2674958 -0.91840863 19.8830670 -5.76591276 6.6656749 2.554853481 #> [16,] 1.9605824 -2.39067617 -5.7659128 9.14976699 -3.0752584 -5.294594031 #> [17,] -0.8229591 3.03234873 6.6656749 -3.07525843 22.5906720 0.465247881 #> [18,] -9.2496236 -1.47190748 2.5548535 -5.29459403 0.4652479 11.225664673 #> [19,] 1.2187918 1.58412972 1.0828267 -2.12845279 -0.6133619 1.729313546 #> [20,] 0.5853778 -0.12487197 0.4531376 -0.57030934 0.6571841 0.009772745 #> [,19] [,20] #> [1,] 1.25471708 -0.369297489 #> [2,] 0.66677808 0.701115231 #> [3,] -1.48045302 -0.128863317 #> [4,] 2.37643122 -0.818115013 #> [5,] -2.05239787 -0.699601684 #> [6,] 0.02169224 0.213795741 #> [7,] -2.34819433 0.648519701 #> [8,] -0.77500255 -0.849670055 #> [9,] -3.41902166 -0.841319678 #> [10,] 0.45982101 -1.062913504 #> [11,] 0.53422198 -0.365443011 #> [12,] 0.61379998 0.621813620 #> [13,] 1.21879180 0.585377784 #> [14,] 1.58412972 -0.124871967 #> [15,] 1.08282665 0.453137643 #> [16,] -2.12845279 -0.570309338 #> [17,] -0.61336190 0.657184138 #> [18,] 1.72931355 0.009772745 #> [19,] 2.87606484 0.166649475 #> [20,] 0.16664947 0.546931816 #> #> , , 2 #> #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 189.68062006 1.0850020 0.06177433 -5.5716829 8.4453933 -2.8883030 #> [2,] 1.08500203 185.5544958 -7.53078605 16.7278525 -11.1729079 -12.3049221 #> [3,] 0.06177433 -7.5307860 123.86345569 -0.1589521 14.0951786 -4.4006463 #> [4,] -5.57168289 16.7278525 -0.15895207 47.4217384 5.5232174 0.6523038 #> [5,] 8.44539333 -11.1729079 14.09517865 5.5232174 127.2972655 3.5409457 #> [6,] -2.88830303 -12.3049221 -4.40064627 0.6523038 3.5409457 207.7077881 #> [7,] -11.43161488 -2.9976938 -6.87665442 -5.5868146 -5.9060650 2.8386766 #> [8,] 11.12998705 -14.7351712 6.19302319 -17.8573633 1.7732084 -3.6262128 #> [9,] 7.03995260 -3.6316704 -0.53188375 -2.4871926 -1.1150651 1.8808238 #> [10,] 9.84783903 -4.4352354 1.37167417 -11.4410418 -6.5195146 6.0876462 #> [11,] -9.79308716 -0.5608561 -10.67661219 -2.3351465 -9.0569150 -3.6813234 #> [12,] -0.32057287 -1.5395490 -10.74284843 2.3232336 -5.5064213 1.6708146 #> [13,] -6.69315727 -3.1896439 -2.84227927 0.1912506 -7.9503315 3.7092919 #> [14,] 14.35725326 -1.3943595 -2.12471124 -1.0787734 -3.0622897 -1.5076728 #> [15,] -2.68379267 -3.2092718 -0.92420883 -1.3977121 4.2779946 8.5436399 #> [16,] 1.86495509 -9.5007820 3.35375014 -2.5443290 9.8623251 -3.6710104 #> [17,] 2.06267404 -2.7214874 -2.18876802 -1.2182634 3.3574261 2.0455547 #> [18,] 0.25507873 -2.7793283 0.99504622 -1.3623266 0.2360589 5.1084268 #> [19,] -1.71494967 -1.7591877 1.20564288 -0.6196941 -1.6053483 0.9330861 #> [20,] 0.49980464 0.7458548 -0.77878101 0.8733617 0.9098072 -1.2927114 #> [,7] [,8] [,9] [,10] [,11] [,12] #> [1,] -11.4316149 11.1299870 7.0399526 9.8478390 -9.7930872 -0.3205729 #> [2,] -2.9976938 -14.7351712 -3.6316704 -4.4352354 -0.5608561 -1.5395490 #> [3,] -6.8766544 6.1930232 -0.5318838 1.3716742 -10.6766122 -10.7428484 #> [4,] -5.5868146 -17.8573633 -2.4871926 -11.4410418 -2.3351465 2.3232336 #> [5,] -5.9060650 1.7732084 -1.1150651 -6.5195146 -9.0569150 -5.5064213 #> [6,] 2.8386766 -3.6262128 1.8808238 6.0876462 -3.6813234 1.6708146 #> [7,] 52.3545707 3.6118709 1.5044570 2.1585579 2.5783058 3.9050258 #> [8,] 3.6118709 60.6798617 -9.0619051 16.8881038 0.3574124 3.1676919 #> [9,] 1.5044570 -9.0619051 27.3855639 -2.1672459 -2.9473918 -2.5900689 #> [10,] 2.1585579 16.8881038 -2.1672459 60.5943532 1.0255100 1.1880875 #> [11,] 2.5783058 0.3574124 -2.9473918 1.0255100 31.0657001 2.3510877 #> [12,] 3.9050258 3.1676919 -2.5900689 1.1880875 2.3510877 29.2546744 #> [13,] -0.8007489 -11.4875359 8.7188709 4.3228620 5.9315351 -1.4566694 #> [14,] 2.6608619 3.4711996 -4.8631957 4.4346976 -3.4980105 0.9656666 #> [15,] -0.5244441 -3.0449046 6.1154512 3.3137131 -1.6317170 0.2302230 #> [16,] 1.8258471 7.1097515 -2.4918978 -5.7696914 -6.4836950 3.2377075 #> [17,] 3.0827148 0.1835530 2.3003626 3.4573246 -1.7809515 -0.9786442 #> [18,] 2.2063998 -2.1462061 3.0484100 0.7648047 -2.7985045 -0.9552415 #> [19,] -0.3072448 -0.7866336 -0.3905263 -0.1217671 0.1767116 1.5880561 #> [20,] 0.3396368 0.5084963 -0.2982093 -0.2341328 -0.2798965 -1.0817777 #> [,13] [,14] [,15] [,16] [,17] [,18] #> [1,] -6.6931573 14.3572533 -2.6837927 1.8649551 2.06267404 0.2550787 #> [2,] -3.1896439 -1.3943595 -3.2092718 -9.5007820 -2.72148736 -2.7793283 #> [3,] -2.8422793 -2.1247112 -0.9242088 3.3537501 -2.18876802 0.9950462 #> [4,] 0.1912506 -1.0787734 -1.3977121 -2.5443290 -1.21826341 -1.3623266 #> [5,] -7.9503315 -3.0622897 4.2779946 9.8623251 3.35742607 0.2360589 #> [6,] 3.7092919 -1.5076728 8.5436399 -3.6710104 2.04555475 5.1084268 #> [7,] -0.8007489 2.6608619 -0.5244441 1.8258471 3.08271477 2.2063998 #> [8,] -11.4875359 3.4711996 -3.0449046 7.1097515 0.18355298 -2.1462061 #> [9,] 8.7188709 -4.8631957 6.1154512 -2.4918978 2.30036257 3.0484100 #> [10,] 4.3228620 4.4346976 3.3137131 -5.7696914 3.45732456 0.7648047 #> [11,] 5.9315351 -3.4980105 -1.6317170 -6.4836950 -1.78095149 -2.7985045 #> [12,] -1.4566694 0.9656666 0.2302230 3.2377075 -0.97864423 -0.9552415 #> [13,] 21.2121793 -0.9311662 0.7772549 -7.4130656 -0.72929160 0.7635177 #> [14,] -0.9311662 30.3497554 -7.0396678 0.1446952 0.24793874 -2.3264186 #> [15,] 0.7772549 -7.0396678 15.8426617 2.4174986 4.62494265 6.5556743 #> [16,] -7.4130656 0.1446952 2.4174986 21.0996992 1.94263875 1.9685922 #> [17,] -0.7292916 0.2479387 4.6249427 1.9426388 5.21524471 2.7651924 #> [18,] 0.7635177 -2.3264186 6.5556743 1.9685922 2.76519235 4.4822464 #> [19,] 1.2769913 -3.8894365 0.5474679 -0.3736729 -0.09403974 0.5654711 #> [20,] -1.0767868 1.9696235 -0.8721823 0.4395625 -0.04470474 -0.6530011 #> [,19] [,20] #> [1,] -1.71494967 0.49980464 #> [2,] -1.75918773 0.74585483 #> [3,] 1.20564288 -0.77878101 #> [4,] -0.61969406 0.87336167 #> [5,] -1.60534826 0.90980716 #> [6,] 0.93308614 -1.29271138 #> [7,] -0.30724484 0.33963677 #> [8,] -0.78663355 0.50849635 #> [9,] -0.39052633 -0.29820927 #> [10,] -0.12176705 -0.23413283 #> [11,] 0.17671164 -0.27989646 #> [12,] 1.58805605 -1.08177769 #> [13,] 1.27699132 -1.07678677 #> [14,] -3.88943650 1.96962349 #> [15,] 0.54746792 -0.87218227 #> [16,] -0.37367286 0.43956248 #> [17,] -0.09403974 -0.04470474 #> [18,] 0.56547111 -0.65300110 #> [19,] 2.62896761 -1.42771225 #> [20,] -1.42771225 0.91958420 #>