[R] cumulative density question

s viswanath ru68y7s at myrealbox.com
Fri Mar 19 13:49:06 CET 2004


Hi,

I am interested in looking at cumulative density functions. If F(x) is a cumulative density of monthly fund returns over the interval of a to b, and I am interested in returns above and below a specified point r, then I would like to find the number that is made up of
 
1.(integral from r to b)(1-F(x))dx  
2. (integral from a to r)(F(x)dx)

3. the ratio of #1/#2 above


In financial literature this ratio has been called the Omega function.

My first guess in obtaining this equation using R
is to use the integrate function but I am have two problems: 

I. can I use a nonparametric density in the integrate function(how?), 
II. how can i get the ratio of #3 above as the integrate function gives the number plus the absolute error
> integrate(dnorm,-4,1.96)
0.9749704 with absolute error < 2.1e-07
so using a ratio  in #3 above i get the following error:
 : non-numeric argument to binary operator



Thank you in advance.
Sri Viswanath




More information about the R-help mailing list