[R] rtmvt function in tmvtnorm package

Maity, Arnab K akumar at stat.tamu.edu
Thu Mar 30 17:21:47 CEST 2017


Dear R users.


I am trying to generate random numbers from truncated multivariate t distribution. I use the following:


as.vector(rtmvt(n = 1, sigma = Qc.inv, df = 3, lower = logtime[censored.id],
+                 algorithm = "gibbs"))
Error in while (!acceptedW) { : missing value where TRUE/FALSE needed

I try to provide the following informations. Please do not hesitate to let me know this needs additional information to figure out the issue.

head(logtime[censored.id])
[1] 6.429719 6.444131 6.472346 5.560682 6.426488 6.442540

str(logtime[censored.id])
 num [1:188] 6.43 6.44 6.47 5.56 6.43 ...

str(Qc.inv)
 num [1:188, 1:188] 103.19 4.08 37.41 6.3 -14.77 ...​


head(Qc.inv)
           [,1]       [,2]       [,3]        [,4]       [,5]        [,6]       [,7]      [,8]      [,9]       [,10]
[1,] 103.191668   4.084550  37.410771   6.3025844 -14.770439  -3.8583584   5.747125 -14.36141 -22.17369  -0.8416707
[2,]   4.084550  87.162964  50.557940  63.4295196   5.436691 -27.6904379  38.266155 -46.98055  60.98667 -44.3544933
[3,]  37.410771  50.557940  90.820251  46.7400501 -13.133446  -8.0695965  17.170853 -63.98366  54.33788 -19.4413197
[4,]   6.302584  63.429520  46.740050 119.5991486  -2.559422   0.6971248 -18.273204 -12.02721  62.34241 -47.9675229
[5,] -14.770439   5.436691 -13.133446  -2.5594223 112.370413 -14.7914540 -28.387638  12.90690   1.95228  15.3878938
         [,11]      [,12]      [,13]     [,14]      [,15]      [,16]      [,17]      [,18]      [,19]      [,20]     [,21]
[1,] -17.48124  -7.273790   8.758612 -13.05318  21.177517 -29.007640 -16.768586  -7.818816   1.208103   8.582474 21.626926
[2,] -23.13822  21.086132   1.463960 -26.01017   9.572186  -3.852163   8.672799  62.533319 -31.195415  29.340774  4.598501
[3,]  -5.85877   3.857264  -8.385349 -35.61114   1.462074 -12.510675 -13.025487  43.858855 -26.933323  13.406022  5.546703
[4,] -16.96809 -49.094863 -22.028717 -17.48911   7.386639  10.312270  -7.241734  -5.993691 -32.500451 -14.981188 -4.367750
[5,]  38.65007   1.955743  -8.558712  20.58457   2.885866  26.334345  17.182626 -28.025123  30.137036  -5.740590 53.073941
         [,22]     [,23]     [,24]     [,25]      [,26]     [,27]      [,28]      [,29]     [,30]       [,31]      [,32]
[1,] -12.15187  10.21008 -11.61987 -19.63323  -1.721833  17.99243  13.109449 -31.143517 -40.12807  -0.1653785  -4.822136
[2,]   2.41622   5.58190  56.21415 -54.34755 -77.215336 -44.56425 -12.002085 -20.969070 -40.53237   2.4771632  70.096085
[3,] -11.29728  12.47286  44.66689 -44.39676 -41.685117 -36.36607  -2.217315 -25.926949 -51.33097 -10.2219419  76.837953
[4,] -38.49505  20.89032  51.08699 -35.80768 -81.644230 -34.66880 -14.792076 -57.208095 -26.46859  26.9316783  39.304252
[5,]  -4.77228 -15.25001 -87.11353  17.42737  27.454779  25.76826  22.083931  15.958689  32.37850  18.8141986 -70.850367
           [,33]      [,34]      [,35]     [,36]      [,37]      [,38]      [,39]     [,40]     [,41]      [,42]
[1,] -2.56292765 -33.118852 -18.307195  36.89452  -1.885574  15.925918  17.691148 18.782399 -41.10868 -29.037948
[2,] -2.02761046   2.672841 -17.359895  14.83541   8.339768 -15.386750  30.548170 -4.970033  77.36239   4.131188
[3,] -4.36046815 -18.094746 -21.765883  53.43321  24.070214  -1.101232  26.965988  6.375775  46.91174  -1.913579
[4,] -3.76249568 -25.524182   2.602313  18.28056  20.136158  -6.153071 -17.007229 -3.769837  78.79886  26.536849
[5,] 25.37333844  49.122800  11.949395 -59.69279 -12.625364  -3.006932  -3.339474  4.432715 -47.78852   7.994049
          [,43]     [,44]       [,45]      [,46]     [,47]       [,48]    [,49]      [,50]       [,51]     [,52]
[1,] -16.267829 -45.68288  -0.9729662  35.912833  17.81573 -17.0232904 12.63011   3.555426  24.8776107 -25.48942
[2,]  82.933423 -36.37741  51.7247691  61.127603  19.89547 -18.3325435 20.60206 -15.699770  -0.6351787  70.94141
[3,]  78.898704 -32.66581  49.4823361  90.760972  27.78720 -25.8065567 20.21728 -38.261012   3.6325671  37.57488
[4,]  35.226743 -14.69262 110.5254558  63.774194  47.31054  -0.9152841 46.89370  12.069090  12.5332734 114.91011
[5,]  -6.376021  47.47343 -20.5772250 -52.031861 -13.94213  21.3513364 19.16880  20.127523 -32.2555406 -18.92199
          [,53]      [,54]      [,55]     [,56]      [,57]      [,58]     [,59]      [,60]      [,61]      [,62]
[1,]  12.469217   6.605384  -4.494773 19.587522  15.141511  -2.255163 -14.52668 -23.508476 -19.964215  16.356070
[2,]   2.430749 -53.520707  15.240484  7.383617  37.162205   4.596894 -15.61655  41.328329  26.597582 -20.284451
[3,]   8.044619 -63.331045  15.273209  8.023244  32.557750 -10.413627 -34.16039   7.432020  -2.407745 -12.517345
[4,]   6.711366   1.887722  -8.265214 37.653400   3.035649  -3.024647 -32.66960 -28.599953 -42.168595  -8.492222
[5,]   4.511080  13.903864 -23.154220  3.062098 -29.587412  -1.163289  55.84688  -3.639603 -21.439437  38.018817
          [,63]     [,64]      [,65]     [,66]      [,67]      [,68]      [,69]      [,70]      [,71]      [,72]
[1,]  13.982151 -22.02268  25.866270 -12.08414  23.053014  21.556927   2.819743 19.1345911 -17.210878  -3.184506
[2,]   7.788247  63.47815  17.791832 -21.16284  -4.209961 -42.637213  -4.099067 -0.9309052  -6.720104 -29.233959
[3,]  19.690538  52.88822  21.955619 -42.82107   9.414819 -22.909848 -13.214196  7.5379555 -12.694570  -9.288349
[4,]  -6.014174  61.90719  10.600601 -17.65842 -13.480349 -33.061214 -21.210248 -4.2349719 -36.595840 -35.717801
[5,] -11.423140 -33.43289  -9.146526  34.56827 -33.603768  -4.916534 -16.399510 16.8362281 -26.050498  17.289870
          [,73]       [,74]      [,75]      [,76]     [,77]       [,78]      [,79]      [,80]      [,81]     [,82]
[1,]   6.964887 -19.0131849 -10.962387 -22.728584 19.731447 -14.4056740 -17.679696 29.6706552 -22.053506 -17.48776
[2,] -17.662100 -12.5177737  24.514905 -22.924204 10.412900  23.8088390   4.505117  0.2874799 -13.577099 -29.54475
[3,] -32.940665 -16.7930969  11.186390 -24.569641 28.516972  -3.2546103  -7.214680 21.3045453 -25.773707 -29.81783
[4,] -11.286910 -39.1702779  -5.449232 -29.545835 -6.294758 -28.5684830 -45.273614  5.0762319  13.113599 -15.79635
[5,]  31.333027  11.4067957 -16.613807  13.564670  9.303830   0.3982714 -14.078076 11.4432835   3.080034  46.16064
         [,83]     [,84]     [,85]      [,86]      [,87]      [,88]     [,89]     [,90]       [,91]      [,92]      [,93]
[1,] -3.906635 -2.036687 36.231318   1.978159  18.619529  -5.943974 -15.81537  13.53967  -0.4787321 81.8858093   9.413964
[2,]  9.895242 20.683990  5.394997 -55.667260 -21.186389 -11.300155 -58.29189  99.98059 -16.8738084 -7.3087708  41.740481
[3,] 23.970624  3.885754 24.283760 -55.392558  -9.477462 -15.805712 -56.66153  84.92105  -6.0043295 50.1668868  30.358107
[4,] 14.864745 53.962209  6.203406 -23.362368   5.517740  18.233364 -40.12964  95.98350  -6.9243722  0.9468412  40.706512
[5,] 29.943262 11.676235 11.573591 -20.293979 -52.197347   5.904125  25.25067 -58.43703 -11.6620474 -3.9049881 -18.875764
          [,94]      [,95]     [,96]       [,97]      [,98]      [,99]     [,100]     [,101]     [,102]    [,103]
[1,] -32.337495 -23.340426 -24.40618 -19.4082269  -1.005875  -4.883524 -14.197968  -5.057439  54.608183  7.263058
[2,] -16.566362 -37.763768 -49.21907   9.0779860 -18.507662 -49.554422  -5.151398 -42.875991  -6.163987 16.396033
[3,]   7.361798 -24.443326 -67.04417  -0.5159425   9.182521 -28.393355  -7.082648 -24.799091  25.170788  8.985544
[4,]  -1.470292  -9.184299 -17.00770  20.2941387  -3.724142 -19.939988  18.563237 -30.592172  13.180990  3.332729
[5,]  13.518459  19.125688  27.93643  10.6967343  -1.075586 -46.329372  13.515783  -3.248747 -58.384232  1.226128
         [,104]     [,105]    [,106]     [,107]    [,108]     [,109]     [,110]     [,111]     [,112]    [,113]     [,114]
[1,]  -2.783984  -3.295524  11.29617  -6.879183  -8.77472  36.177076 -29.587546 -40.080265 -25.430473 -37.17276 -11.128502
[2,] -11.232139  43.029711  23.60616 -40.193228 -50.56181 -13.012208  -2.889829 -19.197624 -24.090489 -30.80387 -57.987228
[3,]  -9.494581  40.367104  22.19689 -50.332619 -38.60635  18.252724  -8.371556 -50.459492 -32.892205 -32.71281 -52.578621
[4,] -14.763432  57.171749  39.39698 -14.194628 -48.54200 -11.480950  29.842519   8.461525 -29.581543 -14.45019 -61.539376
[5,]  35.999386 -55.199291 -27.29228  13.679432  46.43779  15.443550  16.762766  47.363841   6.601030  34.60518   6.425318
          [,115]     [,116]     [,117]     [,118]     [,119]    [,120]     [,121]     [,122]      [,123]     [,124]
[1,] -28.0788201   2.795296 -11.912358   2.008978   5.954441 10.150284   76.87015 -12.112914  26.2381588  21.353587
[2,]  13.0434948 -86.770100 -32.289060  30.192063  26.058932 23.175750  156.57766  33.764106 -10.6066801 -26.536997
[3,]   4.0653563 -72.282057 -29.496555  14.812384  25.376773 36.308814  163.04189   5.887244  -8.9368539 -16.602686
[4,]  31.5764056 -94.742572 -12.460407 -20.891842  45.973622 22.262936  126.89295 -19.561184 -32.9636552 -21.243088
[5,]  -0.5232302   7.492366   9.945984  -8.220790 -56.306737 -2.519593 -157.57534  -3.650186  -0.4155292  -2.840519
        [,125]     [,126]    [,127]    [,128]     [,129]    [,130]    [,131]     [,132]    [,133]     [,134]     [,135]
[1,] -4.585794 -36.901027 -15.59164 -5.499519   6.320217  6.019933  8.041211   84.02361 -22.26605  15.292450 28.5002527
[2,] 25.156326 -35.497406  25.25636 46.764479  -4.009387 -3.715176 34.891294   71.15530 -59.16251  64.457691 -7.7945660
[3,] 14.475696 -39.375082  32.88338 46.149627 -15.372631 -6.276070 40.264960  103.50387 -47.33394  57.736449  0.8483884
[4,] 50.980979 -24.473197  34.02081 76.904984  16.369162 -5.151141 36.530545   57.74893 -41.08018  46.239025 19.0796365
[5,] -7.335968 -27.829077 -23.66170  7.324798 -17.248833  3.707905 -6.798728 -109.16067  19.54411  -3.039534 -3.7824092
         [,136]     [,137]    [,138]    [,139]      [,140]     [,141]     [,142]    [,143]      [,144]    [,145]
[1,]  36.234463 20.0556223 -1.341857 -19.96725  18.0023242   1.665664   5.371864  11.60666  39.3974082  4.584100
[2,] -41.410580 15.4481192 -6.127424 -24.62600   7.4695956  22.849235 -22.581623  37.26669  -2.2523877  3.774307
[3,]  -7.658759 40.7641851 -5.643633 -22.20056  -0.1027485  -3.635687 -26.151056  38.00414   0.1316689 13.971692
[4,] -43.071731 -0.6670018 26.180700  20.86533  32.0538761  -2.455869  -3.237107  15.66135  15.8291925  7.563325
[5,]   6.385692 24.7458970 17.968295  33.62893 -20.9196039 -20.913955  17.824869 -20.55771  10.8353349  7.344602
         [,146]     [,147]      [,148]     [,149]     [,150]     [,151]     [,152]     [,153]     [,154]     [,155]
[1,]  -8.466086  25.364601 -13.1476576 -18.523840 -20.504276 -21.129528  44.445610 -17.699666  -2.076396 -10.208587
[2,]  -3.171823 -26.739525  23.5873941  28.953444   8.715197  25.259473   6.125369  35.971721  -8.536349   1.553710
[3,] -22.052442   2.722391   3.6739037   5.594339  -3.743816  32.997087  19.478487   6.711170 -13.349878 -25.554481
[4,] -27.630730 -14.732013 -43.9759145 -71.284352 -79.358262  17.084033   9.974541 -27.593717 -13.316136  14.554874
[5,]  40.393284 -50.831849   0.9654449   3.038550  13.628554  -9.762681 -10.644181   6.950414  19.482954   7.661743
         [,156]     [,157]      [,158]    [,159]    [,160]     [,161]     [,162]    [,163]    [,164]     [,165]    [,166]
[1,]  -9.112719  -6.719075 -24.0711028 -17.92269  11.23068   9.413791 -19.887453 -14.21604 14.361151 -25.664229  45.50516
[2,]  40.598364  35.294214  -0.8229091 -55.90226  29.32080 -29.263128 -67.991295 -49.02238  7.651142   1.483744  33.91063
[3,]  27.560787  14.768593  -5.8015368 -61.59669  22.90750 -23.354103 -47.536524 -46.06624  8.847841  -2.706972  37.69478
[4,]  51.150407  52.696012 -38.7055320 -32.92318  54.73381 -25.953583 -47.267089 -37.44935  3.253286  17.468427  14.48600
[5,]   9.453210 -24.866868   4.7077020  21.45067 -14.09162 -16.242264   7.338362  28.33953 36.344855 -59.245388 -36.39018
         [,167]    [,168]     [,169]     [,170]     [,171]     [,172]     [,173]     [,174]     [,175]     [,176]
[1,]  -4.544885  28.38020  -9.372145   9.069206  -7.334183  54.079158  14.571735  -7.217508   8.903421 -49.861188
[2,] -48.735364  41.15537  -8.257373 -54.573811 -58.287592  31.172724 -11.509056 -33.037815 -32.704394  49.739077
[3,] -43.699640  25.65660 -12.765806 -39.802160 -67.101921  31.340425  -1.715203 -35.724065 -40.198980  14.113654
[4,] -48.981659 -11.08451 -14.208159 -30.535879 -34.068724  18.976165  -8.110733 -10.423814 -14.832156  80.339284
[5,]  12.362941 -26.47636  14.835659 -19.872435  28.620478 -47.771748  21.539988  18.354632  14.042340   3.418625
         [,177]     [,178]    [,179]    [,180]    [,181]     [,182]     [,183]     [,184]     [,185]     [,186]
[1,] -30.061208 -26.107934 38.131471  16.44638 -13.16901  -3.077926 -16.106648  34.713017 -23.500839 -14.173299
[2,]  17.301250   2.592833  6.800865  30.23491 -33.33400  36.484838 -19.618483 -29.548019   1.566512  -5.933797
[3,]  -1.892444 -23.573705 31.698060  39.24516 -32.73860  28.346661 -11.194460  18.044047   9.627726 -16.775216
[4,]  21.688662 -52.169082 14.064823  29.39702 -14.96946  52.200631 -16.705632 -29.799225  20.396586 -12.273845
[5,]  13.689477  -7.804491 -7.646703  23.52350  16.55569 -35.096878  -3.024644  -5.026317   2.780635  53.187411
          [,187]     [,188]
[1,] -22.2201269  -7.659217
[2,] -25.1642470  50.317881
[3,] -40.3367680  35.464506
[4,]   1.2765687 -11.863266
[5,]  49.6019190 -17.990819
 [ reached getOption("max.print") -- omitted 1 row ]





Arnab Kumar Maity
Department of Statistics
Texas A&M University
3143 TAMU, Room 401A
College Station, TX 77843
akumar at stat.tamu.edu<mailto:arnabkrmaity at stat.tamu.edu>
arnabkrmaity at tamu.edu
+1 779 777 3428<tel:%2B1%20779%20777%203428>

	[[alternative HTML version deleted]]



More information about the R-help mailing list