CommencerCommencer gratuitement

Inferential statistics

To get vital health data in tracking for youth body mass index, health officials sent out a youth survey to a nationally representative sample of youths between 14 to 20 years of age as of December 31, 1999. The dataset tracks the age Age, height in inchesHeight_in, weight in pounds Weight_lbs, gender Gender, and the self reported multiple choice answer to the question, 'How would you describe your weight?' describe_weight.

The cleaned up dataset of the survey has been loaded as youth_survey_clean. In this exercise, you will calculate confidence intervals.

pandas, NumPy, and SciPy's statistics package have been loaded as pd, np and st, respectively.

Cet exercice fait partie du cours

Analyzing Survey Data in Python

Afficher le cours

Instructions

  • Calculate the confidence interval for the true population mean height, Height_in, using a 95% confidence level.
  • Calculate the confidence interval for the true population mean height, Height_in, using a 99% confidence level.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Find confidence interval for mean height with 95% confidence level
conf_95 = st.norm.interval(alpha = ____, 
                           loc = np.mean(____), 
                           scale = st.sem(____))

# Find confidence interval for mean height with 99% confidence level
conf_99 = st.norm.interval(alpha = ____, 
                           loc = np.mean(____), 
                           scale = st.sem(____))
print("conf_95 = ", conf_95)
print("conf_99 = ", conf_99)
Modifier et exécuter le code