The data set we will use primarily is Data3350 which was produced in 2015 during an undergraduate research project about personality and humor. The VarsData3350 PDF file has descriptions of each variable in the Data3350 file. Both are available for download in D2L. Be sure to put the Data3350 in your R folder in Documents, and make sure your working directory is set the same way (Session menu). The code block below uses the library function to ensure that the Mosaic package is loaded and will import the data frame used in this module: Data3350 and Dolphin.
library(mosaic)
library(readxl)
Dolphin = read_excel("Dolphin.xlsx")
Data3350 = read_excel("Data3350.xlsx")
Using the SitClass variable from the Data3350 data frame, test the hypothesis that classroom seating preference depends upon membership in the corps of cadets (variable Corps) at the \(\alpha = 0.05\) level. Include a Mosaic plot and describe it’s relationship to your \(p\)-value and conclusions.
Using the SitClass variable from the Data3350 data frame, test the hypothesis that classroom seating preference depends upon biological Sex at the \(\alpha = 0.05\) level. Include a Mosaic plot and describe it’s relationship to your \(p\)-value and conclusions.
Using the AccDate variable from the Data3350 data frame, test the hypothesis that the Yes responses to the dating question are more likely for those in social Greek fraternities and sororities at the \(\alpha = 0.1\) level. Include a Mosaic plot with a description about it’s relationship to your \(p\)-value and conclusions.
Dolphin
tally(Result ~ Treatment, data = Dolphin)
tally(shuffle(Result) ~ Treatment, data = Dolphin)
dolph = sample(Dolphin$Result, size = 15)
tally(dolph)
tally(dolph)[2]
randDolph = do(50) * tally(sample(Dolphin$Result, size = 15))[2]
randDolph
histogram(~ Improved, data = randDolph,
width = 1,
center = 10,
type = "count",
main = "Histogram: Random Improvements",
xlab = "Improvements for Dolphin Group: 50 Samples of 15 Results")
randDolph = do(2000) * tally(sample(Dolphin$Result, 15))[2]
histogram( ~Improved, data = randDolph,
width = 1,
center = 10,
type = "count",
main = "Histogram: Random Improvements",
xlab = "Improvements for Dolphin Group: 2000 Samples of 15 Results")
sum(randDolph >= 10)
tally(Result ~ Treatment, data = Dolphin)
xchisq.test(Result ~ Treatment, data = Dolphin)
xchisq.test(Result ~ Treatment, data = Dolphin)
Data3350 = read_excel("Data3350.xlsx")
tally(AccDate ~ Sex , data = Data3350)
mosaicplot(AccDate ~ Sex , data = Data3350,
color = TRUE,
main = "Mosaic Plot: AcceptDate by Sex")
xchisq.test(AccDate ~ Sex , data = Data3350)
prop.test(AccDate ~ Sex , data = Data3350,
alternative = "less"
)
prop.test(x = 8, n = 8, p = .5,
alternative = "greater")
prop.test(x = 12, n = 14, p = 0.5,
alternative = "greater")
tally(SitClass ~ VarsAth, data = Data3350)
mosaicplot(SitClass ~ VarsAth, data = Data3350,
color = TRUE,
main = "Class seating preference vs. Varsity Athlete status")
xchisq.test(SitClass ~ VarsAth, data = Data3350)