[R] Computational Probability
Gabor Grothendieck
ggrothendieck at gmail.com
Fri Dec 26 15:03:35 CET 2008
Actually the last line could be simplified to just:
> s > 4 & s < 6
mean sd sims
[1] 0.72 0.45 2500
On Fri, Dec 26, 2008 at 8:33 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> Try a simulation approach. vignette("rv") for more info.
>
>> set.seed(1)
>> library(rv)
>> x <- rvunif(10)
>> s <- simapply(x, sum)
>> mean(s > 4 & s < 6)
> mean sd 1% 2.5% 25% 50% 75% 97.5% 99% sims
> [1] 0.72 0.45 0 0 0 1 1 1 1 2500
>
>
>
> On Fri, Dec 26, 2008 at 7:42 AM, Rory Winston <rory.winston at gmail.com> wrote:
>> Hi
>>
>> Firstly , happy Christmas to R-Help! Secondly, I wonder if anyone can help
>> me with the following query: I am trying to reproduce some explicit
>> probability calculations performed in APPL (a Maple extension for
>> computational probability). For instance, in APPL, to compute the
>> probability that the sum of 10 iid uniform variables [0,1] will be between 4
>> and 6, (i..e Pr( 4 < \sum_{i=1}^{10}X_i < 6)), I can type:
>>
>> X := UniformRV(0, 1);
>> Y := ConvolutionIID(X, 10);
>> CDF(Y,6) - CDF(Y,4);
>>
>> which gives the required probability .7222. Is there any way to perform
>> these type of calcuations in R in a general way? I realise that a lot of the
>> machinery behind these computations comes from Maple's symbolic engine, but
>> are there any R extensions for these kind of calculation?
>>
>> Cheers
>> Rory
>>
>> [[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.
>>
>
More information about the R-help
mailing list