[R] cuhre usage ?? multidimensional integration

R. Michael Weylandt michael.weylandt at gmail.com
Wed Oct 5 21:57:19 CEST 2011


Perhaps you should start by writing vectorized code; as it stands,
your code suggests you don't understand what simple operations like y
<- x actually do.

More to your question: what are cuhre  & crff ? They are not in base R
nor in any packages I have current loaded.

Michael


On Wed, Oct 5, 2011 at 1:26 AM, sevenfrost <linshuang11 at gmail.com> wrote:
> my=function(x){
> len=1
> for(i in 1:len){
> y[i]=x[i]
> }
> g=1
> w=NULL
> t=NULL
> for(i in 1:len)w[i]=x[i+len]
> for(i in 1:len)t[i]=x[i+2*len]
> for(i in 1:len)g=g*dnorm(y[i])*dnorm(w[i])*dnorm(z[i])
> return(g)
> }
> cuhre(6,1,my,rep(-100,6),rep(100,6))
>
> Error in crff(match.call(), integrand, "cuhre", libargs, ...) :
>  Additional argument  not expected in the integrand function
>
> function change to my=function(x,g,i,j)
> result is not right. it should be 1, but it turns out to be 0.039...
>
> How can I make this work?
>
> Thank you!
>
> --
> View this message in context: http://r.789695.n4.nabble.com/cuhre-usage-multidimensional-integration-tp3873478p3873478.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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