knitr::opts_chunk$set(echo = TRUE)
library(SDS100)

$\$

Confidence interval for a single mean

A study by Nierenberg et al (1989) investigated the relationship between personal characteristics and dietary factors, and plasma concentrations of carotenoids.

Please use the data they collected to create a 98% confidence interval for the number of grams of fiber US adults get in a day.

download.file("https://www.lock5stat.com/datasets3e/NutritionStudy.csv", "NutritionStudy.csv")

nutrition_df <- read.csv("NutritionStudy.csv")

fiber <- nutrition_df$Fiber

$\$

Hypothesis test for a single mean

It is recommended that adults sleep at least 8 hours a night

A Statistics professor asked 12 undergraduate students how much sleep they were getting and found the average was 6.2 hours with a standard deviation of 1.7 hours.

Assuming this is representative of all students in a Statistics class, does this provide evidence that students in the class are not getting enough sleep on average?


$\$

Hypothesis tests for two means: Stereograms

step 1:

# step 2a: 

# SDS100::download_data("stereograms.txt")
stereograms <- read.table("stereograms.txt", header = TRUE)

no_visual <- subset(stereograms, group == 'NV')$fusion_time
visual <- subset(stereograms, group == 'VV')$fusion_time



# visualize the data






# step 2b - calculate the t-statistic










# step 3: visualize null distribution









# step 4: calculate the p-value








# step 5: make a decision





# can also run t.test()

$\$

Paired t-test: The freshman 15

The data is from: https://dasl.datadescription.com/datafile/freshman-15/

# SDS100::download_data("freshman-15.txt")
freshman <- read.table("freshman-15.txt", header = TRUE)

initial_weight <- freshman$Initial.Weight
final_weight <- freshman$Terminal.Weight


# Let's define: mu_diff  =  mu_final - mu_initial  


# 1. State the null and alternative hypotheses







# calcualte the weight difference for each participant






# 2a. visualize the data




# 2a. stripchart and boxplot 





# 2b. calculate the observed t-statistic







# 3. plot the null distribution 







# 4.  p-value






# 5. conclusion!




# try the t.test() function 




# confidence interval on the weight gain...


emeyers/SDS100 documentation built on April 28, 2024, 5:07 p.m.