Question
The objective of this problem is to analyze the U.S. National Health and Nutrition Examination Survey (NHANES) dataset of the year 2015-2016 to arrive at
The objective of this problem is to analyze the U.S. National Health and Nutrition Examination Survey (NHANES) dataset of the year 2015-2016 to arrive at a general relationship between the sample size and the standard deviation of the sample statistics. Specific tasks for this problem are given below.
Task-1
Read the nhanes_2015_2016.csv file and store it in the variable named nhanes. Display the first 5 rows of the dataframe nhanes.
#GIVE THE SOLUTION FOR TASK-1 IN THIS CELL:
Task-2
Get the information (i.e, the number of rows and the data types present in each column) and the basic statistical measures about the dataframe nhanes using the appropriate functions available in the Pandas library.
#GIVE THE SOLUTION FOR TASK-2 IN THIS CELL:
Task-3
Our focus is now on the systolic blood pressure values of the people that are located in the BPXSY1 column. However, there are some missing values in the BPXSY1 column (see the information that you obtained in task-2 to know how many missing values are present in the BPXSY1 column) which will hinder our analysis. So, in this task, index the BPXSY1 column and drop the missing values (NaN values) from the column using the appropriate function in the Pandas library. Once you index and drop the NaN values, store them in a variable named systolic_bp. Print the values of systolic_bp and the length of systolic_bp to the output.
#GIVE THE SOLUTION FOR TASK-3 IN THIS CELL:
Task-4
In this task, pick 2 random samples (without replacement) each of size 100 from systolic_bp and store them in variables named sample1 and sample2. Calculate the mean of both sample1 and sample2 and store the mean values in variables named sample1_mean and sample2_mean. Calculate the difference in the mean values of two samples and store it in the variable named sample_mean_diff. Print the value of sample_mean_diff to the output.
#GIVE THE SOLUTION FOR TASK-4 IN THIS CELL:
Task-5
In this task, repeat task-4 10,000 times. For each of the 10,000 times, calculate the difference in the mean values of two samples and store it in the variable named sample_mean_diff. Append all of the sample_mean_diff values to an empty list sbp_diff_100. Once you have calculated the difference in the mean values for each of the 10,000 times, plot the distribution of sbp_diff_100 and calculate the number of bins for the distribution depending on the number of repetitions used in this task. Also, the plot must display appropriate x-label, y-label, and title.
#GIVE THE SOLUTION FOR TASK-5 IN THIS CELL:
Task-6
In this task, repeat task-4 10,000 times but with a sample size of 400. For each of the 10,000 times, calculate the difference in the mean values of two samples of size 400 and store it in the variable named sample_mean_diff. Append all of the sample_mean_diff values to an empty list sbp_diff_400. Once you have calculated the difference in the mean values for each of the 10,000 times, plot the distribution of sbp_diff_400 and calculate the number of bins for the distribution depending on the number of repetitions used in this task. Also, the plot must display appropriate x-label, y-label, and title.
#GIVE THE SOLUTION FOR TASK-6 IN THIS CELL:
Task-7
In this task, repeat task-4 10,000 times but with a sample size of 900. For each of the 10,000 times, calculate the difference in the mean values of two samples of size 900 and store it in the variable named sample_mean_diff. Append all of the sample_mean_diff values to an empty list sbp_diff_900. Once you have calculated the difference in the mean values for each of the 10,000 times, plot the distribution of sbp_diff_900 and calculate the number of bins for the distribution depending on the number of repetitions used in this task. Also, the plot must display appropriate x-label, y-label, and title.
#GIVE THE SOLUTION FOR TASK-7 IN THIS CELL:
Task-8
Compute the standard deviation of sbp_diff_100, sbp_diff_400, and sbp_diff_900 and store in the variables named sample100_std, sample400_std, and sample900_std, respectively. Print the values of sample100_std, sample400_std, and sample900_std to the output.
#GIVE THE SOLUTION FOR TASK-8 IN THIS CELL:
Task-9 (2.5 points): By observing the standard deviation values for sample sizes 100, 400, and 900 that you obtained in task-8, answer each of the following questions in the MARKDOWN cell below.
1) Are the standard deviation values increasing or decreasing when you increase the sample size from 100 to 400 to 900?
2) Approximately, by what factor the standard deviation value is increasing or decreasing when the sample size is increased by a factor of 4 (i.e., from 100 to 400)?
3) Approximately, by what factor the standard deviation value is increasing or decreasing when the sample size is increased by a factor of 9 (i.e., from 100 to 900)?
4) Based on your observations for questions 2) and 3), write the general relationship that you expect between the sample size and the standard deviation values. In other words, when you increase the sample size by a factor of K, by what factor should the standard deviation values increase or decrease?
5) Which sample size gives you more confidence on the computed statistical estimate which is the difference in the mean systolic pressure? Justify your answer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started