# Data Science for a Better Body

Data Science for a Better BodyRitvik KharkarBlockedUnblockFollowFollowingJun 25Photo by Victor Freitas on Unsplash20 months ago, I started tracking statistics related to my health.

The whole story on that, including ups and downs, here.

Since I’m a huge fan of using data science and statistics to hack your personal development, I’m really excited to share three statistics tips I’ve picked up towards building a better body.

1.

Don’t Use a Single Metric for SuccessEarly on in my health tracking journey I was using net calories (calories eaten minus calories burned) as my sole metric for success.

And, as conventional wisdom tells us, I used the arbitrary threshold of 2000 net calories as my gauge for success or failure on any given day.

It worked for a few months and I held myself accountable when I noticed my net calories creeping above 2000 regularly.

Soon enough though, the key flaw revealed itself:Net calories alone doesn’t do enough to promote sufficient exercise.

Let me explain.

In my first few months of calorie counting, I got good at reducing my caloric intake to just under 2000.

So, I was regularly ending days with around 1900 calories eaten and 0 calories burned, thinking I had “succeeded”.

I realized I needed a new metric to reward me for working out and eventually came up with the caloric out-in-ratio, simply defined as calories burned divided by calories eaten.

To understand the importance of this ratio, consider two potential days:Day 1: Eat 2000 calories and burn 0 calories where net calories are 2000 and the out-in-ratio is 0/2000 = 0.

0Day 2: Eat 2500 calories and burn 500 calories where net calories are again 2000 but the out-in-ratio is 500/2500 = 0.

2In both cases, net calories are 2000 but I would much rather be in the second day since I’ve burned 500 calories and reap added benefits due to that workout.

The out-in-ratio is perfect for capturing this goal.

I set my daily goal to achieve an out-in-ratio of 0.

2 or higher.

For you visual learners, on a graph of “Calories In” vs.

“Calories Out”, I want to be in the “sweet spot” below.

You can come up with whatever awesome health tracking metrics you want, but the general advice would be to pick two or three metrics to define your success rather than just one.

This serves two complementary purposes.

First, you make sure to capture the lifestyle changes you actually care about.

And second, you don’t tie up your feelings of self-worth in just a single number.

2.

Use a Rolling Average Instead of Raw StatsLet me know if this sounds familiar.

Then the weekend comes around …Friday night dinner with friendsA spontaneous ice cream run on Saturday afternoonA lazy Sunday where you just don’t wanna gymCue the following Monday where you feel like you erased all your progress from the week so “what’s the point of all this?!”Random spikes in net caloriesIt’s easy to get discouraged, trust me I felt it a lot at the start of my health tracking.

It took a shift in mentality, followed by a change in how I reported my health statistics, to help me see the real picture.

The key realization was that individual days can be incredibly unpredictable.

~ You plan to hit the gym the next morning and realize that you just can’t.

fall.

asleep.

~ You might plan to eat a chicken breast + veggies for dinner but realize that an outing with some old friends is too good to pass up.

~ You might find yourself losing an unexpected stare-down with a doughnut.

The point is, sometimes sh*t happens that you didn’t plan for.

That’s basically the motto of human existence.

Once I stopped asking myself “Did I meet my goals today?” and started asking myself “Is my health, on average, improving?” I started to focus on long-term steady growth rather than random short term ups and downs.

So how does that translate into tracking your stats?.Well, let’s say you make a chart of net calories over time with a daily frequency.

Because of the daily randomness we discussed, the chart is bound to have a lot of volatility.

Net calories in the last 20 monthsBut if we instead take the average (arithmetic mean) of net calories from the last 7 days for example, we are able to “wash out” daily events and capture more of the underlying trend.

Your healthy Monday and your food-filled Saturday are no longer independent, but now interact with each other through the averaging operation.

Overlaying a 7-day rolling average on the raw data looks like:7-Day rolling average of net caloriesYou can use this technique on any other health tracking metrics you’ve decided to use.

3.

Slice Your Data to Identify Areas for ImprovementSo you’ve been tracking your health for a few months.

How do you use your carefully logged stats to hack your way to better health?Looking at the data overall definitely gives you an idea of where you’re headed on average, but doesn’t really give you any ideas about how to improve.

One of the best insights for me arrived when I sliced my data by day of week.

I knew that weekends were probably (much) unhealthier than weekdays but exactly how much worse were they?What would be a good target for net calories each weekend?Of all weekdays, were there any where I was systematically slacking?Slicing my net calories by day of week resulted in the following graph.

Net calories sliced by day of weekAs expected, weekends are pretty high but I had no idea that I get dangerously close to my 2000 net calorie target on Wednesdays.

Good to know!Or maybe there is a trend around day of the month.

I know that at the beginning of a month I feel a surge of confidence and motivation which pretty much always fades as the month progresses.

What if we slice on that axis?Average net calories sliced by day of monthIt seems like I should be most aware of my caloric intake getting too high around the middle of each month.

You can get as creative as you want here.

The key is just to slice your data on some variable(s) that make contextual sense to your life, and strive to improve your metrics on the slices that aren’t doing too hot.

That’s all I’ve got for you!.I hope this helps a in giving even a bit more shape and direction to your health tracking journey.

Best of luck and thanks for reading ~.