# 70 students as of March 6
windows11 <- c("aflores-hernandez","akwong25","bdelacruz-angeles",
"bhernandezarteaga","cbettencourt2","cchen271","cornelas3",
"craigelijaesoriano","davila-castaneda","dvargas38",
"ecastillo-quevedo","efernando","ekjotjohal","elliottwhitney",
"fromerobojorquez","genaxiong","ggonzalez-ramirez",
"ghendrickson","gurindersahota","jasminesamayoa",
"jcontrerastrinidad","jessiemorales","jlegaspina","joneal2",
"jwong290","kchen129","leogarciaortiz","lillieyang",
"lindaespinozamunoz","lorenackerman","mdesilva","rbujji",
"roderickma","skodur","sraman7","tolaniyan","trevoroh")
macOS <- c("adimasagurto","ahmiyasalter","alannahtanner","aleroux",
"alizeibarra","apatterson9","asingh368",
"eflores136","elmermartinez","emendozagonzalez",
"emoya8","isidrohernandez","jaisingh","jangel15","jardindo",
"jessecaclark","jmandujano4","jperez460","kamryntaylor",
"kchen132","kvu56","lalagos","malachifuqua","manroopkaur",
"mayraarias","msuccari","omarkhalil","rbeattie","seanjimenez",
"vchezhiyan","xcortes2")
language_table_students <- c("edmondcheng", "angeliachunyu")
teamsize <- 7
# Set seed for reproducibility
set.seed("20260306")
shuffled_win11 <- sample(windows11, replace = FALSE)
tables <- c(rep(1:3,each=teamsize),rep(4:5,each=(teamsize+1)))
teams_win11 <- split(shuffled_win11, tables)
shuffled_macOS <- sample(macOS, replace = FALSE)
tables <- c(rep(6,(teamsize-1)),rep(7,(teamsize-2)),rep(8:9,each=teamsize),rep(10,(teamsize-1)))
teams_macOS <- split(shuffled_macOS, tables)
teams_macOS$`7` <- c(teams_macOS$`7`,language_table_students)
teams <- lapply(c(teams_win11,teams_macOS),sort)
invisible(lapply(seq_along(teams), function(i) {
cat("Team at Table", i, ":", teams[[i]], "\n")
}))
## Team at Table 1 : akwong25 cchen271 jwong290 lindaespinozamunoz lorenackerman roderickma skodur
## Team at Table 2 : cbettencourt2 ecastillo-quevedo ekjotjohal fromerobojorquez lillieyang rbujji trevoroh
## Team at Table 3 : aflores-hernandez cornelas3 davila-castaneda efernando jasminesamayoa jlegaspina sraman7
## Team at Table 4 : bhernandezarteaga craigelijaesoriano elliottwhitney genaxiong jessiemorales joneal2 leogarciaortiz mdesilva
## Team at Table 5 : bdelacruz-angeles dvargas38 ggonzalez-ramirez ghendrickson gurindersahota jcontrerastrinidad kchen129 tolaniyan
## Team at Table 6 : alizeibarra isidrohernandez jardindo manroopkaur msuccari rbeattie
## Team at Table 7 : ahmiyasalter angeliachunyu edmondcheng jangel15 kvu56 omarkhalil seanjimenez
## Team at Table 8 : adimasagurto apatterson9 asingh368 eflores136 emoya8 lalagos malachifuqua
## Team at Table 9 : alannahtanner aleroux elmermartinez emendozagonzalez jaisingh kamryntaylor kchen132
## Team at Table 10 : jessecaclark jmandujano4 jperez460 mayraarias vchezhiyan xcortes2DSC 011 S26 Lecture 18 Demo
Binomial Hypothesis Tests
Preliminaries: Assignment of Teams and Team Tables
The class will split into OS-specific randomly assigned teams of about seven. The teams and team tables are determined by random sampling without replacement (also known as permutation) as follows:
Instructions for Completing and Submitting This Assignment
- Install Prerequisite Libraries
Prequisites to Knit This File
- Download today’s zipped project directory from CatCourses to your laptop (RStudio Server is possible but not supported). You need to install working RStudio on your machine and ask for help if needed. If you can’t do today’s demo on your own laptop, then ask your neighbor to watch their work, then replicate it on your own machine after class.
- Move it from your Downloads to your Course Directory inside where you keep your
DEMOS - Uncompress the zipped project directory for today’s demo
- Double-click to open the project file
DSC-011-S26_Lecture17_Demo_Poisson_Beta_Binomial.Rprojto open today’s demo project in RStudio. - In the file-pane of RStudio, click on the file
DSC011-S26-Lecture17_Demo_Beta_Binomial_FirstName_LastName.qmdto open it in the Source pane. - Personalize the file by adding your name up in the
authorfield of the YAML header above (**you will lose points if you don’t), - Save as… the file with a new name containing your name in the same project directory where the template is so it appears in your file pane.
- Play this code chunk to install packages necessary to render this file.
- Render to HTML
- Follow instructions from the HTML rendered output by editing your personalized notebook.
- As you work the assignment, keep rendering and editing the file, asking for help from your team until you get all CORRECT for each problem. Two or more students may ask for help from the instructors.
- Render to HTML and submit to Catcourses. Turn in as much CORRECT work as you can by the end of class today. Submission by end of class qualifies you for credit.
- Resubmit your best work by midnight tonight for better grade or fully accepted work – only your latest and best work gets graded.
Assignment
Compute One-Sided Tail Probability of Two or Fewer Successes in 10 Trials (Binomial Test)
- Fill in values 2 for
xand 10 fornto compute a one-sided binomial test for the probability of two or fewer successes given a null hypothesis \(H_0: \pi = 0.5\), to verify the calculation shown in the slides.
code <- quote(binom.test(2,10,alternative = "less"))
print_and_check_expr(
code,
value_key = "9a1b7df2fa9a1283d9057972ffaa68a67d5df09d23d6359b62beff8541c280a7",
required_fns = ("binom.test")
)
##
## Exact binomial test
##
## data: 2 and 10
## number of successes = 2, number of trials = 10, p-value = 0.0546875
## alternative hypothesis: true probability of success is less than 0.5
## 95 percent confidence interval:
## 0.000000000000000 0.506901301063202
## sample estimates:
## probability of success
## 0.2
##
## [VALUE] CORRECT
## [CODE] Uses binom.test(): YES -- CORRECT- Modify the previous code by appending
$p.valueto extract just the \(p\)-value from the return value object of the call tobinom.test().
code <- quote(binom.test(2,10,alternative = "less")$p.value)
print_and_check_expr(
code,
value_key = "7aceaab78e65fdd7162e533b78d75b76f3f28bda61b8cafa3934217f5c83e186",
required_fns = ("binom.test")
)
## [1] 0.0546875
## [VALUE] CORRECT
## [CODE] Uses binom.test(): YES -- CORRECT- Use
pbinom, the cumulative distribution function for the binomial, and fill in values to compute the one-sided tail probability of 2 successes in 10 trials under the hypothesis \(H_0: \pi = 0.5\) a different way to compare to the \(p\)-value frombinom.test(). Round to 5 digits after the decimal point.
code <- quote(round(pbinom(2,10,0.5),5))
print_and_check_expr(
code,
value_key = "d9ccea63afea578b23fcffb51718ac96b838de9f66b29592bb3e690eaf09e056",
required_fns = c("pbinom","round")
)
## [1] 0.05469
## [VALUE] CORRECT
## [CODE] Uses pbinom(): YES -- CORRECT
## [CODE] Uses round(): YES -- CORRECT