[6546] in s-news-athena

home help back first fref pref prev next nref lref last post

Re: Cumulative multivariate normal distribution.

daemon@ATHENA.MIT.EDU (Simon Jackman)
Wed Mar 1 20:20:36 1995

Date: Wed, 1 Mar 1995 18:55:44 -0600 (CST)
From: Simon Jackman <acbsjack@gosnell.spc.uchicago.edu>
To: Huiman Xie Barnhart <hxb@panda.sph.emory.edu>
Cc: s-news@utstat.toronto.edu
In-Reply-To: <Pine.ULT.3.90.950301160911.27694B-100000@panda.sph.emory.edu>

try the toms717 Fortran routine on statlib (under misc, I think).
This was contributed by Alan Miller (a fellow Aussie?!) from CSIRO, I 
believe... 

header is:

      SUBROUTINE MECDF(NDIM, D, RHO, PROB, IER)
C
C     This comes from TOMS algorithm 717
C
      INTEGER NDIM, IER
      DOUBLE PRECISION D(*), PROB, RHO(*)
C-----------------------------------------------------------------
C       6/29/90
C       This subroutine is designed to calculate the MVN CDF
C       using the Mendell-Elston procedure as described in
C       Kamakura (1989).  The current version is set up to go
C       as high as 19 dimensions (=> 20 MNP alternatives)
C       NOTE:  Equation (15) in Kamakura has an error.
C
C       Specifically, assume that Z is a set of random variables
C       with a standard normal distribution with correlations
C       stored in RHO (in packed form).  Then this subroutine
C       calculates Prob[Z(1)>D(1);...; Z(NDIM) > D(NDIM)].
C-----------------------------------------------------------------

I compiled this and put it local.Sqpe (static load only here, ver 3.1;
groan) call it with the following Splus function: 

> mvncdf
function(x, rho)
{
# caller function for tom717.f - fortran routine for mecdf
        x <- as.vector(x)
        ndim <- length(x)
        d <- x  
#       fortran call is
#       SUBROUTINE MECDF(NDIM, D, RHO, PROB, IER)
        out <- .Fortran("mecdf",
                as.integer(ndim),
                as.double(d),
                as.double(rho),
                as.double(1),
                as.integer(1))
        out
}

regards - simon jackman
========================================================================
Simon Jackman, Dept of Political Science, Univ of Chicago, 5828
S.University Ave, Chicago, IL 60637. ph: 312.702.8075. fax: x.x.1689 "But
the age of chivalry is gone.  That of sophisters, economists, and
calculators has succeeded; and the glory of Europe is extinguished for
ever." (Burke, _Reflections on the Revolution in France_) "I can't give
credit enough to the logisticians..." (Norman Schwarzkopf, 2/27/91)




On Wed, 1 Mar 1995, Huiman Xie Barnhart wrote:

> 
> I am looking for some functions in S-plus which compute the 
> cumulative bivariate or multivariate normal distribution. Any suggestions 
> will be greatly appreciated. 
> 
> -----------------------------------------------------------------------
> Huiman X. Barnhart, Ph.D.                             //\         /\\
> Assistant Professor
> Department of Biostatistics                          || * \ . . / * ||
> Emory School of Public Health                         \\____\X/____//
> e-mail: hxb@panda.sph.emory.edu
> (404)727-8059                                          / *  /O\  * \
> (404)727-1370(fax)                                     \__/  "  \__/
> 
> 
> 

home help back first fref pref prev next nref lref last post