Hi..
i was trying to integrate the indicator funtion but had problems when
limits where negative or equal to the indicator condition
my function is
________________________
fun1<-function(x){
as.numeric(x>=2)
}
_________________________
which should be Ind(x>=2)*x
seems to work for the following two cases
------------------------------------------------------------
> integrate(fun1,3,5)
2 with absolute error < 2.2e-14
> integrate(fun1,5,100)
95 with absolute error < 1.1e-12
----------------------------------------------------------
Does not work for the following
> integrate(fun1,0,2)
0 with absolute error < 0 ( i was expecting = 2)
> integrate(fun1,-1,5)
3 with absolute error < 3.3e-14 (i was expecting =5)
> integrate(fun1,-2,5)
3 with absolute error < 5.3e-15 (i was expecting =5)
Any suggestions?
Thanks.
Harsh,
---------------------------------
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html