// Here are the meanings of the R arguments: // n = number of times the experiment is repeated // size = number of Bernoulli outcomes in one experiment // prob = the probability of success for Bernoulli rv. rbinom(n=10, size=1, prob=0.5) [1] 1 0 0 1 1 1 1 0 0 1
> rbinom(n=20, size=2, prob=0.5) # or > rbinom(20, 2, 0.5) [1] 1 2 1 2 0 1 1 1 0 2 0 2 2 2 0 1 1 1 1 1
> > rbinom(2, 1000000, 0.5) [1] 500664 499815
> rbinom(10, 90, 0.934) [1] 79 82 84 87 86 81 85 86 82 87
n | S | x |
---|---|---|
1,000 | 469 | 0.4690 |
10,000 | 4,925 | 0.4925 |
100,000 | 49,781 | 0.4978 |
1,000,000 | 500,107 | 0.5001 |
Ans: There is exactly one way of arranging zero objects: ( ). Thus 0! = 1.
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 35 21 7 1 1 8 28 56 70 56 28 8 1
> choose(3, 2) [1] 3
> choose(5, 3) [1] 10
> choose(8, 5) [1] 56
> choose(20, 13) [1] 77520
> dbinom(3, 5, 0.5) [1] 0.3125
> dbinom(5, 10, 1/6) [1] 0.01302381
> choose(50, 45) * 0.7^45 * (1-0.7)^(50-45) + + choose(50, 46) * 0.7^46 * (1-0.7)^(50-46) + + choose(50, 47) * 0.7^47 * (1-0.7)^(50-47) + + choose(50, 48) * 0.7^48 * (1-0.7)^(50-48) + + choose(50, 49) * 0.7^49 * (1-0.7)^(50-49) + + choose(50, 50) * 0.7^50 * (1-0.7)^(50-50) [1] 0.0007228617 > # Next compute these probabilities with dbinom: > dbinom(45, 50, 0.7) + dbinom(46, 50, 0.7) + dbinom(47, 50, 0.7) + + dbinom(48, 50, 0.7) + dbinom(49, 50, 0.7) + dbinom(50, 50, 0.7) [1] 0.0007228617 > # Finally pbinom(44, 50, 0.7) computes the probability of > # making 44 or fewer free throws. 1 - pbinom(44, 50, 0.7) is > # the probability of making 45 or more free throws: > 1 - pbinom(44, 50, 0.7) [1] 0.0007228617