From Mark.Clements@anu.edu.au Tue Aug 17 08:58:48 2004
Date: Tue, 17 Aug 2004 14:41:19 +1000
From: Mark Clements <Mark.Clements@anu.edu.au>
To: Torsten.Hothorn@rzmail.uni-erlangen.de
Cc: torsten@hothorn.de
Subject: Minor changes to mvtnorm (R package)

    [ The following text is in the "iso-8859-1" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

As maintainer of the mvtnorm package, would you consider the following minor additions, please?

For estimating polychoric correlations, it would be useful to have a vector'ised form for pmvnorm(), otherwise estimation is (very) slow. For a vector'ised function for lower-tail probabilities for the standard bivariate normal:

Simple addition to mvt.f:

      SUBROUTINE MVBVUV( N, X, Y, CORREL, PROB )       
*
*     A function for computing LOWER-tail bivariate normal probabilities
*     for vectors
      DOUBLE PRECISION X(*), Y(*), CORREL, PROB(*), MVBVU
      INTEGER N, I
      DO I = 1, N
         PROB(I) = MVBVU(- X(I), - Y(I), CORREL)
      END DO
      END


Draft addition to mvnorm.R:

pbinorm <- function(x, y=NULL, r)
  {
    if (length(dim(x))==2 && dim(x)[2]==2 && is.null(y))
      {
        y <- x[,2]
        x <- x[,1]
      }
    if (length(x) != length(y))
      stop("Vectors of unequal length")
    N <- length(x)
    ret <- .Fortran("mvbvuv", N = as.integer(N), 
                X = as.double(x), Y = as.double(y),
                CORREL = as.double(r), PROB = as.double(rep(0,N)))
    return(ret$PROB)
  }


Is there a better approach to vector'ising pmvnorm()?

With kind regards,


Mark Clements, PhD.
