Skip to contents

Used in the process of Monte Carlo integration over multivariate Student-t random effects. This generates the random draws from the multivariate Student-t distribution and multiplies these by the data. Not intended to be called directly by most users.

Usage

integratemvt(X, k, sd, chol, df)

integratemvtR(X, k, sd, chol, df)

Arguments

X

A numeric matrix of the data to be multiplied by the random effects

k

An integer, the number of random samples to be used for numerical integration

sd

A numeric vector of the standard deviations

chol

A numeric matrix, which should be the Cholesky decomposition of the correlation matrix of the multivariate Student-t distribution.

df

A numeric scalar giving the degrees of freedom of the (multivariate) Student-t distribution.

Value

A numeric matrix with random values

Functions

  • integratemvtR(): Pure R implementation of integratemvt().

Examples

integratemvt(
  X = matrix(1, 1, 2),
  k = 100L,
  sd = c(10, 5),
  chol = chol(matrix(c(1, .5, .5, 1), 2)),
  df = 5)
#>         [,1]       [,2]     [,3]      [,4]      [,5]     [,6]      [,7]
#> [1,] 5.20215 -0.2844267 5.694854 -7.281875 -7.924065 25.69829 -6.684368
#>           [,8]      [,9]     [,10]    [,11]     [,12]    [,13]     [,14]
#> [1,] -11.46587 -22.20752 0.6171358 29.99234 -7.524701 27.59598 0.1526352
#>          [,15]     [,16]    [,17]    [,18]    [,19]    [,20]    [,21]    [,22]
#> [1,] -7.245521 -14.46326 -7.99154 5.138873 2.250636 4.658883 10.79124 27.27985
#>        [,23]    [,24]    [,25]    [,26]    [,27]    [,28]     [,29]    [,30]
#> [1,] 20.3724 11.65742 14.79061 3.499234 3.936819 2.520605 -4.299193 -11.0188
#>        [,31]     [,32]    [,33]     [,34]    [,35]     [,36]     [,37]    [,38]
#> [1,] 4.16747 -26.88653 18.89355 -1.448951 10.16708 -1.050448 -20.41367 12.91734
#>           [,39]   [,40]    [,41]    [,42]   [,43]    [,44]    [,45]    [,46]
#> [1,] -0.3328938 9.08639 9.618768 2.100537 9.32654 22.06658 22.55632 8.807334
#>          [,47]    [,48]     [,49]    [,50]     [,51]    [,52]    [,53]    [,54]
#> [1,] -4.412645 -1.38984 -4.021542 12.83026 -11.39327 1.427414 11.33248 12.97473
#>         [,55]    [,56]   [,57]     [,58]    [,59]     [,60]    [,61]    [,62]
#> [1,] 16.26732 -8.42815 9.81665 -11.81352 2.487766 -1.021224 19.93597 16.41659
#>         [,63]     [,64]     [,65]     [,66]    [,67]     [,68]    [,69]
#> [1,] 17.16932 -2.953553 -20.08644 -27.13626 1.858663 -18.48578 -21.5683
#>         [,70]     [,71]     [,72]    [,73]     [,74]     [,75]     [,76]
#> [1,] 4.788572 -1.087213 -12.00113 8.570569 -43.63469 -35.30215 -2.572512
#>          [,77]    [,78]     [,79]    [,80]     [,81]    [,82]     [,83]
#> [1,] -5.559753 5.849954 -22.95129 1.414372 -5.147753 35.54415 -0.949487
#>          [,84]     [,85]      [,86]     [,87]    [,88]     [,89]    [,90]
#> [1,] -10.83853 -5.816571 -0.6116516 -3.302185 7.931949 -9.924816 31.94516
#>          [,91]     [,92]     [,93]    [,94]    [,95]      [,96]     [,97]
#> [1,] 0.7843987 -1.794488 -3.980526 28.49642 -6.86911 -0.8426098 -23.93309
#>         [,98]    [,99]   [,100]
#> [1,] 2.114413 15.91904 7.158364

integratemvt(matrix(1, 1, 1), 100L, c(5), matrix(1), df = 5)
#>            [,1]      [,2]      [,3]      [,4]    [,5]      [,6]      [,7]
#> [1,] -0.6884898 -2.945806 0.3517629 -5.538192 6.85461 -1.950971 -1.000213
#>          [,8]      [,9]    [,10]    [,11]    [,12]    [,13]    [,14]     [,15]
#> [1,] -7.41137 -4.360758 0.182349 10.34605 2.531249 -3.76624 9.940948 -2.648756
#>         [,16]      [,17]     [,18]     [,19]    [,20]     [,21]     [,22]
#> [1,] 4.514654 -0.5612279 -8.124151 -18.70818 4.170286 0.6743294 -4.129927
#>          [,23]     [,24]     [,25]     [,26]   [,27]     [,28]     [,29]
#> [1,] 0.7161723 -1.741341 -1.086183 0.8474924 -3.7406 -3.775788 -2.083167
#>          [,30]    [,31]     [,32]     [,33]      [,34]     [,35]    [,36]
#> [1,] 0.4251361 1.678449 -19.95289 0.8190724 -0.4320987 -6.398619 -3.04557
#>         [,37]    [,38]    [,39]   [,40]    [,41]     [,42]     [,43]     [,44]
#> [1,] 1.726898 3.465388 4.029738 2.50179 1.336653 -5.926968 -4.081622 -5.041026
#>         [,45]     [,46]  [,47]     [,48]    [,49]    [,50]    [,51]     [,52]
#> [1,] 1.100334 -6.446528 6.9573 -2.730911 2.361198 5.361252 17.49685 -8.006062
#>          [,53]    [,54] [,55]    [,56]     [,57]    [,58]   [,59]    [,60]
#> [1,] 0.7473566 2.898586 1.993 11.36144 -8.699974 1.644445 4.93137 -2.52947
#>           [,61]     [,62]    [,63]    [,64]    [,65]   [,66]     [,67]
#> [1,] -0.4244829 -14.16869 2.436079 3.534633 3.069667 1.51326 -1.135709
#>          [,68]     [,69]     [,70]    [,71]     [,72]     [,73]    [,74]
#> [1,] -1.203338 -1.772124 -9.871474 3.880475 -1.248791 0.8676228 8.864636
#>          [,75]   [,76]    [,77]     [,78]     [,79]    [,80]     [,81]
#> [1,] 0.2149986 -4.0355 3.331739 -5.257585 -6.209077 8.739488 -6.856569
#>          [,82]     [,83]     [,84]    [,85]    [,86]    [,87]     [,88]
#> [1,] -3.759035 -9.449988 0.2272446 8.631852 7.772112 3.831445 -2.229927
#>           [,89]     [,90]     [,91]   [,92]     [,93]    [,94]     [,95]
#> [1,] -0.3926946 -10.65554 -1.632826 3.50161 -6.566708 -5.83923 -6.842479
#>         [,96]     [,97]     [,98]     [,99]   [,100]
#> [1,] -1.90805 -5.123172 -8.448042 -6.842286 1.549344