Question

2/18/24, 8:17 PM V Statistical Intuitions and Applications Assignment #1 SIA_Assignment_1_Spring_2024.ipynb - Colaboratory Background Imagine that you have graduated CIS and now work as a consultant. • You are hired

by a health and fitness company. They have collected detailed data from 507 physically active participants. This data includes information about the participant's body measurements as well as personal attributes such as age, weight, height, and gender. • The company wants you to analyze this data in ways that can help them design personalized fitness evaluations and training regimens for their users. ● Note: The entire dataset (and descriptions of each of the variables) can be found [here] (https://vincentarelbundock.github.io/Rdatasets/doc/openintro/bdims.html). In Assignment 1 you will take a random sample of 100 participants from the 507 individuals who were studied, and analyze the data for these 100 individuals. Important Information: 1. Read all the instructions carefully before you begin! 2. You will need to save the (.ipynb) file as a searchable PDF and NOT as a picture. Likewise, your answers and your codes must be submitted as searchable PDF. Pictures or snapshots of your work will NOT be accepted. 3. The generated csv file and .ipynb file must be submitted in a zip-folder as a secondary source. 4. You may use Jupyter notebook or Colab as per your convenience. Non-compliance with the above instructions will result in a 0 grade on the relevant portions of the assignment. Your instructor will grade your assignment based on what you submitted. Failure to submit the assignment or submitting an assignment intended for another class will result in a 0 grade, and resubmission will not be allowed. Make sure that you submit your original work. Suspected cases of plagiarism will be treated as potential academic misconduct and will be reported to the College Academic Integrity Committee for a formal investigation. As part of this procedure, your instructor may require you to meet with them for an oral exam on the assignment. IMPORTANT: Run the code below. It will load in the packages that you need to complete the tasks below. https://colab.research.google.com/drive/1iUOVD7K3cF6ARJC2Lpp_rZ02HbwjTLbc?usp=sharing#printMode=true 1/13 2/18/24, 8:17 PM SIA_Assignment_1_Spring_2024.ipynb - Colaboratory # Following libraries will be loaded so that these can be applied in codes. import numpy as np import pandas as pd import matplotlib.pyplot as plt import random import scipy.stats as stats Task 1. • As mentioned above, you will select a random sample of 100 individuals from the comapny's data set. • You will then conduct analyzes on this random sample. • Look at the code below. To select a random sample from the data, you should replace Name with your own name in the code. • After you have done so run the code. The code will generate a csv file with a random sample of 100 participants. It will also be labeled with your name. • REMEMBER: you need to add this csv file to a zip file along with your .ipynb. file when submitting your assignment. IMPORTANT: ONLY RUN THIS CODE BLOCK ONCE. If you run it a second time, it will generate a new random sample of 100 individuals. If this happens then your (new) data (in the csv file) will not match your original analyses. # The code below will generate a random sample of 100 participants for you to analyz # You need to replace "Name" in the code below with your own name. The code will the # contains a random sample of 100 individuals. # REMEMBER: you need to submit this csv file in the zip folder when submitting your try: df = pd. read_csv ('Aisha.csv') except FileNotFoundError: # replace Name with your own name ("https://raw.githubusercontent.com/ZUCourses/SIA-Puk # replace Name with your own name # replace Name with your own name # replace Name with your own name original_data = pd. read_csv df1 = original_data.sample (100) dfl.to_csv ('Aisha.csv') df = pd. read_csv ('Aisha.csv') df = pd.DataFrame(df) df.to_csv ('Aisha.csv') df.head() https://colab.research.google.com/drive/1iUOVD7K3cF6ARJC2Lpp_rZ02HbwjTLbc?usp=sharing#printMode=true 2/13 2/18/24, 8:17 PM 0 1 2 3 Unnamed: Unnamed: 0.1 223 Task 2 Answer: 279 114 342 136 0 410 207 356 188 422 SIA_Assignment_1_Spring_2024.ipynb - Colaboratory bia_di bii_di bit_di che de che_di elb_di wri_di kne_ 37.8 40.3 37.9 41.3 35.8 28.0 28.3 29.0 27.3 26.6 32.0 30.6 32.9 32.2 31.1 16.8 18.2 18.6 20.2 18.5 28.3 29.2 27.0 28.3 24.7 12.7 12.9 12.7 https://colab.research.google.com/drive/1iUOVD7K3cF6ARJC2Lpp_rZ02HbwjTLbc?usp=sharing#printMode=true 13.8 12.4 9.8 10.6 10.6 11.4 Task 2. • Now that you have your data set you are ready to start analyzing it! • The first step is to explore your dataset. • Look at the variables that make up the data set. • Once you've done so, imagine you are writing a report for the fitness company that hired you. • Start with a brief introduction to the research question you are exploring, then the dataset you are analysing (e.g., what is the sample you are analyzing? What are the variables?) • Assume that your #Audience is the company's leadership. They will be with what you are reporting. Add this brief introduction below. 9.6 In partnership with a health and fitness company, I have analyzed a sample of 100 physically active participants from their dataset. The goal of this analysis is to extract insights that can help tailor personalized fitness evaluations and training regimens for their users. The dataset I reviewed contains measurements and personal attributes of these 100 individuals, who were randomly selected from a larger group of 507 physically active participants. Some of the variables included in this subset of data are listed below: Age: The age of the participant. Weight: The weight of the participant in kilograms. Height: The height of the participant in centimeters. Gender: The gender of the participant, categorized as male or female. Body Girth Measurements: Biacromial diameter (bia_di) Biiliac diameter (pelvic breadth) (bii_di) Bitrochanteric diameter (bit_di) Chest depth (che_de) Chest diameter (che_di) Elbow diameter (elb_di) Wrist diameter (wri_di) Knee diameter (kne_di) Ankle diameter (ank_di) Shoulder girth (sho_gi) Chest girth (che_gi) Waist girth (wai_gi) Navel (abdominal) girth (nav_gi) Hip girth (hip_gi) Thigh girth (thi_gi) Bicep girth (bic_gi) Forearm girth (for_gi) Calf maximum girth (cal_gi) Ankle minimum girth (ank_gi) Wrist minimum girth (wri_gi) 2 1 3/13 2/18/24, 8:17 PM Task 3. • Run the below code. It will randomly select 4 variables from your dataset. • It will then print the names of the four variables that were randomly selected. import random column_titles = SIA_Assignment_1_Spring_2024.ipynb - Colaboratory ["bia_di", "bii_di", "bit_di", "che_de", "che_di", "elb_di", "wri_di","k # Randomly select 4 titles from the first 22 columns selected_columns random. sample(column_titles, 4) = # Print the four variables that were randomly selected print("Selected Variables:", selected_columns) Selected Variables: ['bic_gi', 'elb_di', 'che_gi', 'wai_gi'] REMEMBER: Check the full name of each of your variables, you can find it here. Your task is to do the following: • You should create a histogram and generate descriptive statistics for each of the four variables that were randomly selected above. You can use the code below to help you do so. • For each variable you need to describe the following: shape, center, spread, and the presence of any outliers. Task 3 Answer: #Sample code: import pandas import matplotlib.pyplot as plt # Remember: you will need to replace "Column" with the name of the variable that you #plot the histogram plt.hist(df['Column'], bins plt.title('Column Distribution') = XX) #replace XX with the number of bins #produce descriptive statistics print ("Descriptive Statistics for Column") df ["Column"].describe() https://colab.research.google.com/drive/1iUOVD7K3cF6ARJC2Lpp_rZ02HbwjTLbc?usp=sharing#printMode=true 4/13 2/18/24, 8:17 PM #Write your code for Task 3 here: # Loop through each selected variable for column in selected_columns: # Plot the histogram plt.figure(figsize=(8, 6)) plt.hist(df [column], bins=10, color='skyblue', edgecolor='black') plt.title(column + ' Distribution') plt.xlabel (column) plt.ylabel('Frequency') plt.grid (True) plt.show() SIA_Assignment_1_Spring_2024.ipynb - Colaboratory # Produce descriptive statistics print("Descriptive Statistics for + column + ":") print (df [column].describe()) print("\n") https://colab.research.google.com/drive/1iUOVD7K3cF6ARJC2Lpp_rZ02HbwjTLbc?usp=sharing#printMode=true 5/13