Data Source

Dataset: “Gym Members Exercise Dataset” by Vala Khorasani. Source: https://www.kaggle.com/datasets/valakhorasani/gym-members-exercise-dataset

Research Question

Is there a difference in mean calories burned per hour between novice and experienced male exercisers in this dataset?

I chose this question because I’m interested in exercise and wanted to see how calorie expenditure compares across experience levels. Since workout lengths vary, I calculated calories burned per hour rather than comparing total calories burned per session. I used experience level 1 as the novice group and level 3 as the experienced group, excluding level 2 to focus on the lowest and highest experience categories.

This comparison looks at reported calorie expenditure relative to workout duration. It does not directly measure fitness, workout quality, or progress over time.

Data Preparation

library(tidyverse)
gym <- read.csv("exercise_tracking.csv")
set.seed(42)
nrow(gym)
## [1] 973
ncol(gym)
## [1] 15
sum(is.na(gym))
## [1] 0
sum(duplicated(gym))
## [1] 0
sum(gym$Session_Duration..hours. <= 0)
## [1] 0
gym <- gym |>
  select(Age, Gender, Session_Duration..hours., Calories_Burned, Fat_Percentage, Experience_Level, BMI)
head(gym)
##   Age Gender Session_Duration..hours. Calories_Burned Fat_Percentage
## 1  56   Male                     1.69            1313           12.6
## 2  46 Female                     1.30             883           33.9
## 3  32 Female                     1.11             677           33.4
## 4  25   Male                     0.59             532           28.8
## 5  38   Male                     0.64             556           29.2
## 6  56 Female                     1.59            1116           15.5
##   Experience_Level   BMI
## 1                3 30.20
## 2                2 32.00
## 3                2 24.71
## 4                1 18.41
## 5                1 14.39
## 6                3 20.55

Exploratory Analysis

mean(gym$Age)
## [1] 38.68345
sd(gym$Age)
## [1] 12.18093
summary(gym$Age)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   18.00   28.00   40.00   38.68   49.00   59.00
hist(gym$Age)

The mean age recorded in the dataset is 38.7 years, with ages ranging from 18 to 59.

barplot(prop.table(table(gym$Gender)))

There are slightly more records labeled Male than Female in the dataset.

mean(gym$Session_Duration..hours.)
## [1] 1.256423
sd(gym$Session_Duration..hours.)
## [1] 0.3430335
summary(gym$Session_Duration..hours.)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.500   1.040   1.260   1.256   1.460   2.000
hist(gym$Session_Duration..hours.)

The mean recorded workout duration is approximately 1 hour and 15 minutes, with durations ranging from 30 minutes to 2 hours.

mean(gym$Calories_Burned)
## [1] 905.4224
sd(gym$Calories_Burned)
## [1] 272.6415
summary(gym$Calories_Burned)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   303.0   720.0   893.0   905.4  1076.0  1783.0
hist(gym$Calories_Burned)

The mean calories burned per recorded workout is approximately 905, with values ranging from 303 to 1,783. This describes total calories per session; the main comparison below uses calories per hour.

mean(gym$Fat_Percentage)
## [1] 24.97677
sd(gym$Fat_Percentage)
## [1] 6.259419
summary(gym$Fat_Percentage)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   10.00   21.30   26.20   24.98   29.30   35.00
hist(gym$Fat_Percentage)

The mean body-fat percentage in the dataset is 24.98%, with values ranging from 10% to 35%. These values describe the full dataset rather than just the male records used in the main comparison.

gym |>
  group_by(Experience_Level) |>
  summarize(Count = n())
## # A tibble: 3 × 2
##   Experience_Level Count
##              <int> <int>
## 1                1   376
## 2                2   406
## 3                3   191

Experience level 2 has the most records. Experience level 3 has approximately half as many records as level 1.

mean(gym$BMI)
## [1] 24.91213
sd(gym$BMI)
## [1] 6.660879
summary(gym$BMI)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   12.32   20.11   24.16   24.91   28.56   49.84
hist(gym$BMI)

The mean recorded BMI is 24.91, with values ranging from 12.32 to 49.84.

Relationships Between Variables

ggplot(gym) +
  geom_point(aes(Fat_Percentage, BMI, color = as.character(Experience_Level)))

ggplot(gym) +
  geom_point(aes(Age, BMI, color = as.character(Experience_Level)))

The scatterplots do not show a strong relationship between age and BMI or between body-fat percentage and BMI. There is a clear pattern between body-fat percentage and experience level: level 3 records have values between 10% and 20%, while levels 1 and 2 have values of 20% or higher. This is a pattern in the dataset and does not establish that greater exercise experience causes lower body fat.

ggplot(gym) +
  geom_bar(aes(Experience_Level, fill = Gender))

The gender distribution is similar across the three experience levels, with slightly more records labeled Male in each group.

Group Comparison

gymMales <- gym |>
  filter(Gender == "Male") |> # Restrict the comparison to male records
  select(Calories_Burned, Session_Duration..hours., Experience_Level) |>
  arrange(desc(Experience_Level))
gymMales <- mutate(gymMales, CalPerHour = Calories_Burned/Session_Duration..hours.)
head(gymMales)
##   Calories_Burned Session_Duration..hours. Experience_Level CalPerHour
## 1            1313                     1.69                3   776.9231
## 2            1104                     1.64                3   673.1707
## 3            1237                     1.52                3   813.8158
## 4            1133                     1.67                3   678.4431
## 5            1299                     1.75                3   742.2857
## 6            1587                     1.99                3   797.4874
experiencedMales <- gymMales |>
  filter(Experience_Level == 3) |>
  select(CalPerHour)

noobieMales <- gymMales |>
  filter(Experience_Level == 1) |>
  select(CalPerHour)

experiencedMales <- pull(experiencedMales)
noobieMales <- pull(noobieMales)
gymMales |>
  filter(Experience_Level %in% c(1, 3)) |>
  group_by(Experience_Level) |>
  summarize(
    Count = n(),
    Mean_CalPerHour = mean(CalPerHour),
    SD_CalPerHour = sd(CalPerHour)
  )
## # A tibble: 2 × 4
##   Experience_Level Count Mean_CalPerHour SD_CalPerHour
##              <int> <int>           <dbl>         <dbl>
## 1                1   197            755.          84.7
## 2                3   101            759.          79.0
boxplot(
  noobieMales, experiencedMales,
  names = c("Novice", "Experienced"),
  main = "Calories Burned per Hour by Experience",
  ylab = "Calories burned per hour"
)

Study Design and Hypotheses

I compared calories burned per hour for 197 male records with experience level 1 and 101 male records with experience level 3. The novice group averaged 755.43 calories per hour, while the experienced group averaged 759.30. Throughout the analysis, I calculated the difference as experienced minus novice, giving an observed difference of 3.87 calories per hour.

This is an analysis of an existing dataset. I did not assign experience levels or conduct an experiment. Because I have not verified the original collection and sampling methods, I cannot assume the records represent all male gym-goers. The statistical results should be interpreted with that limitation in mind.

The null hypothesis is that the two groups have equal mean calories burned per hour. The alternative hypothesis is that their means differ.

\[H_0: \mu_{\text{Experience 1 CalPerHour}} = \mu_{\text{Experience 3 CalPerHour}}\]

\[H_1: \mu_{\text{Experience 1 CalPerHour}} \ne \mu_{\text{Experience 3 CalPerHour}}\]

Permutation Test

obsDiff <- mean(experiencedMales) - mean(noobieMales)

malesCalPerHour <- c(experiencedMales, noobieMales)
N <- 10000
diffMeans <- numeric(N)

for (i in 1:N){
  index <- sample(length(malesCalPerHour), size = length(experiencedMales), replace = F)
  diffMeans[i] <- mean(malesCalPerHour[index]) - mean(malesCalPerHour[-index])
}
sum(abs(diffMeans) >= abs(obsDiff)) / N
## [1] 0.7058

I performed 10,000 random shuffles while keeping the original group sizes. The permutation p-value was approximately 0.70, meaning about 70% of the shuffles produced an absolute difference in means at least as large as the observed difference of 3.87 calories per hour.

At a significance level of 0.05, I fail to reject the null hypothesis. This test does not provide strong evidence of a difference in mean calories burned per hour between the two groups. It does not establish that their means are equal.

Bootstrap Analysis

N <- 10000
bootDiff <- numeric(N)

for (i in 1:N) {
  bootExp <- sample(experiencedMales, size = length(experiencedMales), replace = TRUE)
  bootNoob <- sample(noobieMales, size = length(noobieMales), replace = TRUE)
  
  bootDiff[i] <- mean(bootExp) - mean(bootNoob)
}

hist(bootDiff, main = "Bootstrap Distribution of Mean Differences", xlab = "Experienced minus novice (calories per hour)"
)

qqnorm(bootDiff, main = "Normal Q-Q Plot of Bootstrap Differences")

qqline(bootDiff, lwd = 3, col = "red")

The bootstrap histogram is roughly symmetric, and the points in the normal Q-Q plot follow a reasonably straight line. This suggests that the bootstrap distribution of mean differences is approximately normal. These plots describe the shape of the resampling distribution; they do not establish whether the difference between groups is statistically significant.

Bootstrap Bias and Standard Error

(bias <- mean(bootDiff) - obsDiff)
## [1] -0.08839391
(se <- sd(bootDiff))
## [1] 9.925263

The estimated bootstrap bias is small compared with the bootstrap standard error, meaning the average bootstrap difference is close to the observed difference. The standard error estimates how much the difference in sample means varies across the bootstrap samples.

These results help describe uncertainty in the estimate. They do not verify that the original records are independent or representative of a broader population.

Bootstrap Percentile Confidence Interval

(bootCI <- quantile(bootDiff, c(0.025, 0.975)))
##      2.5%     97.5% 
## -15.62681  23.16514

I used the 2.5th and 97.5th percentiles of the bootstrap differences to construct a 95% bootstrap percentile confidence interval. The difference is measured as experienced minus novice, in calories burned per hour.

The interval includes zero and extends into both negative and positive values. Under the assumptions of the method, it is compatible with either group having the higher mean. The interval therefore does not provide clear evidence of a difference between the groups.

Welch Two-Sample Test

t.test(experiencedMales, noobieMales, alternative = "two.sided", conf.level = 0.95)
## 
##  Welch Two Sample t-test
## 
## data:  experiencedMales and noobieMales
## t = 0.39054, df = 214.43, p-value = 0.6965
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -15.66331  23.40373
## sample estimates:
## mean of x mean of y 
##  759.2973  755.4271

The Welch two-sample t-test produced a p-value of approximately 0.697 and a 95% confidence interval from -15.66 to 23.40 calories per hour for the experienced-minus-novice mean difference.

Because the p-value is greater than 0.05 and the interval includes zero, I fail to reject the null hypothesis. Although the experienced group’s sample mean was 3.87 calories per hour higher, the analysis does not provide strong evidence of a difference. The confidence interval remains compatible with differences in either direction.

Conclusions

The bootstrap percentile interval and the Welch confidence interval give similar results, and both include zero. Both methods therefore lead to the same overall interpretation: this analysis does not provide strong evidence of a difference in mean calories burned per hour between the novice and experienced groups. Agreement between the methods does not establish that the groups are equivalent or remove limitations in the underlying data.

Limitations

This analysis focuses on male records in experience levels 1 and 3, so its findings do not describe female records or the intermediate experience group. It also does not adjust for workout type, body weight, age, or other factors that could affect calorie expenditure.

The tests treat the records as independent, and the permutation test assumes group labels are exchangeable under its null hypothesis. I have not verified the dataset’s original collection process or sampling method, which limits how confidently these results can be applied beyond the dataset. I would treat this project as an application of statistical comparison and resampling methods rather than a general conclusion about exercise experience.