Previous: DRANDMULTINORMALREFERENCE, Up: Continuous Multivariate Distributions


DRANDMULTISTUDENTSTREFERENCE / SRANDMULTISTUDENTSTREFERENCE

Initializes a reference vector for use with DRANDMULTISTUDENTSTR. Reference vector is for a Multivariate Students T distribution with probability density function, f(X), where: f(X) = [Gamma([v + M] / 2)] / [(Pi * v)^(M / 2) * Gamma(v / 2) * det(C)^(1 / 2)] * (1 + [(X - u)^T * C^(-1) * (X - u)] / v)^(-[v + M] / 2), where u us the vector of means, XMU and v is the degrees of freedom, DF.

(Note that SRANDMULTISTUDENTSTREFERENCE is the single precision version of DRANDMULTISTUDENTSTREFERENCE. The argument lists of both routines are identical except that any double precision arguments of DRANDMULTISTUDENTSTREFERENCE are replaced in SRANDMULTISTUDENTSTREFERENCE by single precision arguments - type REAL in FORTRAN or type float in C).

— SUBROUTINE: DRANDMULTISTUDENTSREFERENCE (M,DF,XMU,C,LDC,REF,LREF,INFO)
— Input: INTEGER M

On input: number of dimensions for the distribution.
Constraint: M>=1.

— Input: INTEGER DF

On input: degrees of freedom.
Constraint: DF>2.

— Input: DOUBLE PRECISION XMU(M)

On input: vector of means for the distribution.

— Input: DOUBLE PRECISION C(LDC,M)

On input: matrix defining the variance / covariance for the distribution. The variance / covariance matrix is given by [DF * C]/ [DF - 2].

— Input: INTEGER LDC

On input: leading dimension of C in the calling routine.
Constraint: LDC>=N.

— Output: DOUBLE PRECISION REF(LREF)

On output: if INFO returns with a value of 0 then REF contains reference information required to generate values from a Multivariate Students T distribution using DRANDMULTISTUDENTSTR.

— Input/Output: INTEGER LREF

On input: either the length of the reference vector REF, or -1.
On output: if LREF=-1 on input, then LREF is set to the recommended length of the reference vector and the routine returns. Otherwise LREF is left unchanged.

— Output: INTEGER INFO

On output: INFO is an error indicator. If INFO = -i on exit, the i-th argument had an illegal value. If INFO =1 on exit, then LREF has been set to the recommended length for the reference vector REF. If INFO = 0 then the reference vector, REF, has been successfully initialized.

     Example:
     

     Generate 100 values from the
          C      Multivariate Students T distribution
                 INTEGER LSTATE,N, MM
                 PARAMETER (LSTATE=16,N=100,MM=10)
                 INTEGER I,J,INFO,SEED(1),STATE(LSTATE)
                 INTEGER LDC,LDX,M,DF
                 DOUBLE PRECISION X(N,MM),XMU(MM),C(MM,MM)
                 INTEGER LREF
                 DOUBLE PRECISION REF(1000)
          
          C      Set array sizes
                 LDC = MM
                 LDX = N
          
          C      Set the seed
                 SEED(1) = 1234
          
          C      Read in the distributional parameters
                 READ(5,*) M,DF
                 READ(5,*) (XMU(I),I=1,M)
                 DO 20 I = 1,M
                   READ(5,*) (C(I,J),J=1,M)
          20     CONTINUE
          
          C      Initialize the STATE vector
                 CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
          
          C      Initialize the reference vector
                 LREF = 1000
                 CALL DRANDMULTISTUDENTSTREFERENCE(M,DF,XMU,C,LDC,REF,LREF,INFO)
          
          C      Generate N variates from the
          C      Multivariate Students T distribution
                 CALL DRANDMULTISTUDENTSTR(N,REF,STATE,X,LDX,INFO)
          C      Print the results
                 DO 40 I = 1,N
                   WRITE(6,*) (X(I,J),J=1,M)
          40     CONTINUE