There are 10 questions and each question is worth 10 points each. When completed, knit the file to a .HTML and save the file as Test#1_LastName and submit the .HTML file to the Test #1 assignment link on Moodle.
Due Date: Sunday December 20th, 2019 by 11:55p.m. EST.
library(vcd)
## Loading required package: grid
library(vcdExtra)
## Loading required package: gnm
ds <- datasets(package = c("vcd", "vcdExtra"))
str(ds)
## 'data.frame': 76 obs. of 5 variables:
## $ Package: chr "vcd" "vcd" "vcd" "vcd" ...
## $ Item : chr "Arthritis" "Baseball" "BrokenMarriage" "Bundesliga" ...
## $ class : chr "data.frame" "data.frame" "data.frame" "data.frame" ...
## $ dim : chr "84x5" "322x25" "20x4" "14018x7" ...
## $ Title : chr "Arthritis Treatment Data" "Baseball Data" "Broken Marriage Data" "Ergebnisse der Fussball-Bundesliga" ...
View(ds)
structable (Damage~Fail + nFailures, data = SpaceShuttle)
## Damage 0 2 4 11
## Fail nFailures
## no 0 15 0 1 0
## 1 0 0 0 0
## 2 0 0 0 0
## yes 0 0 0 0 0
## 1 0 1 4 0
## 2 0 0 1 1
xtabs(Damage~Fail + nFailures, data = SpaceShuttle)
## nFailures
## Fail 0 1 2
## no 4 0 0
## yes 0 18 15
ftable(Damage~Fail + nFailures, data = SpaceShuttle)
## Damage 0 2 4 11
## Fail nFailures
## no 0 15 0 1 0
## 1 0 0 0 0
## 2 0 0 0 0
## yes 0 0 0 0 0
## 1 0 1 4 0
## 2 0 0 1 1
SpaceShuttle$Fail <- relevel(SpaceShuttle$Fail, "yes")
structable(Damage~Fail+nFailures, data = SpaceShuttle)
## Damage 0 2 4 11
## Fail nFailures
## yes 0 0 0 0 0
## 1 0 1 4 0
## 2 0 0 1 1
## no 0 15 0 1 0
## 1 0 0 0 0
## 2 0 0 0 0
Reminder: Three criteria for Binomial experiment (from our class notes): 1. n independent trials (state n and explain why trial are independent) 2. only one of two outcomes; “success” and “failure” (specify what is a “success” and what is a “failure”) 3. the probability of “success” stays the same from trial to trial (state p and why the probability stays the same from trial to trial) ## Answer: We could take example of Comedy MOvie data from TidyTuesday. It contains information about Comedy Movies released since 2018, and the question is whether comedy movis are more likly be releases at the 13th each month or do the audience like it more than other days?In this data there are 2782 movies associated with a release data, so the expected release per day is 92(2782/32),, the values of probability is about 0.975.##
Is this a binomial experiment? State Yes or No. If Yes, describe the three criteria that make this experiment Binomial. If No, state why this is not a Binomial experiment. ##Ansewer: Yes, this is binomial experiement. Becuase the trial is 100, and the possible outcome is either ‘Yes’ or ‘No’ , and the probability is 50% for each of the result.Therefore,the success rate will yield similar percentage from each tria.##
Is this a binomial experiment? State Yes or No. If Yes, describe the three criteria that make this experiment Binomial. If No, state why this is not a Binomial experiment. ## Answer: No. Because the probability of success went from 0.5 to 0.25. According to Binomial criteria, each trial shoud be independent and the average rate of event should be constant. Therefore, above experienment violates Binomial criteria.##
dbinom(4,10, 0.25)
## [1] 0.145998
pbinom(6,10,0.25)
## [1] 0.9964943
Use the appropriate R function (must be one we discussed in class) to find the probability.
meanOfdischarge= 5.0
#P(X>8)
ppois(8,meanOfdischarge,lower.tail = FALSE)
## [1] 0.06809363
Use the appropriate R function (must be one we discussed in class) to find the probability.
ppois(7,meanOfdischarge,lower.tail = FALSE)
## [1] 0.1333717
Use the appropriate R function (must be one we discussed in class) to find the probability.
dpois(8,meanOfdischarge)
## [1] 0.06527804
data("CyclingDeaths", package = "vcdExtra")
CyclingDeaths.tab <- table(CyclingDeaths$deaths)
CyclingDeaths.tab
##
## 0 1 2 3
## 114 75 14 5
Type interpretation of this graph below (what is this graph telling you?):