Re: [R] Converting from density to cumulative distribution

From: jim holtman <jholtman_at_gmail.com>
Date: Thu, 21 Apr 2011 11:31:50 -0400

?cumsum

> x = c(1,3,2,2,5)
> cumsum(x)
[1] 1 4 6 8 13
>

On Thu, Apr 21, 2011 at 11:05 AM, Parodi, Pietro <Pietro.Parodi_at_willis.com> wrote:
>
> 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.
>

-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?

______________________________________________
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:33:46 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:40:33 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