Continuous Multivariate#

Multivariate Normal Distribution#

Generates an array of random variates from a Multivariate Normal distribution with probability density function, \(f (X)\), where:

\[f(X) = \sqrt{\frac{|C^{-1}|}{(2\pi)^M}} e^{- (X - \mu)^{T} C^{-1} (X - \mu)}\]

where μ is the vector of means, XMU.

C Generate 100 values from the
C Multivariate Normal distribution
    INTEGER LSTATE,N, MM
    PARAMETER (LSTATE=16,N=100,MM=10)
    INTEGER I,J,INFO,SEED(1),STATE(LSTATE)
    INTEGER LDC,LDX,M
    DOUBLE PRECISION X(N,MM),XMU(MM),C(MM,MM)

C Set array sizes
    LDC = MM
    LDX = N

C Set the seed
    SEED(1) = 1234

C Read in the distributional parameters
    READ(5,*) M
    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 Generate N variates from the
C Multivariate Normal distribution
    CALL DRANDMULTINORMAL(N,M,XMU,C,LDC,STATE,X,LDX,INFO)

C Print the results
    DO 40 I = 1,N
      WRITE(6,*) (X(I,J),J=1,M)
40  CONTINUE

Multivariate Students T Distribution#

Generates an array of random variates from a Multivariate Students T distribution with probability density function, \(f (X)\), where:

\[f(X) = \frac{\Gamma\left(\frac{\nu + M}{2}\right)} {(\nu \pi)^{\frac{M}{2}} \Gamma\left(\frac{\nu}{2}\right)|C|^{\frac{1}{2}}} \left(1 + \frac{1}{\nu} (X - \mu)^T C^{-1} (X - \mu)\right)^{-\frac{\nu + M}{2}}\]

where μ is the vector of means, XMU and ν is the degrees of freedom, DF.

C Generate 100 values from the
C Multivariate Normal 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)

C Set array sizes
    LDC = MM
    LDX = N

C Set the seed
    SEED(1) = 1234

C Read in the distributional parameters
    EAD(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 Generate N variates from the
C Multivariate Students T distribution
    CALL DRANDMULTISTUDENTST(N,M,DF,XMU,C,LDC,STATE,X,LDX,INFO)

C Print the results
    DO 40 I = 1,N
      WRITE(6,*) (X(I,J),J=1,M)
40  CONTINUE

Multivariate Normal R Distribution#

Generates an array of random variates from a Multivariate Normal distribution using a reference vector initialized by DRANDMULTINORMALREFERENCE.

C Generate 100 values from the
C Multivariate Normal distribution
    INTEGER LSTATE,N, MM
    PARAMETER (LSTATE=16,N=100,MM=10)
    INTEGER I,J,INFO,SEED(1),STATE(LSTATE)
    INTEGER LDC,LDX,M
    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
    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 DRANDMULTINORMALREFERENCE(M,XMU,C,LDC,REF,LREF,INFO)

C Generate N variates from the
C Multivariate Normal distribution
    CALL DRANDMULTINORMALR(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

Multivariate StudentsT R Distribution#

Generates an array of random variates from a Multivariate Students T distribution using a reference vector initialized by DRANDMULTISTUDENTSTREFERENCE.

C 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

Multivariate Normal Reference#

Initializes a reference vector for use with DRANDMULTINORMALR. Reference vector is for a Multivariate Normal distribution with probability density function, \(f (X)\), where:

\[f(X) = \sqrt{\frac{|C^{-1}|}{(2\pi)^M}} e^{-(X - \mu)^{T} C^{-1} (X - \mu)}\]

where μ is the vector of means, XMU.

C Generate 100 values from the
C Multivariate Normal distribution
    INTEGER LSTATE,N, MM
    PARAMETER (LSTATE=16,N=100,MM=10)
    INTEGER I,J,INFO,SEED(1),STATE(LSTATE)
    INTEGER LDC,LDX,M
    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
    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 DRANDMULTINORMALREFERENCE(M,XMU,C,LDC,REF,LREF,INFO)

C Generate N variates from the
C Multivariate Normal distribution
    CALL DRANDMULTINORMALR(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

Multivariate StudentsT Reference#

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) = \frac{\Gamma\left(\frac{\nu + M}{2}\right)} {(\nu \pi)^{\frac{M}{2}} \Gamma\left(\frac{\nu}{2}\right)|C|^{\frac{1}{2}}} \left(1 + \frac{1}{\nu} (X - \mu)^T C^{-1} (X - \mu)\right)^{-\frac{\nu + M}{2}}\]

where μ is the vector of means, XMU and ν is the degrees of freedom, DF.

C 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 DRANDMULTINORMALREFERENCE(M,XMU,C,LDC,REF,LREF,INFO)

C Generate N variates from the
C Multivariate Normal 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