[R] Converting from density to cumulative distribution

From: Parodi, Pietro <Pietro.Parodi_at_willis.com>
Date: Thu, 21 Apr 2011 10:05:56 -0500

 

Hello  

I'm trying to do the following vector operation:  

given vector x = c(x1,x2,x3,x4...xn), produce vector y = c(x1,x1+x2,x1+x2+x3,...x1+...+xn).  

E.g., from x = c(1,3,2,2,5), produce y = c(1,4,6,8,13).  

The underlying problem is finding the cumulative distribution function given the empirical density distribution function.  

I have done some research on this but the only relevant thing I've found is the function "integrate", which however gives me the sum of the whole vector not the step-wise sum.  

Thanks for your help  

Pietro  


For information pertaining to Willis' email confidentiality and monitoring policy, usage restrictions, or for specific company registration and regulatory status information, please visit http://www.willis.com/email_trailer.aspx

We are now able to offer our clients an encrypted email capability for secure communication purposes. If you wish to take advantage of this service or learn more about it, please let me know or contact your Client Advocate for full details. ~W67897


        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 21 Apr 2011 - 15:08:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Apr 2011 - 15:50:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive