factorial(8)/(factorial(3)*factorial(2))
## [1] 3360
2. A mother duck lines her 9 ducklingsup behind her. In how many ways can the ducklings line up?
factorial(9)
## [1] 362880
3. An incoming lot of silicon wafers is to be inspected for defective ones by an engineer in a microchip manufacturing plant. Suppose that in a tray containing 20 wafers 4 are defective. Two wafers are to be selected randomly for inspection. Find the probability of the event: “Neither is defective”. Print the answer as decimal and fraction both.
Decimal:
choose(16,2)/choose(20,2)
## [1] 0.6315789
Fraction:
library(MASS) #needed for as.fractions()
as.fractions(choose(16,2)/choose(20,2))
## [1] 12/19
1.Ten coins are thrown simultaneously. Find the probability of getting at least seven heads.
sum(dbinom(7:10,10,.5))
## [1] 0.171875
2. A and B play game in which their chances of winning are in the ratio 3:2. Find A’s chance of winning at least three games out of five games played. What is the pmf of the distribution?
sum(dbinom(3:5,5,.6))
## [1] 0.68256
3. A coffee connoisseur claims that he can distinguish between a cup of instant coffee and a cup of percolator coffee 75% of the time. It is agreed that his claim will be accepted if he correctly identifies at least 5 of the 6 cups. Find his chances of having the claim (i) accepted, (ii) rejected, when he does have the ability he claims.
Accepted:
sum(dbinom(5:6,6,.75))
## [1] 0.5339355
Rejected:
1-sum(dbinom(5:6,6,.75))
## [1] 0.4660645
1.Suppose X has a normal distribution with mean=25 and SD=5.25. Find P(X<20)
pnorm(20,25,5.25) #25 is the mean, 5.25 the SD, 20 is x
## [1] 0.1704519
2. Create a normal curve using the following steps:
i. Create an array from -100 to 100 with a step-size0.1. Suppose the name of the vector is “y”
y <- seq(-100,100, by=.1)
z <- dnorm(y, mean = 25, sd = 5.25)
plot(z~y)
1.Consider the given probabily distribution:
x -3 6 9
p 1/6 1/2 1/3
(i)Create two arrays as “x” and “p”
x <- c(-3,6,9)
p <- c(1/6,1/2,1/3)
(ii) Find the:
a) E(X)
x%*%p #same as sum(x*p)
## [,1]
## [1,] 5.5
b) E(X2)
sum((x*p)^2)
## [1] 18.25
c) E((2X+1)2)
sum(((2*x)+1)^2)
## [1] 555
d) V(X)
sum((x-sum(x))^2)
## [1] 270
e) \(\sigma\)(X)
sqrt(sum((x-sum(x))^2))
## [1] 16.43168
sum(dpois(5,4))
## [1] 0.1562935
sum(dpois(0:4,4))
## [1] 0.6288369
1-sum(dpois(0:5,4))
## [1] 0.2148696