I realized anacdotally that days after high sodium intake my weight was up 1-2lbs. I wanted to verify this fact so thought to hypothesis test this with the data I had collected from Life-OS. I already had all the data to prove or disprove the hypothesis, so I collected it from Life-OS and did some analysis.
I need two variables for each observation - the independent variable and the dependent variable. For this test, the independent variable will be the sodium intake per day, and the dependent variable will be the body weight the following morning. By defining these two variables, I am looking to test whether sodium predicts body weight.
Independent = Sodium intake (for the day)
Dependent = Weight (logged in the morning)
Weight is affected by overall trend during weight loss or gain. My weight was not constant over the period of time I have data for, so instead of using raw weight, I will use change in weight.
In the data set, logged weight goes from 174 to 156 over the time period, so change in weight is what I need to look at rather than the actual weight amount. In this step, I cleaned the data by removing leading days with sparse weight logging since in the data, weight is only consistently logged starting May 22nd.
For each row, I calculated the next morning's change in weight by subtracting the next day's weight by today's weight.
Weight Change(t)=Weight(t)−Weight(t−1)
This refined my hypothesis to the following:
"On days where I consume more sodium, does my weight increase more the following morning?"
I created a scatter plot with the X-axis as sodium and the Y-axis as net-day weight change (in lbs). See Figure 1 for the scatter plot.
I added a linear regression line (red). The line dips slightly upward, and the slope is 0.000294. This means for every additional 1,000 mg of sodium I consumed on day t, I should expect to see an increase of 0.294 lb the next day.
The next step is to calculate the correlation. For a simple linear regression, the coefficient of determination (R^2) is equal to the square of the correlation coefficient (r^2). As shown in Figure 1:
R^2 = 0.067
The chart shows a positive linear regression
A sample of the raw data used in this hypothesis test
Null hypothesis
H0: p <= 0
There is no positive or negative relationship, between sodium and next-day weight change.
Alternative hypothesis
H1: p > 0
Higher sodium intake is associated with increased next-day weight.
Significance Level
I have chosen to use
α = 0.05
Test Statistic (t)
Next, I need a p-value, so I have to calculate the sample size n. The sample size of clean data (where each row has sodium, logged weight, and next-day weight) is 73. That gives us:
r = 0.259
n = 73
df = n - 2 = 71
Plugging these into the t-statistic formula for correlation, it gives approximately
t = 2.257
P-Value
At 71 degrees of freedom and t = 2.257, the one-tailed p-value is approximately 0.013.
Comparing the p-value to the significance level, we find: 0.013 < 0.05. Therefore, we reject the null hypothesis.
There is statistically significant evidence to conclude that higher sodium intake is associated with an increased next-day weight, even though the overall effect size is small.
This finding is interesting to me, but the sample size is too small. I had weight data dating far back, but it was inconsistently logged (not every day at the same time). While n >= 30 is often treated as a bare minimum for a t-distribution to behave reliably, I would like to have at least n= 100-200+ as a more realistic target given how small the current effect size is. A larger sample size of clean days would tighten the confidence interval around the estimated effect and give more confidence in the relationship.