UC R Worksheet

0 comments

#INSTRUCTIONS

#Type the codes for each question

#Include answers to ALL questions in the script as a comment (with a #).

#Questions with a * next to it will ALSO require you to input the answer in Canvas.

#Lastly, upload this R script AND input the corresponding answers to Canvas.

#If you are missing codes or answers in this script, points will be deducted.

#The data is named LungCapData

install.packages(“openintro”)

install.packages(“datasets”)

library(openintro)

library(datasets)

LungCapData = read.csv(“https://docs.google.com/spreadsheets/d/e/2PACX-1vT1l0FLOjOTRScxvdz3Z4SR4v2ji7S0LlADnjL_nYqhuKu1Kfqw3HmwOqOWZXRyMg/pub?output=csv”)

attach(LungCapData)

View(LungCapData)

### CHI SQUARE TEST OF INDEPENDENCE ###

# *1. Using the data named “LungCapData” which we downloaded above, test to see if gender and smoking are independent.

#Ho:

#Ha:

#Conclusion: p-value

# 2. Test to see if having a C section and being a smoker are independent.

#Ho:

#Ha:

#Conclusion: p-value

### DIFFERENCE OF MEANS ###

# *3. Test to see if the mean lung capacity (LungCap) of those who smoke and do not smoke are the same.

# Ho:

# Ha:

#Conclusion:

# 4. Test to see if the mean lung capacity (LungCap) of those who are female and male are the same.

# Ho:

# Ha:

#Conclusion: p-value

### ANOVA Comparing multiple means ###

View(ChickWeight)

levels(ChickWeight$Diet) # 4 diets

attach(ChickWeight)

# *5. This data includes the weight of chickens that eat 4 different diets

#Test to see if the average chicken weight for each diet is equal.

# Ho:

# Ha:

#Conclusion: p-value

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}