Re: [R] Looking for simpler solution to probabilistic question

From: Rainer M Krug <R.M.Krug_at_gmail.com>
Date: Tue, 15 Jan 2008 15:33:21 +0200

Berwin A Turlach wrote:
> G'day Rainer,
>
> On Tue, 15 Jan 2008 14:24:08 +0200
> Rainer M Krug <R.M.Krug_at_gmail.com> wrote:
>

>

>> ager <- range(age1) + range(age2)
>> ager <- ager[1]:ager[2]
>> pp1 <- c(cumsum(p1), rev(cumsum(rev(p1))))
>> pp2 <- c(cumsum(p2[-21]), rev(cumsum(rev(p2)))[-1])
>> pr <- pp1+pp2
>> pr <- pr/sum(pr)

>
>> all.equal(p, pr)

> [1] TRUE
>> all.equal(age, ager)

> [1] TRUE
>
>
> If this is more elegant is probably in the eye of the beholder, but it
> should definitely use less memory. :)

Thanks - interesting approach which is different to using the outer()

>
> BTW, I am intrigued, in which situation does this problem arise? The
> time it takes the second process to finish seems to depend in a curious
> way on the time it took the first process to complete.....

These are two growth processes, where the first one is seedling growth up to a certain X and the second one is adult growth from size X onwards until it reaches a given final size.

I hope my calculations fit the process...

>
> Cheers,
>
> Berwin
>
> =========================== Full address =============================
> Berwin A Turlach Tel.: +65 6516 4416 (secr)
> Dept of Statistics and Applied Probability +65 6516 6650 (self)
> Faculty of Science FAX : +65 6872 3919
> National University of Singapore
> 6 Science Drive 2, Blk S16, Level 7 e-mail: statba_at_nus.edu.sg
> Singapore 117546 http://www.stat.nus.edu.sg/~statba



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 Tue 15 Jan 2008 - 13:41:19 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 Tue 15 Jan 2008 - 22:30:07 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