[R] help on integrate function

Francisca xuan fxx103 at hotmail.com
Tue Jan 11 19:45:21 CET 2005


here is a function I wrote

cdfest=function(t,lambda,delta,x,y){
    a1=mean(x< t)
    a2=mean(x< t-delta)
    a3=mean(y1< t)
   s=((1-lambda)*a1+lambda*a2-a3)^2
   s
}

when I try to integrate over t, I got this message:

>integrate(cdfest,0,4,lambda=0.3,delta=1,x=x,y=y1)
Error in integrate(cdfest, 0, 4, lambda = 0.3, delta = 1, x = x, y = y1) :
        evaluation of function gave a result of wrong length

but the function is definitely in one dimension. what is wrong?

any suggestions are welcome. thanks




More information about the R-help mailing list