Understanding the factors that influence weight change is crucial for addressing various health outcomes, such as obesity, cardiovascular disease, and metabolic health. Age, as a biological factor, is often associated with physiological changes that might impact weight and body composition over time. This analysis seeks to investigate whether age significantly affects weight change, which could reveal important insights for age-specific health interventions and preventive measures.
The dataset contains various attributes related to participants, including: Age: Participant’s age in years. Weight Change (lbs): Change in weight during the study period.
#Read in the data
Weight_data <- read.csv("C:/Users/user/Downloads/weight_change_dataset.csv")
head(Weight_data)
## Participant.ID Age Gender Current.Weight..lbs. BMR..Calories.
## 1 1 56 M 228.4 3102.3
## 2 2 46 F 165.4 2275.5
## 3 3 32 F 142.8 2119.4
## 4 4 25 F 145.5 2181.3
## 5 5 38 M 155.5 2463.8
## 6 6 56 F 152.9 2100.6
## Daily.Calories.Consumed Daily.Caloric.Surplus.Deficit Weight.Change..lbs.
## 1 3916.0 813.7 0.2000
## 2 3823.0 1547.5 2.4000
## 3 2785.4 666.0 1.4000
## 4 2587.3 406.0 0.8000
## 5 3312.8 849.0 2.0000
## 6 2262.4 161.9 -12.5135
## Duration..weeks. Physical.Activity.Level Sleep.Quality Stress.Level
## 1 1 Sedentary Excellent 6
## 2 6 Very Active Excellent 6
## 3 7 Sedentary Good 3
## 4 8 Sedentary Fair 2
## 5 10 Lightly Active Good 1
## 6 9 Sedentary Poor 6
## Final.Weight..lbs.
## 1 228.6
## 2 167.8
## 3 144.2
## 4 146.3
## 5 157.5
## 6 140.4
#structure of the data set
str(Weight_data)
## 'data.frame': 100 obs. of 13 variables:
## $ Participant.ID : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Age : int 56 46 32 25 38 56 36 40 28 28 ...
## $ Gender : chr "M" "F" "F" "F" ...
## $ Current.Weight..lbs. : num 228 165 143 146 156 ...
## $ BMR..Calories. : num 3102 2276 2119 2181 2464 ...
## $ Daily.Calories.Consumed : num 3916 3823 2785 2587 3313 ...
## $ Daily.Caloric.Surplus.Deficit: num 814 1548 666 406 849 ...
## $ Weight.Change..lbs. : num 0.2 2.4 1.4 0.8 2 ...
## $ Duration..weeks. : int 1 6 7 8 10 9 2 11 10 2 ...
## $ Physical.Activity.Level : chr "Sedentary" "Very Active" "Sedentary" "Sedentary" ...
## $ Sleep.Quality : chr "Excellent" "Excellent" "Good" "Fair" ...
## $ Stress.Level : int 6 6 3 2 1 6 5 9 1 7 ...
## $ Final.Weight..lbs. : num 229 168 144 146 158 ...
summary(Weight_data)
## Participant.ID Age Gender Current.Weight..lbs.
## Min. : 1.00 Min. :18.00 Length:100 Min. :100.0
## 1st Qu.: 25.75 1st Qu.:26.75 Class :character 1st Qu.:153.7
## Median : 50.50 Median :38.00 Mode :character Median :172.2
## Mean : 50.50 Mean :37.91 Mean :171.5
## 3rd Qu.: 75.25 3rd Qu.:46.25 3rd Qu.:192.5
## Max. :100.00 Max. :59.00 Max. :238.2
## BMR..Calories. Daily.Calories.Consumed Daily.Caloric.Surplus.Deficit
## Min. :1566 Min. :2031 Min. : 82.5
## 1st Qu.:2255 1st Qu.:3233 1st Qu.: 767.0
## Median :2520 Median :3636 Median :1013.1
## Mean :2518 Mean :3518 Mean :1000.1
## 3rd Qu.:2806 3rd Qu.:4000 3rd Qu.:1253.3
## Max. :3391 Max. :4000 Max. :1922.5
## Weight.Change..lbs. Duration..weeks. Physical.Activity.Level
## Min. :-35.678 Min. : 1.00 Length:100
## 1st Qu.: -5.012 1st Qu.: 4.00 Class :character
## Median : 0.100 Median : 7.00 Mode :character
## Mean : -2.780 Mean : 6.92
## 3rd Qu.: 1.850 3rd Qu.:10.00
## Max. : 5.000 Max. :12.00
## Sleep.Quality Stress.Level Final.Weight..lbs.
## Length:100 Min. :1.00 Min. : 98.2
## Class :character 1st Qu.:2.75 1st Qu.:149.6
## Mode :character Median :5.00 Median :169.8
## Mean :4.81 Mean :168.8
## 3rd Qu.:7.00 3rd Qu.:188.3
## Max. :9.00 Max. :232.5
colSums(is.na(Weight_data))
## Participant.ID Age
## 0 0
## Gender Current.Weight..lbs.
## 0 0
## BMR..Calories. Daily.Calories.Consumed
## 0 0
## Daily.Caloric.Surplus.Deficit Weight.Change..lbs.
## 0 0
## Duration..weeks. Physical.Activity.Level
## 0 0
## Sleep.Quality Stress.Level
## 0 0
## Final.Weight..lbs.
## 0
In this section, we will conduct a univariate and bivariate analysis of the data set.
Univariate Analysis
# Histogram of Age
ggplot(Weight_data, aes(x = Age)) +
geom_histogram(bins = 10, fill = "blue", color = "black") +
labs(title = "Distribution of Age", x = "Age (years)", y = "Frequency")
This histogram visualizes the distribution of age within the dataset, highlighting a roughly uniform spread across age groups, with peaks around ages 20, 40, and 50-60. The chart suggests no significant skewness or outliers, implying a relatively balanced age distribution.
# Histogram of Weight Change
ggplot(Weight_data, aes(x = Weight.Change..lbs.)) +
geom_histogram(bins = 10, fill = "green", color = "black") +
labs(title = "Distribution of Weight Change", x = "Weight Change (lbs)", y = "Frequency")
This histogram illustrates the distribution of weight change in pounds. The majority of individuals experienced little to no weight change (around 0 lbs), with a notable positive skew indicating more frequent weight losses. Some individuals experienced significant weight loss (up to 30+ lbs), while very few experienced weight gains (above 0).
Bivariate Analysis
## Scatter Plot of Age vs. Weight Change
ggplot(Weight_data, aes(x = Age, y = Weight.Change..lbs.)) +
geom_point() +
geom_smooth(method = "lm", color = "red") +
labs(title = "Age vs. Weight Change", x = "Age", y = "Weight Change (lbs)")
## `geom_smooth()` using formula = 'y ~ x'
The scatter plot shows a weak positive correlation between age and weight change, with a slight increase in weight as age rises. The red regression line shows the trend,while the grey shows the confidence intervals.
linear regression model will be used to analyze the effect of age on weight change and interpret the results.
# Fit a Linear Regression Model
model <- lm(Weight.Change..lbs. ~ Age, data = Weight_data)
# Display the Summary of the Model
summary(model)
##
## Call:
## lm(formula = Weight.Change..lbs. ~ Age, data = Weight_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -32.978 -2.201 2.536 4.708 8.073
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.22826 2.44502 -1.729 0.0869 .
## Age 0.03821 0.06141 0.622 0.5353
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.467 on 98 degrees of freedom
## Multiple R-squared: 0.003934, Adjusted R-squared: -0.00623
## F-statistic: 0.387 on 1 and 98 DF, p-value: 0.5353
There is no significant effect of age on weight change from this analysis, as indicated by the high p-values for the coefficients and the low R-squared values..
it shows that age may not be a useful predictor of weight change from this analysis.
There is no statistically significant effect of age on weight change based on this analysis. Thus, we fail to reject the null hypothesis. Further investigation into other contributing factors and a broader range of variables could provide a more nuanced understanding of weight change dynamics. Implementing targeted health interventions focusing on modifiable lifestyle factors, rather than age alone, may yield better outcomes in addressing weight change and related health issues.