Question 4 Page

# Question 4 page

• 5

This preview shows page 1 - 3 out of 5 pages.

Question 4 Page 1 of 7 8/19/19, Lab 2 5.41 PM head(dataframe1) # Use head function to print out the first few rows of the data fra me ## Habit Mage Gender weight ## 1 NonSmoker 25 Male 124 ## 2 NonSmoker 26 Female 177 ## 3 NonSmoker 16 Male 107 ## 4 NonSmoker 37 Female 144 ## 5 NonSmoker 33 Male 117 ## 6 NonSmoker 29 Female 98 Question 5 (a) mean(NCbirths\$weight) # Find the mean of the babies' weights in the NCbirths data fr ame ## [1] 116.0591 The mean weight of all babies is 116.0591 ounces. (b) library (mosaic) # Load the mosaic package mean(weight ~ Habit=="Smoker", data = NCbirths) # Find the mean of the weights of ba bies born to smoking mothers from the NCbirths data frame
## FALSE TRUE ## 116.8476 108.4225 The mean weight of babies born to smoking mothers is 108.44225 ounces. (c) mean(weight ~ Habit=="NonSmoker", data = NCbirths) # Find the mean of the weights of babies born to non-smoking mothers from the NCbirths data frame Page 2 of 7 8/19/19, Lab 2 5.41 PM ## FALSE TRUE ## 108.7409 116.8416 The mean weight of babies born to non-smoking mothers is 116.8416 ounces. Question 6 (a) sd(NCbirths\$weight) # Find the standard deviation of babies' weights in NCbirths dat a frame ## [1] 20.40667 The standard deviation of the weights of all babies is 20.40667 ounces. (b) sd(weight ~ Habit=="Smoker", data = NCbirths) # Find the standard deviation of the w eights of babies born to smoking mothers from the NCbirths data frame ## FALSE TRUE ## 20.28708 20.03352 The standard deviation of the weights of babies born to smoking mothers is 20.03352 ounces.

#### You've reached the end of your free preview.

Want to read all 5 pages?

• Spring '20

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern