Trapezoidal rule - Hmisc [🇷 for BE/BA]

posted by d_labes  – Berlin, Germany, 2010-04-19 15:41 (5895 d 07:44 ago) – Posting: # 5168
Views: 12,051

Dear All,

just discovered in Frank Harrels library (package) Hmisc:
Area under curve defined by arbitrary x and y vectors, using trapezoidal rule and assuming x sorted appropriately

trap.rule <- function(x, y) sum(diff(x) * (y[-1] + y[-length(y)]))/2

Wow :ok:! The cream of the crop of programming art!

Regards,

Detlew

Complete thread:

UA Flag
Activity
 Admin contact
23,653 posts in 4,991 threads, 1,570 registered users;
177 visitors (0 registered, 177 guests [including 96 identified bots]).
Forum time: 23:25 CEST (Europe/Vienna)

The epistemological value of probability theory is based on the fact
that chance phenomena, considered collectively and on a grand scale,
create non-random regularity.    Andrey Kolmogorov

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5