Skip to content
Prev 366538 / 398502 Next

error in an univariate integration involving a bivariate normal CDF

integrand=function(xx,y=1,MU=MU,Sigma=Sigma)
    {
      dnorm(xx,mean=MU[1],sd=sqrt(Sigma[1,1]))*pmvnorm(lower=c(-Inf,-Inf),upper=c(xx,y),mean=MU,sigma=Sigma)

    }

The integrand must be a function that returns a vector the length of
its first argument (integrate will pass it a short vector of input
values).  It looks like your function expects 'xx' to be a scalar.
You can use the Vectorize function to fix things up.


Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Jan 9, 2017 at 3:28 PM, Jingqin luo via R-help
<r-help at r-project.org> wrote: