3

I've tried to keep this question as non-programmer-friendly as possible, but please let me know if you don't understand something.


I'm a software developer and I'm looking over some old code and I have come across a formula for working out calories burned.

METs = (1.5245 * milesPerHour) + 0.1128;
caloriesBurned = (durationMinutes * ((METs * 3.5 * kilograms) / 200.0f));

I can't figure out for definite what the unnamed arbitrary numbers are supposed to represent.

I did some research and found that the "normal" formula for working out calories burned is:

Energy (kcal) = METs * weight (kg) * time (hours)

I speculate that the numbers in the first equation have come about because someone just plugged some values into Excel and used the formula displayed on the trendline as an estimate.

The numbers in the second equation elude me completely. I thought it might be converting kJ to kcal, but the equation already outputs calories.

Then I noticed that the duration in the code is in minutes, but the formula I expect wants hours. However, (3.5/200) makes no sense converting from minutes to hours. (Coincidentally, it is a close approximation 0.016 ≈ 0.0175)


I think I've found the resource the original developer must have used:

Work Unit Conversions

1 MET = 3.5 ml/kg/min
1 MET = 1 kcal/kg/hr
...
METS to Kcal/min = multiply METS x 3.5 x body weight in kg then divide by 200

I still have no idea where that 200 comes from and I think the resource might be erroneous anyway as it seems to equate calories to mlO2


NB: I'm not looking for a new / "correct" formula, unfortunately I can't change this. However I'd like to be able to add comments to the code so that I can understand if / why it's wrong if I look at it again in the future.


TL;DR:

What do the arbitrary numbers mean in the above formulas?

17
  • What's metabolicRate in the second line? Where do you get it from? A MET is a unit for intensity, where one MET is defined as 3.5ml of oxygen per kg and per minute, so the 3.5 is just a number to get a good range of MET numbers, 1 MET is what you use for sitting.
    – Mårten
    Commented Jul 21, 2015 at 13:18
  • "metabolicRate" was just programming reference I had missed. It should read METs (and does now). I understand what the MET is and how it is normally used. I'm trying to get my head around what the previous programmer has done here and what the arbitrary numbers mean. Commented Jul 21, 2015 at 13:20
  • Okay so 3.5 * nrMets * nrMinutes * nrKgs should be the number of ml of oxygen that you consume for a certain weight in a certain number of minutes, assuming there is a linear factor between calories consumed and milliliters of oxygen consumer, this code seems to assume that this factor is 200. Not sure if 200 is a good number, but it seems reasonable to me that the number isn't an exact one by nature, because biology. It is probably chosen to be easy to calculate with.
    – Mårten
    Commented Jul 21, 2015 at 13:24
  • assume is the word I'm worried about. It seems to have just been pulled out of nowhere. There is a equivalence of calories to ml of oxygen, but that factor is 3.5 * 60 = 210 (possibly just an error in the resource?). This can be seen by the equivalence of 1 MET = 3.5ml/kg/min ≣ 1 kcal/kg/hr ≣ 60 kcal/kg/min Commented Jul 21, 2015 at 13:30
  • 1
    It's for a run tracking application, so walking, jogging, running, skipping, etc. Any leg based propulsion outside. I also expect that walking should be a different equation to running as it requires less movement, not just slower movement. Commented Jul 21, 2015 at 14:50

1 Answer 1

1

If you grab yourself a copy of the Compendium of Physical Activities Unit-Conversions table, it may help.

Taking the second line first:

caloriesBurned = (durationMinutes * ((METs * 3.5 * kilograms) / 200.0f));

This appears to be a simple algebraic manipulation of the standard formula used to convert Oxygen consumption (Volume of O2 in litres [VO2]) into Kcals. Essentially your body requires Oxygen to convert the energy stored in its Sugars and Fats into ATP, to fuel your muscles, this process is called the Citric acid cycle.

The METs in that line is short for Metabolic Equivalent of Task, and is just an abstract way to quantify the relative energy cost of an activity, a number of sites offer MET estimates for specific activities eg.

Anyway:

MET       = 3.5 * VO2ml/massKg/min^-1

Kcal/Min ~= RespiratoryExchangeRatio * VO2litre / 1000
         ~= 5 * massKg * VO2litre / 1000 (sugar)   
         ~= massKg * VO2litre / 200 (sugar)        

Note: RespiratoryExchangeRatio is 5.0 for sugars, but drops to 4.86 for freeing energy from fat.

So for the first few mins of relative intensive exercise (ignore the first few secs, as anaerobic, and any fat burning after a few mins, or any sprints that will exceed your bodies ability to process ATP and result in a lactic acid build up) that bit of code appears correct:

 caloriesBurned = (durationMinutes * ((METs * 3.5 * kilograms) / 200.0f));

The worrying line is:

METs = (1.5245 * milesPerHour) + 0.1128;

As you've indicated the equation is being used as a general equation to estimate METS, for walking, jogging, running, skipping etc. But energy expenditure isn't linear, and there are other factors, such as gradient, wind resistance, surface, external weights..... that come into play in producing a MET score, even for a typical brisk walk, on the level it is incorrectly estimatied. As walking at 4 mph is typically assigned a value of 5 METS, while your equation would estimate that activity at 6.2 METS, overestimating calorie burn by 24%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.