[R] value of hypsometric integral ( ecdf() )

kjetil brinchmann halvorsen kjetil at entelnet.bo
Wed Sep 3 22:38:55 CEST 2003


On 3 Sep 2003 at 17:31, Rado Bonk wrote:

?
It is not really clear what you want, since what you call the 
"hypsometric" curve is really the cumulative distribution function, 
so its integral is infinite.

Does the following help?

> data(volcano)
> library(stepfun)
> plot(ecdf(volcano), do.points=F, verticals=T)
> test <- ecdf(volcano)
> str(test)
function (v)  
 - attr(*, "class")= chr [1:3] "ecdf" "stepfun" "function"
 - attr(*, "call")= language ecdf(volcano)
> test(120)
[1] 0.4586395
> args(integrate)
function (f, lower, upper, subdivisions = 100, rel.tol = 
.Machine$double.eps^0.25, 
    abs.tol = rel.tol, stop.on.error = TRUE, keep.xy = FALSE, 
    aux = NULL, ...) 
NULL
> test( 100:110)
 [1] 0.1066516 0.1221029 0.1371773 0.1535708 0.1727907 0.1929527 
0.2127379
 [8] 0.2317694 0.2534389 0.2726588 0.3060109
> integrate( test, 80, 200)
Error in integrate(test, 80, 200) : maximum number of subdivisions 
reached
> integrate( test, 80, 200, subdivisions=1000)
69.81223 with absolute error < 0.0033
> 

Kjetil Halvorsen



> Hi R-users,
> 
> How can I compute the area below the curve (so called "hypsometric
> integral") plotted by:
> 
> plot(ecdf(volcano), do.points=F, verticals=T)
> 
> Thanks,
> 
> Rado
> 
> 
> -- 
> Radoslav Bonk M.S.
> Dept. of Physical Geography and Geoecology
> Faculty of Sciences, Comenius University
> Mlynska Dolina 842 15, Bratislava, SLOVAKIA
> tel: +421 905 968 127 e-mail: rbonk at host.sk
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list