Descriptive Statistics Exercises How many sets of quadruplets were recorded? [LIVEB] What proportion of total live births were quadruplets? What was the mean and standard deviation of the number of prenatal care visits? Be sure to exclude the number 99. Calculate the mean and standard deviation of the number of prenatal care visits by route of delivery (ROUT). Use a functional (any of the apply() family) to create a table of the min, mean, max, and standard deviation of the following variables: obstetric estimate of gestation (GEST), calculated weeks of gestation (WKSGEST), and total number of prenatal care visits (VISITS). Be sure to exclude the number 99. Calculate the statistics from question 3 among mothers grouped by route of delivery (ROUT). Challenge Questions These questions require some pre-processing to solve. What was the most common hour for deliveries to occur? What is the least common hour for deliveries to occur? (The TOB variable gives the time of birth as HHMM). Estimate the mean and standard deviation of the number of years of maternal education. First, transform the MEDUC categorical variable into a numerical variable (see codebook) under the following set of assumptions: “less than high school” (1) ranges from 8-11 years, “high school/GED” (2) takes 12 years, “some college” (3) takes 1-3 years, a “bachelor’s degree” (4) takes 4 additional years, and a “masters or PhD” (5) takes from 2 to 7 additional years. For people in each category, randomly assign years of education from the appropriate range using a uniform random distribution. For women with unknown education (9), assign a random value by sampling the distribution of the known education values in the population. Create a pregnancy complication risk score variable (range 0-6) that counts the number of Y values among six risk factors: PDIAB, PHYPE, PPB, PPO, INFT, and PSEC (don’t count U or N). Calculate the mean and standard deviation of this risk score. Which variable in the dataset has the most unique values?
Descriptive Statistics Exercises How many sets of quadruplets were recorded? [LIVEB] What proportion of total live births were quadruplets? What was the mean and standard deviation of the number of prenatal care visits? Be sure to exclude the number 99. Calculate the mean and standard deviation of the number of prenatal care visits by route of delivery (ROUT). Use a functional (any of the apply() family) to create a table of the min, mean, max, and standard deviation of the following variables: obstetric estimate of gestation (GEST), calculated weeks of gestation (WKSGEST), and total number of prenatal care visits (VISITS). Be sure to exclude the number 99. Calculate the statistics from question 3 among mothers grouped by route of delivery (ROUT). Challenge Questions These questions require some pre-processing to solve. What was the most common hour for deliveries to occur? What is the least common hour for deliveries to occur? (The TOB variable gives the time of birth as HHMM). Estimate the mean and standard deviation of the number of years of maternal education. First, transform the MEDUC categorical variable into a numerical variable (see codebook) under the following set of assumptions: “less than high school” (1) ranges from 8-11 years, “high school/GED” (2) takes 12 years, “some college” (3) takes 1-3 years, a “bachelor’s degree” (4) takes 4 additional years, and a “masters or PhD” (5) takes from 2 to 7 additional years. For people in each category, randomly assign years of education from the appropriate range using a uniform random distribution. For women with unknown education (9), assign a random value by sampling the distribution of the known education values in the population. Create a pregnancy complication risk score variable (range 0-6) that counts the number of Y values among six risk factors: PDIAB, PHYPE, PPB, PPO, INFT, and PSEC (don’t count U or N). Calculate the mean and standard deviation of this risk score. Which variable in the dataset has the most unique values?