5. Simulacion estadistica del Ejercicio 2.11(Probabilidad experimento realizado varias veces)

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)

> M <- tosscoin( 7);

> N <- probspace(M);

> M
    toss1 toss2 toss3 toss4 toss5 toss6 toss7

1       H     H     H     H     H     H     H
2       T     H     H     H     H     H     H
3       H     T     H     H     H     H     H
4       T     T     H     H     H     H     H
5       H     H     T     H     H     H     H
6       T     H     T     H     H     H     H
7       H     T     T     H     H     H     H
8       T     T     T     H     H     H     H
9       H     H     H     T     H     H     H
10      T     H     H     T     H     H     H
11      H     T     H     T     H     H     H
12      T     T     H     T     H     H     H
13      H     H     T     T     H     H     H
14      T     H     T     T     H     H     H
15      H     T     T     T     H     H     H
16      T     T     T     T     H     H     H
17      H     H     H     H     T     H     H
18      T     H     H     H     T     H     H
19      H     T     H     H     T     H     H
20      T     T     H     H     T     H     H
21      H     H     T     H     T     H     H
22      T     H     T     H     T     H     H
23      H     T     T     H     T     H     H
24      T     T     T     H     T     H     H
25      H     H     H     T     T     H     H
26      T     H     H     T     T     H     H
27      H     T     H     T     T     H     H
28      T     T     H     T     T     H     H
29      H     H     T     T     T     H     H
30      T     H     T     T     T     H     H
31      H     T     T     T     T     H     H
32      T     T     T     T     T     H     H
33      H     H     H     H     H     T     H
34      T     H     H     H     H     T     H
35      H     T     H     H     H     T     H
36      T     T     H     H     H     T     H
37      H     H     T     H     H     T     H
38      T     H     T     H     H     T     H
39      H     T     T     H     H     T     H
40      T     T     T     H     H     T     H
41      H     H     H     T     H     T     H
42      T     H     H     T     H     T     H
43      H     T     H     T     H     T     H
44      T     T     H     T     H     T     H
45      H     H     T     T     H     T     H
46      T     H     T     T     H     T     H
47      H     T     T     T     H     T     H
48      T     T     T     T     H     T     H
49      H     H     H     H     T     T     H
50      T     H     H     H     T     T     H
51      H     T     H     H     T     T     H
52      T     T     H     H     T     T     H
53      H     H     T     H     T     T     H
54      T     H     T     H     T     T     H
55      H     T     T     H     T     T     H
56      T     T     T     H     T     T     H
57      H     H     H     T     T     T     H
58      T     H     H     T     T     T     H
59      H     T     H     T     T     T     H
60      T     T     H     T     T     T     H
61      H     H     T     T     T     T     H
62      T     H     T     T     T     T     H
63      H     T     T     T     T     T     H
64      T     T     T     T     T     T     H
65      H     H     H     H     H     H     T
66      T     H     H     H     H     H     T
67      H     T     H     H     H     H     T
68      T     T     H     H     H     H     T
69      H     H     T     H     H     H     T
70      T     H     T     H     H     H     T
71      H     T     T     H     H     H     T
72      T     T     T     H     H     H     T
73      H     H     H     T     H     H     T
74      T     H     H     T     H     H     T
75      H     T     H     T     H     H     T
76      T     T     H     T     H     H     T
77      H     H     T     T     H     H     T
78      T     H     T     T     H     H     T
79      H     T     T     T     H     H     T
80      T     T     T     T     H     H     T
81      H     H     H     H     T     H     T
82      T     H     H     H     T     H     T
83      H     T     H     H     T     H     T
84      T     T     H     H     T     H     T
85      H     H     T     H     T     H     T
86      T     H     T     H     T     H     T
87      H     T     T     H     T     H     T
88      T     T     T     H     T     H     T
89      H     H     H     T     T     H     T
90      T     H     H     T     T     H     T
91      H     T     H     T     T     H     T
92      T     T     H     T     T     H     T
93      H     H     T     T     T     H     T
94      T     H     T     T     T     H     T
95      H     T     T     T     T     H     T
96      T     T     T     T     T     H     T
97      H     H     H     H     H     T     T
98      T     H     H     H     H     T     T
99      H     T     H     H     H     T     T
100     T     T     H     H     H     T     T
101     H     H     T     H     H     T     T
102     T     H     T     H     H     T     T
103     H     T     T     H     H     T     T
104     T     T     T     H     H     T     T
105     H     H     H     T     H     T     T
106     T     H     H     T     H     T     T
107     H     T     H     T     H     T     T
108     T     T     H     T     H     T     T
109     H     H     T     T     H     T     T
110     T     H     T     T     H     T     T
111     H     T     T     T     H     T     T
112     T     T     T     T     H     T     T
113     H     H     H     H     T     T     T
114     T     H     H     H     T     T     T
115     H     T     H     H     T     T     T
116     T     T     H     H     T     T     T
117     H     H     T     H     T     T     T
118     T     H     T     H     T     T     T
119     H     T     T     H     T     T     T
120     T     T     T     H     T     T     T
121     H     H     H     T     T     T     T
122     T     H     H     T     T     T     T
123     H     T     H     T     T     T     T
124     T     T     H     T     T     T     T
125     H     H     T     T     T     T     T
126     T     H     T     T     T     T     T
127     H     T     T     T     T     T     T
128     T     T     T     T     T     T     T

> A <-subset(N,((toss1=="H")&(toss2=="H")&(toss3=="H"))|((toss2=="H")
&(toss3=="H")&(toss4=="H"))|((toss3=="H")&(toss4=="H")&(toss5=="H"))
|((toss4=="H")&(toss5=="H")&(toss6=="H"))|((toss5=="H")&(toss6=="H")
&(toss7=="H")))

> #Probabilidad de sacar 3 H seguidas

> prob(A)
[1] 0.3671875

 

Español
Pin It