0% found this document useful (0 votes)
10 views4 pages

Questions

The document outlines the rationale behind using the Sleep Health and Lifestyle dataset, detailing its composition and source. It discusses the intentional introduction of data issues to simulate real-world problems and the subsequent cleaning and transformation processes applied to the dataset. Additionally, it covers statistical concepts and methods used for analysis, such as normalization, encoding, and measures of central tendency.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Questions

The document outlines the rationale behind using the Sleep Health and Lifestyle dataset, detailing its composition and source. It discusses the intentional introduction of data issues to simulate real-world problems and the subsequent cleaning and transformation processes applied to the dataset. Additionally, it covers statistical concepts and methods used for analysis, such as normalization, encoding, and measures of central tendency.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Questions:

DATASET QUESTIONS

Q: Why did you choose the Sleep Health and Lifestyle dataset?

"It has a mix of numeric and categorical variables, a clear target variable which is Sleep
Disorder, and it naturally connects lifestyle factors to health outcomes. This made it
perfect for all the tasks — cleaning, transformation, EDA and descriptive statistics."

Q: What are the columns in your dataset?

"The dataset has 13 columns — Person ID, Gender, Age, Occupation, Sleep Duration,
Quality of Sleep, Physical Activity Level, Stress Level, BMI Category, Blood Pressure, Heart
Rate, Daily Steps and Sleep Disorder."

Q: What is the dataset source?

"It is a secondary dataset taken from Kaggle — the Sleep Health and Lifestyle Dataset
uploaded by user uom190346a. It contains 374 observations."

DATA ISSUES QUESTIONS

Q: Why did you intentionally introduce errors into the dataset?

"The project requirement says to introduce data issues to simulate real-world problems.
Real datasets are never perfectly clean — they have missing values, typos, duplicates and
invalid entries. So we artificially added these to practice the cleaning process."

Q: What types of errors did you introduce?

"We introduced five types — missing values in Age, Sleep Duration and BMI Category;
invalid numeric values like Age = -5 and Sleep Duration = 30; inconsistent formats in
Gender like 'male' and 'FEMALE'; duplicate rows using rbind(); and typographical errors in
Sleep Disorder like 'insomnia' in lowercase and 'Insomnia ' with a trailing space."

Q: What does [Link](42) do?

"It sets a fixed starting point for R's random number generator. This ensures that every time
we run the code, the same rows get randomly selected for errors, making our results
reproducible."
DATA CLEANING QUESTIONS

Q: Why did you use median for Age but mean for Sleep Duration?

"We used median for Age because we had introduced extreme outliers like -5 which skew
the mean. The median is more robust to outliers. For Sleep Duration, the values were more
normally distributed so the mean was appropriate."

Q: Why did you use mode for BMI Category?

"BMI Category is a categorical variable — it has text values like Normal, Overweight and
Obese. You cannot calculate a mean or median for text data, so the mode, which is the
most frequently occurring value, is the correct choice."

Q: How did you fix the Gender inconsistency?

"We used three steps — first tolower() to convert everything to lowercase, then trimws() to
remove extra spaces, and finally tools::toTitleCase() to capitalize the first letter. This
converts 'male', 'MALE' and 'Male' all into 'Male'."

Q: What is the IQR method for detecting outliers?

"IQR stands for Interquartile Range — it is Q3 minus Q1, which represents the middle 50%
of the data. Any value below Q1 minus 1.5 times IQR or above Q3 plus 1.5 times IQR is
considered an outlier. It is a standard statistical method resistant to extreme values."

Q: How did you remove duplicate rows?

"We used the duplicated() function which returns TRUE for rows that are exact copies of a
previous row. We then used the NOT operator with square bracket indexing to keep only the
rows where duplicated() is FALSE, which removes all duplicates."

TRANSFORMATION & EDA QUESTIONS

Q: What is Min-Max normalization and why did you use it?

"Min-Max normalization scales all values to a range between 0 and 1 using the formula:
value minus minimum divided by maximum minus minimum. We applied it to Daily Steps
and Heart Rate because they operate on very different scales — steps are in thousands
while heart rate is in the 65–86 range. Normalization makes them comparable."

Q: Why did you convert Sleep Disorder to binary (0 and 1)?


"Binary encoding makes categorical variables usable in mathematical models. A value of 0
means no sleep disorder and 1 means the person has either Insomnia or Sleep Apnea. This
encoding is necessary for balancing, statistical comparison and future machine learning
tasks."

Q: Why did you balance the dataset?

"The original dataset had 215 people with no disorder and 159 with a disorder — that is
imbalanced. If we analyze an imbalanced dataset, the majority class dominates and
results become biased. By undersampling the majority class to 159, both classes have
equal representation giving us 159 each."

Q: Why 70-30 split for train and test?

"70-30 is the standard split in data science. 70% gives the model enough data to learn
patterns while 30% is kept completely separate to evaluate performance on unseen data.
This prevents overfitting where a model memorizes training data but fails on new data."

Q: What does the boxplot for Sleep Duration by Gender show?

"It shows that Female individuals have a slightly higher mean sleep duration of 7.21 hours
compared to Males at 7.02 hours. However both medians are close — around 7.1 and 7.2
respectively — suggesting the difference is small. Females show slightly more variability in
sleep patterns based on the wider box."

Q: What does the Heart Rate by BMI Category output show?

"Obese individuals have the highest mean heart rate at 84.2 beats per minute, while
Normal BMI individuals have the lowest at 68.9. This makes medical sense as higher body
weight generally increases cardiovascular strain. The IQR for Overweight is the highest at 7,
meaning more variability in that group."

STATISTICS QUESTIONS

Q: What is the difference between mean and median?

"Mean is the arithmetic average — sum of all values divided by count. Median is the middle
value when data is sorted. Mean is sensitive to outliers while median is not. For example if
one age value is -5, it pulls the mean down but does not affect the median much."

Q: What does standard deviation tell us?


"Standard deviation measures how spread out values are around the mean. A low standard
deviation means values are clustered close to the mean. A high one means they are more
spread out. For example our Age standard deviation is 8.5 meaning most ages are within
about 8.5 years of the mean of 42."

Q: What is variance?

"Variance is the square of the standard deviation. It measures the average squared
distance from the mean. We use standard deviation more often in interpretation because it
is in the same units as the original data, while variance is in squared units."

You might also like