n<- 13
p<-0.7
dbinom(6,size = n, prob = p)
## [1] 0.0441524
x<-0:n
plot(x,dbinom(x,size = n, prob = p), main = "probability mass function of Bin(13,0.7)")
#binomial
pbinom(9,size = n, prob = p)
## [1] 0.5793944
plot(x,pbinom(x,size = n, prob = p), main = "probability mass function of Bin(13,0.7)")
dbinom(6, size = n, prob = p)
## [1] 0.0441524
x<-0:n
plot(x,dbinom(x,size = n, prob = p), main = "probability mass function of Bin(13,0.7)")
#probability of getting 26 or less heads from a 51 tosses of a coin.
x<- pbinom(26,51,0.5)
x
## [1] 0.610116
plot(pbinom(0:26,51
,0.5,1/2), main = "probability mass function of Bin(26,51,0.5)")
#How many head will have a probability of o.25 will came out when a coin is tossed 51 times.
x<-qbinom(0.25,51,1/2)
x
## [1] 23
#Find 8 random values from a sample of 15 wit
#Suppose there are twelve multiple choice question in English class quiz. Each question has
#five possible answers, and only one of them is correct.Find the probability of having four or
#less correct answers if a student attempts to answer every question at random.
pbinom(4,size = 12, prob = 1/5)
## [1] 0.9274445
#Suppose there are twelve multiple choice question in English class quiz. Each question has
#six possible answers, and only one of them is correct.Find the probability of having six or
#less correct answers if a student attempts to answer every question at random.
pbinom(5,size = 12, prob = 1/6)
## [1] 0.992075
#In a large restaurant an average of 3 out of 5 customer ask for water with their meal.
#A random sample of 10 customer is selected
#A) FIND THE PROBABILITY THAT (i)exactly 6 ask for water with their meal,
#(ii) less than 9 ask for water with their meal.
#(i) answer
dbinom(6,size = 10, prob = 3/4)
## [1] 0.145998
#(ii) ans
pbinom(9,size = 10, prob = 3/4)
## [1] 0.9436865
#A homeowner plants 6 bulbs selected at random from a box containing 5 tulip bulbs and 4 daffodil
#bulbs. What is the probability that he planted 2 daffodil bulbs and tulip bulbs?
dhyper(x=2,m=4,n=5,k=6)
## [1] 0.3571429
#A storeroom just received a shipment of 13 paper grates. Shortly after they were received, the
#manufacturer called to report that he had inadver tently shipped 5 defective units. The owner of
#the owner of the storeroom decided to test 4 of the 13 paper graters she received. Assume
#3 or less unit defective
phyper(q=3,m=5,n=8,k=4)
## [1] 0.993007
#more than 2 unit are defector
phyper(q=2,m=5,n=8,k=4, lower.tail = FALSE)
## [1] 0.1188811
#A Company produces and ships 16 personal computers knowing that 5 of them have defective wiring.
#The company that purchased the computers is going to thoroughly test four of the computers. The
#purchasing company can detect
#A CD contains 10 songs; 6 are classical and 4 are rock and roll. in a sample of 3 songs, what is the
#probability that exactly 2 are classical? Assume the samples are drawn without replacement.
dhyper(x=2,m=6,n=4,k=3)
## [1] 0.5
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.