Why do my numbers not match, multivariate t distribution in R mvtnorm

I was trying to program the algorithm for the cdf for the multivariate t-distribution following Genz and Bretz, The reference package in R is mvtnorm.

When I was testing my function, I found that my numbers don't match up. In the following example, adjusted from the mvtnorm help, the multivariate t random variable has independent components. So the integral should be just the product of 3 independent probabilities

> lower <- -1
> upper <- 3
> df <- 4
> corr <- diag(3)
> delta <- rep(0, 3)
> pmvt(lower=lower, upper=upper, delta=delta, df=df, corr=corr)
[1] 0.5300413
attr(,"error")
[1] 4.321136e-05
attr(,"msg")
[1] "Normal Completion"

The reported error is 4e-5, the error compared to the product of independent probabilities

> (pt(upper, df) - pt(lower, df))**3
[1] 0.4988254

is

0.5300413 - 0.4988254 = 0.0312159

I'm getting discrepancies in my own code compared to R mvtnorm for various examples in about the same range.

I'm mostly a beginner in R. So, what am I doing wrong or what is wrong?

(I'm not signed up on a R-help mailing list, so I try here.)

UPDATE: As pchalasani explained, my statistics was wrong, the bug in my own code was in some helper function not in the t distribution code. Хороший способ увидеть, что отсутствие корреляции не означает независимости, - это посмотреть на условное распределение. Вот частоты столбца% * 100 для независимой двумерной случайной величины (10000 выборок) для квартилей (распределение зависит от переменной столбца).

двумерные некоррелированные нормальные переменные

([[26, 25, 24, 23],
  [24, 23, 24, 25],
  [24, 27, 24, 24],
  [24, 23, 26, 25]])

двумерные некоррелированные t-переменные

([[29, 20, 22, 29],
  [20, 31, 28, 21],
  [20, 29, 29, 20],
  [29, 18, 18, 29]])

Распределение в первом и последний столбец сильно отличается от средних столбцов. (Извините, кода R нет, так как я не знаю, как это быстро сделать с помощью R.)

6
задан Josef 2 January 2011 в 22:03
поделиться