[R] question regarding qmvnorm

From: li li <hannah.hlx_at_gmail.com>
Date: Wed, 20 Apr 2011 17:59:49 -0400


Dear all,

    I wrote the following function previously. It worked fine with the old mvtnorm package.
Somehow with the updated package, I got a error message when trying to use the function.
I need some help. It is sort of urgent. Can anyone please take a look. The function is the following.
Thank you very much!

                                 Hannah

library(mvtnorm)

cc_f <- function(m, rho, k, alpha) {

m <- 10

rho <- 0.1

k <- 2

alpha <- 0.05

cc_z <- numeric(m)

var <- matrix(c(1,rho,rho,1), nrow=2, ncol=2, byrow=T)

for (i in 1:m){

   if (i <= k) {cc_z[i] <- qmvnorm((k*(k-1))/(m*(m-1))*alpha, tail="upper", sigma=var)$quantile} else

               {cc_z[i] <- qmvnorm((k*(k-1))/((m-i+k)*(m-i+k-1))*alpha, tail ="upper", sigma=var)$quantile}

               }

cc <- 1-pnorm(cc_z)

return(cc)

                             }

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 20 Apr 2011 - 22:01:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 20 Apr 2011 - 23:10:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive