BMI, Disease Risk, and Lifestyle Factors

Using health_lifestyle_dataset.csv, an exploratory analysis

Shiva Leela Bykani and Student ID’s: s4198656

Last updated: 19 October, 2025

Introduction

-Body composition and physical health can be significantly impacted by lifestyle choices like smoking.

-A popular metric for determining a healthy weight in relation to height is the body mass index, or BMI.

-This study examines whether the BMIs of smokers and non-smokers differ noticeably.

-Descriptive statistics, data visualization, and R hypothesis testing are all used in the analysis.

-Identifying risk groups and promoting preventive health policies can be facilitated by an understanding of these distinctions.

Introduction Cont.

-Smoking has been shown to affect appetite and metabolism.

-We can investigate possible lifestyle effects by comparing the BMI of smokers and non-smokers.

-Significant differences will be demonstrated through visual analysis and hypothesis testing.

-Every stage adheres to a precise statistical workflow to guarantee reliable results.

-Plots, tables, and interpretive remarks are used to clearly display the results..

Problem Statement

-Research Question: Is there a significant difference in the average BMI of smokers and non-smokers?

Approach:

-Use descriptive statistics and visualization to explore BMI distributions.

-Check assumptions (normality and variance homogeneity).

-Apply an appropriate hypothesis test.

-Interpret results and draw conclusions.

Data

-Dataset: lifestyle_health_dataset.csv

-Gathered from publicly available health and lifestyle data.

-Includes variables like BMI, alcohol consumption, exercise, smoking status, and other lifestyle indicators.

-Convenience sample (observational) sampling technique.

-BMI (numerical) and smoking (categorical) are the primary variables in this study.

# Read dataset and clean column names

df <- read_csv("health_lifestyle_dataset.csv", show_col_types = FALSE)
names(df) <- tolower(names(df))
names(df) <- gsub(" ", "_", names(df))

# Automatically detect BMI and Smoking columns

bmi_col <- grep("bmi", names(df), value = TRUE)[1]
smoke_col <- grep("smok", names(df), value = TRUE)[1]

# Rename automatically (works for different column names)

df <- df %>%
rename(
bmi = all_of(bmi_col),
smoking = all_of(smoke_col)
) %>%
filter(!is.na(bmi), !is.na(smoking))

# Preview dataset

head(df)

Data Cont.

-BMI is a continuous, numerical variable.

-Smoking is a categorical variable that has two levels: Yes for smokers and No for non-smokers.

-To preserve the accuracy of the data, missing values were eliminated.

-Consistency and trustworthy statistical analysis are guaranteed by data preprocessing.

Descriptive Statistics and Visualisation

-There is a noticeable difference in the distribution of BMI between smokers and non-smokers.

-Boxplots are useful for evaluating data spread and identifying outliers.

-Whether smokers typically have a higher or lower average BMI is indicated by the mean and median BMI.

-Additional statistical testing is supported by visual evidence.

plot(bmi ~ smoking, data = df,
main = "BMI Distribution by Smoking Status",
xlab = "Smoking Status",
ylab = "Body Mass Index (BMI)",
col = c("skyblue", "lightpink"))

ggplot(df, aes(x = bmi, fill = smoking)) +
  geom_density(alpha = 0.5) +
  labs(title = "BMI Density by Smoking Status",
       x = "Body Mass Index (BMI)",
       y = "Density") +
  theme_minimal()

Decsriptive Statistics Cont.

-The BMIs of smokers and non-smokers differ noticeably.

-Boxplots aid in the visualization of outliers and spread.

-Central tendency is shown by the mean and median values.

-Additional testing is supported by visual patterns.

iris %>% group_by(Species) %>% summarise(Min = min(Petal.Length,na.rm = TRUE),
                                           Q1 = quantile(Petal.Length,probs = .25,na.rm = TRUE),
                                           Median = median(Petal.Length, na.rm = TRUE),
                                           Q3 = quantile(Petal.Length,probs = .75,na.rm = TRUE),
                                           Max = max(Petal.Length,na.rm = TRUE),
                                           Mean = mean(Petal.Length, na.rm = TRUE),
                                           SD = sd(Petal.Length, na.rm = TRUE),
                                           n = n(),
                                           Missing = sum(is.na(Petal.Length))) -> table1
knitr::kable(table1) 
Species Min Q1 Median Q3 Max Mean SD n Missing
setosa 1.0 1.4 1.50 1.575 1.9 1.462 0.1736640 50 0
versicolor 3.0 4.0 4.35 4.600 5.1 4.260 0.4699110 50 0
virginica 4.5 5.1 5.55 5.875 6.9 5.552 0.5518947 50 0
summary_stats <- df %>%
group_by(smoking) %>%
summarise(
Min = min(bmi, na.rm = TRUE),
Q1 = quantile(bmi, 0.25, na.rm = TRUE),
Median = median(bmi, na.rm = TRUE),
Q3 = quantile(bmi, 0.75, na.rm = TRUE),
Max = max(bmi, na.rm = TRUE),
Mean = mean(bmi, na.rm = TRUE),
SD = sd(bmi, na.rm = TRUE),
n = n()
)

kable(summary_stats, caption = "Descriptive Statistics of BMI by Smoking Group")
Descriptive Statistics of BMI by Smoking Group
smoking Min Q1 Median Q3 Max Mean SD n
0 18 23.5 29.1 34.5 40 29.03564 6.350191 79906
1 18 23.4 29.0 34.5 40 28.98164 6.362472 20094

Hypothesis Testing

Testing Hypotheses

H₀: Smokers’ mean BMI is the same as non-smokers’.

H₁: Smokers and non-smokers have different mean BMIs.

α = 0.05 is the significance level.

Verify presumptions prior to testing.

model1 <- lm(Sepal.Length ~ Petal.Length, data = iris)
model1 %>% summary()
## 
## Call:
## lm(formula = Sepal.Length ~ Petal.Length, data = iris)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.24675 -0.29657 -0.01515  0.27676  1.00269 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   4.30660    0.07839   54.94   <2e-16 ***
## Petal.Length  0.40892    0.01889   21.65   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4071 on 148 degrees of freedom
## Multiple R-squared:   0.76,  Adjusted R-squared:  0.7583 
## F-statistic: 468.6 on 1 and 148 DF,  p-value: < 2.2e-16
# Normality test

group_data <- split(df$bmi, df$smoking)
if (all(sapply(group_data, length) >= 3 & sapply(group_data, length) <= 5000)) {
lapply(group_data, shapiro.test)
}

# Two-sample t-test (Welch's)

t_result <- t.test(bmi ~ smoking, data = df, var.equal = FALSE)
knitr::kable(broom::tidy(t_result), caption = "Two-Sample t-Test Results")
Two-Sample t-Test Results
estimate estimate1 estimate2 statistic p.value parameter conf.low conf.high method alternative
0.0539993 29.03564 28.98164 1.075855 0.2820004 30932.37 -0.0443791 0.1523777 Welch Two Sample t-test two.sided

Hypthesis Testing Cont.

\[H_0: \mu_1 = \mu_2 \]

\[H_A: \mu_1 \ne \mu_2\]

\[S = \sum^n_{i = 1}d^2_i\]

Discussion

-The findings indicate whether the BMIs of smokers differ statistically.

-The interpretation is supported by numerical and visual summaries.

-Strengths: valid statistical approach, clear workflow, and reproducible R code.

Observational data and possible confounders (age, diet, and activity) are limitations.

Regression analysis will be used in future work to add more predictors.

-Takeaway: The distribution of BMI can be impacted by smoking status.

References

-CDC, the Centers for Disease Control and Prevention (2023). Health effects of adult smoking habits. Department of Health and Human Services, United States. taken from https://www.cdc.gov/tobacco