their sequence numbers are consecutive, lets give all
those numbers a sequence number, which is the mean of
the original consecutive sequence numbers. If for
example exactly three elements of the pooled sample
have a certain same value and their original
that A contains (together with the number of events in
S ). Hence, to be a master of probability one must be
skilled at counting outcomes in events of all kinds.
Proposition 4.15. The Multiplication Principle. Suppose
that an experiment is composed of two
chance of at least one match. Figure 4.5.1 shows a graph
of the birthday probabilities: 4.5.4 How to do it with R
We can make the plot in Figure 4.5.1 with the following
sequence of commands. g <- Vectorize ( pbirthday .ipsur)
4.6. CONDITIONAL PROBABILITY
appropriate. For example, suppose our coin is not
perfectly balanced, for instance, maybe the H side is
somewhat heavier such that the chances of a H
appearing in a single toss is 0.70 instead of 0.5. We may
set up the probability space with >
probspace(t
It is the probability of observing two "red"s, above.
Example 4.35. Consider two urns, the first with 5 red balls
and 3 green balls, and the second with 2 red balls and 6
green balls. Your friend randomly selects one ball from
the first urn and transfers
rank-sum test or just Wilcoxon test. Lets denote the
population medians by 1 and 2. The null hypothesis
is then H0 : 1 = 2. Actually the null hy- Thus, the test
doesnt finally solve the Behrens Fisher-problem,
although its often claimed do so. pothesis is
probability the probspace function will assume that the
equally model is desired if no probs are specified. Thus,
we get the same answer with only > probspace(1:6) x
probs 1 1 0.1666667 2 2 0.1666667 3 3 0.1666667 4 4
0.1666667 5 5 0.1666667 6 6 0.1666667
duplicate earlier ones. 72 CHAPTER 4. PROBABILITY >
urnsamples(1:3, size = 2, replace = FALSE, ordered =
FALSE) X1 X2 1 1 2 2 1 3 3 2 3 This experiment is
equivalent to reaching in the urn, picking a pair, and
looking to see what they are. This is the def
experiment repeatedly, in an identical manner, in such a
way that the successive experiments do not influence
each other. After each experiment, keep a running tally of
whether or not the event A occurred. Let S n count the
number of times that A occurred
= A) [1] 0.5 Note that we do not actually need to define
the events A and B separately as long as we reference the
original probability space S as the first argument of the
prob calculation: > prob(S, X1=X2, given = (X1 + X2 >=
8) ) [1] 0.2 > prob(S, X1+X
example, the balls in the urn were distinguishable in the
sense that each had a unique label to distinguish it from
the others in the urn. A natural question would be,
What happens if your urn has indistinguishable
elements, for example, what if x =
c("Re
random sample from a finite population by numbering its
elements. A binomial distribution Bin(p, n) can basically
be generated as a fi- nite distribution using the above
mentioned method, but this is usually computationally
too heavy. Its easier to genera
step 2, if necessary, until v f(u). (Recall that f is bounded
above by c, that is, f(u) c.) 4. Output x = u. The method
works because of the following reasons: The generated
pairs (u, v) of random numbers are uniformly distributed
over the rectangle a u b
0. 4. 0 IP(A) 1. Proof. The left inequality is immediate
from Axiom 4.6, and the second inequality follows from
Property 3 since A S . 5. The General Addition Rule.
IP(A B) = IP(A) + IP(B) IP(A B). (4.4.3) More
generally, for events A1, A2, A3,. . . , An,
2 3 8 + 3 1 8 = 3.5. We interpret = 3.5 by reasoning
that if we were to repeat the random experiment many
times, independently each time, observe many
corresponding outcomes of the random variable X, and
take the sample mean of the observations, then the
manner. We have seen many examples of this already:
tossing a coin repeatedly, rolling a die or dice, etc. The
iidspace function was designed specifically for this
situation. It has three arguments: x, which is a vector of
outcomes, ntrials, which is an i
2, . . . , 6, that is, S = cfw_(1, 1), (1, 2), . . . ,(6, 6). We know
from Section 4.5 that #(S ) = 6 2 = 36. Let A = cfw_outcomes
match and B = cfw_sum of outcomes at least 8. The sample
space may be represented by a matrix: The outcomes
lying in the eve
events, there will be 2n n 1 equations that must be
satisfied (see Exercise 4.1). Although these requirements
for a set of events to be mutually independent may seem
stringent, the good news is that for most of the situations
considered in this book the c
was given a few similar exercises, the other wasnt. The
following results (scores) were obtained: i 1 2 3 4 5 6 7 8
9 10 Training 531 621 663 579 451 660 591 719 543 575
No training 509 540 688 502 424 683 568 748 530 524
According to the chosen null hypo
TRUE) [1] FALSE The connection to probability is that
have a data frame sample space and we would like to find
a subset of that space. A data.frame method was written
for isin that simply applies the function to each row of
the data frame. We can see the
this we may conclude that the following procedure
produces a random number x from the Poisson
distribution with parameter : 1. Generate independent
exponentially distributed random variables with the
parameter until their sum is 1. 2. When the sum first
t
necessary, namely, until we finally want to interpret them
as probabilities. Second, the reader might be wondering
what the boss would get if (s)he skipped the intermediate
step of calculating the posterior after only one misfiled
document. What if she st
a disadvantage, however. When symmetry fails it is not
always obvious what an objective choice of probability
measure should be; for instance, what probability should
we assign to cfw_Heads if we spin the coin rather than flip
it? (It is not 1/2.) Further
Example 4.24. Place 3 six-sided dice into a cup. Next,
shake the cup well and pour out the dice. How many
distinct rolls are possible? Answer: (6 1 + 3)!/[(6 1)!3!]
= 8 5 = 56. 4.5.3 How to do it with R The factorial n! is
computed with the command factor
probabilities IP(Bk). We go out and collect some data,
which we represent by the event A. We want to know:
how do we update IP(Bk) to IP(Bk|A)? The answer: Bayes
Rule. 4.8. BAYES RULE 103 Example 4.44. Misfiling
Assistants. In this problem, there are thre
3 f(x) = IP(X = x) 1/8 3/8 3/8 1/8 Our next goal is to write
down the CDF of X explicitly. The first case is easy: it is
impossible for X to be negative, so if x < 0 then we should
have IP(X x) = 0. Now choose a value x satisfying 0 x <
1, say, x = 0.3. T
probability function is a rule that associates with each
event A of the sample space a unique number IP(A) = p,
called the probability of A. Any probability function IP
satisfies the following three Kolmogorov Axioms: Axiom
4.6. IP(A) 0 for any event A S
the Binomial Distribution menu with the Binomial
probabilities menu item. Pr 0 0.0625 1 0.2500 2 0.3750 3
0.2500 4 0.0625 We know that the binom(size = 4, prob =
1/2) distribution is supported on the integers 0, 1, 2, 3,
and 4; thus the table is complete.