4. Simulacion estadistica del Ejercicio 2.9(Probabilidad bolas en una urna)

Solapas principales


style="display:inline-block;width:336px;height:280px"
data-ad-client="ca-pub-3713658242215030"
data-ad-slot="9156825571">

Tendremos que utilizar el package prob y combinat del R-Project

Simulacion:

> library(prob)

> library(combinat)

> L <- c(0,1);

> M <- urnsamples(L, size=6, replace = TRUE, ordered = TRUE);
> M0 <- subset(M,(X1==0)&(X2==0)&(X3==0)&(X4==0)&(X5==0)&(X6==0));

> M1 <- setdiff(M,M0);

> N <- probspace(M1);

> N
   X1 X2 X3 X4 X5 X6      probs
2   1  0  0  0  0  0 0.01587302
3   0  1  0  0  0  0 0.01587302
4   1  1  0  0  0  0 0.01587302
5   0  0  1  0  0  0 0.01587302
6   1  0  1  0  0  0 0.01587302
7   0  1  1  0  0  0 0.01587302
8   1  1  1  0  0  0 0.01587302
9   0  0  0  1  0  0 0.01587302
10  1  0  0  1  0  0 0.01587302
11  0  1  0  1  0  0 0.01587302
12  1  1  0  1  0  0 0.01587302
13  0  0  1  1  0  0 0.01587302
14  1  0  1  1  0  0 0.01587302
15  0  1  1  1  0  0 0.01587302
16  1  1  1  1  0  0 0.01587302
17  0  0  0  0  1  0 0.01587302
18  1  0  0  0  1  0 0.01587302
19  0  1  0  0  1  0 0.01587302
20  1  1  0  0  1  0 0.01587302
21  0  0  1  0  1  0 0.01587302
22  1  0  1  0  1  0 0.01587302
23  0  1  1  0  1  0 0.01587302
24  1  1  1  0  1  0 0.01587302
25  0  0  0  1  1  0 0.01587302
26  1  0  0  1  1  0 0.01587302
27  0  1  0  1  1  0 0.01587302
28  1  1  0  1  1  0 0.01587302
29  0  0  1  1  1  0 0.01587302
30  1  0  1  1  1  0 0.01587302
31  0  1  1  1  1  0 0.01587302
32  1  1  1  1  1  0 0.01587302
33  0  0  0  0  0  1 0.01587302
34  1  0  0  0  0  1 0.01587302
35  0  1  0  0  0  1 0.01587302
36  1  1  0  0  0  1 0.01587302


style="display:inline-block;width:468px;height:15px"
data-ad-client="ca-pub-3713658242215030"
data-ad-slot="3683830247">

37  0  0  1  0  0  1 0.01587302
38  1  0  1  0  0  1 0.01587302
39  0  1  1  0  0  1 0.01587302
40  1  1  1  0  0  1 0.01587302
41  0  0  0  1  0  1 0.01587302
42  1  0  0  1  0  1 0.01587302
43  0  1  0  1  0  1 0.01587302
44  1  1  0  1  0  1 0.01587302
45  0  0  1  1  0  1 0.01587302
46  1  0  1  1  0  1 0.01587302
47  0  1  1  1  0  1 0.01587302
48  1  1  1  1  0  1 0.01587302
49  0  0  0  0  1  1 0.01587302
50  1  0  0  0  1  1 0.01587302
51  0  1  0  0  1  1 0.01587302
52  1  1  0  0  1  1 0.01587302
53  0  0  1  0  1  1 0.01587302
54  1  0  1  0  1  1 0.01587302
55  0  1  1  0  1  1 0.01587302
56  1  1  1  0  1  1 0.01587302
57  0  0  0  1  1  1 0.01587302
58  1  0  0  1  1  1 0.01587302
59  0  1  0  1  1  1 0.01587302
60  1  1  0  1  1  1 0.01587302
61  0  0  1  1  1  1 0.01587302
62  1  0  1  1  1  1 0.01587302
63  0  1  1  1  1  1 0.01587302
64  1  1  1  1  1  1 0.01587302

> A <- subset(N,(X1+X2+X3+X4+X5+X6)>3)

> #probabilidad de sacar mas de 3 bolas

> prob(A)
[1] 0.3492063

 

Español
Pin It