Re: [R] help with this code

2009-04-20 Thread Tal Galili
Did you try using:debug(f2) and then running the function, and see what is your variables condition before the error ? On Sun, Apr 19, 2009 at 12:58 PM, li li wrote: > Hi, can anyone help me with the following code? Thanks! > > library(mvtnorm) > f2 <- function(n, rho) { > var <- matrix(c(1,rh

[R] help with this code

2009-04-19 Thread li li
Hi, can anyone help me with the following code? Thanks! library(mvtnorm) f2 <- function(n, rho) { var <- matrix(c(1,rho,rho,1), nrow=2, ncol=2, byrow=T) beta <- seq(0, 1, length.out=n+1) alpha <- sort (sapply(1-beta, qnorm)) x <- array(0, dim=c(n, n)) for (s in 1:n) { for (t in 1:n){