Plot the probability distribution
plot(x=0:25,dbinom(x=0:25,size = 25,prob = .12))
What is the probability that there are exactly 3 defective products in the sample?
dbinom(3,25,.12)
## [1] 0.2387209What is the probability there are more than 3 defective products in the sample?
1-pbinom(3,25,.12)
## [1] 0.352463
1. The arrival of customers to a queue follows a Poisson process with an average rate of 14.25 per hour.
a. Plot the probability distribution from 10 to 20
plot(x=10:20,dpois(x=10:20,lambda=14.25))
b. What is the probability that exactly 14 customers will arrive in the next hour?
dpois(14,14.25)
## [1] 0.1057556
c. What is the probability that there will be less than 12 customers who arrive in the next hour?
ppois(11,14.25)
## [1] 0.2395169
1. A particular random variable is normally distributed with a mean of 20 and a standard deviation of 2.5.
a. plot the probability density function of X for all x between 10 and 30, be sure to add a title and label to the axes
curve(dnorm(x,20,2.5),10,30, main ="PDF",xlab = "x", ylab = "Probability")
b. plot the cumulative density function of X for all x between 10 and 30, be sure to add a title and label to the axes
curve(pnorm(x,20,2.5),10,30,main = "CDF", xlab = "X", ylab="Probability")
c. Find the probability X<19.73
pnorm(19.73,20,2.5)
## [1] 0.4569978
d. Find the probability 18.5<X<19.73
pnorm(19.73,20,2.5)-pnorm(18.5,20,2.5)
## [1] 0.1827447
1. A particular random variable is exponentially distributed with a mean of 5 (recall: E[X]=1/rate)
a. plot the probability density function of X for all x between 0 and 25, be sure to add a title and label to the axes
curve(dexp(x,0.2),0,25,main = "PDF Exponential", xlab = "X", ylab = "Probability")
b. plot the cumulative density function of X for all x between 0 and 25, be sure to add a title and label to the axes
curve(pexp(x,.2),0,25,main = "CDF Exponential", xlab = "X", ylab = "Probability")
c. Find the probability X<10.27
pexp(10.27,.2)
## [1] 0.871779
d. Find the probability 3.84<X<10.27
pexp(10.27,.2)-pexp(3.84,.2)
## [1] 0.335719
1. A particular random variable is gamma distributed with a shape parameter of 2.3 and a scale parameter of 8.4 (be sure to set parameters correctly in R)
a. plot the probability density function of X for all x between 0 and 50, be sure to add a title and label to the axes
curve(dgamma(x,shape = 2.3,scale = 8.4),0,50,main="PDF Gamma",xlab="X",ylab="Probability")
b. plot the cumulative density function of X for all x between 0 and 50, be sure to add a title and label to the axes
curve(pgamma(x,shape =2.3,scale = 8.4),0,50,main="CDF Gamma",xlab="X",ylab="Probability")
c. Find the probability X<27.4
pgamma(27.4,shape = 2.4,scale = 8.4)
## [1] 0.7618589
d. Find the probability 17.3 <X<27.4
pgamma(27.4,shape = 2.4,scale = 8.4) - pgamma(17.3,shape = 2.4,scale = 8.4)
## [1] 0.2665412