[R] Error message

Jim Holtman jholtman at gmail.com
Wed Mar 6 11:57:08 CET 2013


most likely either 'lower' or 'upper' is NA.  put

options(error = recover)

in your script to stop on the error and examine the value.  you need to learn "debugging 101" to help yourself out.

Sent from my iPad

On Mar 5, 2013, at 16:00, li li <hannah.hlx at gmail.com> wrote:

> Dear all,
> I got an error message when running the following code.
> Can anyone give any suggestions on fixing  this type of error?
> Thank you very much in advance.
>    Hanna
> 
> 
> 
>> integrand <- function(x, rho, a, b, z){
> +              x1 <- x[1]
> +              x2 <- x[2]
> +              Sigma <- matrix(c(1, rho, rho, 1), 2,2)
> +              mu <- rep(0,2)
> +              f <- pmnorm(c((z-a*x1)/b, (z-a*x2)/b), mu,
> Sigma)*dmnorm(c(0,0), mu, diag(2))
> +              f
> +                                        }
>> 
>> adaptIntegrate(integrand, lower=rep(-Inf, 2), upper=c(2,2),
> + rho=0.1, a=0.6, b=0.3, z=3,  maxEval=10000)
> Error in if (any(lower > upper)) stop("lower>upper integration limits") :
>  missing value where TRUE/FALSE needed
> 
>    [[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.



More information about the R-help mailing list