10.10 Chapter 10 Review Questions

The data frame newborns contains information on the birth weight and gestational period for 375 newborns. It was collected as part of the Child Health and Development Studies in 1961 and 1962. Information about the baby's parents (age, income, education) and whether the mother smoked is also recorded.

A data frame with 500 observations on the following variables:

  • gestation length of gestation (in days)
  • wt birth weight (in ounces)
  • age mother's age in years at end of pregnancy
  • ed mother's education: less than 8th grade, 8th -12th grade - did not graduate, HS graduate--no other schooling, HS+trade, HS+some college, College graduate, Trade school HS unclear
  • dage father's age (in years)
  • ded father's education (same coding as mother's education)
  • income family yearly income in two groups: $0-12500 or $12,500-22,500
  • smoke does the mother smoke? (never, or now)

require(coursekata) set.seed(7) newborns <- sample(Gestation, 500) newborns$inc <- recode(newborns$inc, "0-2500" = "$0-12,500", "2500-5000" = "$0-12,500", "5000-7500" = "$0-12,500", "7500-10000" = "$0-12,500", "10000-12500" = "$0-12,500", "12500-15000" = "$12,500-22,500", "15000-17500" = "$12,500-22,500", "15000+" = "$12,500-22,500", "17500-20000" = "$12,500-22,500", "20000-22500" = "$12,500-22,500") newborns$income <- factor(newborns$inc, levels = c("$0-12,500", "$12,500-22,500")) newborns <- select(newborns, gestation, wt, age, ed, dage, ded, income, smoke) newborns <- filter(newborns, smoke == "never"|smoke == "now") newborns <- filter(newborns, income != "NA") # run your code here
require(coursekata) set.seed(7) newborns <- sample(Gestation, 500) newborns$inc <- recode(newborns$inc, "0-2500" = "$0-12,500", "2500-5000" = "$0-12,500", "5000-7500" = "$0-12,500", "7500-10000" = "$0-12,500", "10000-12500" = "$0-12,500", "12500-15000" = "$12,500-22,500", "15000-17500" = "$12,500-22,500", "15000+" = "$12,500-22,500", "17500-20000" = "$12,500-22,500", "20000-22500" = "$12,500-22,500") newborns$income <- factor(newborns$inc, levels = c("$0-12,500", "$12,500-22,500")) newborns <- select(newborns, gestation, wt, age, ed, dage, ded, income, smoke) newborns <- filter(newborns, smoke == "never"|smoke == "now") newborns <- filter(newborns, income != "NA") # run your code here

Responses