# Weight loss notes. Planning and keeping track.

I wanted to get an idea of how long it will take to reach my body fat percentage goal of 8% (I’m a male; females shouldn’t go this low.) So I wrote a small script.

We’ll need the following constant, an approximation of how many calories there is in a kilogram of body fat (i.e., adipose tissue).

kcal_per_kg <-  7700

Then you provide approximations for your average calorie expenditure and intake. It’s probably a good idea to use a fitness tracking device for this, just be aware the calorie measurements aren’t that precise. I use an approximation of calories out equal to 3400. That is quite a lot, but it’s what Fitbit tells me I use on a weekday, so that’s what I’ll be going for. I’m assuming 3400 / 2 = 1700 calories in on average, as I’m doing alternate day fasting.

This is my input data on August 27 2022.

input_aug27 <- list(
kcal_in = 1700, # The expected daily calorie intake, averaged across days.
kcal_out = 3400, # I used Fitbit for this.
weight = 71.1, # Current weight in kg.
fat = 8.6, #11.1, # Fat mass in kg. Calculated using a Withings scale.
height = 180, # In centimeters. Can be used for BMI calculation.
pct_goal = 0.08 # Goal in terms of pct body fat. This goal is semi-random.
)

I can use this input data do derive several interesting quantities.

#' Calculate derived quantities from a weight_loss object.
#'
#' @param input An object of class weight_loss.
#' @return A list of derived quantities.

derived = function(input) {
fat_pct = input$fat / input$weight
rest_kg = input$weight - input$fat
weight_goal = rest_kg / (1 - input$pct_goal) weight_diff = input$weight - weight_goal
deficit = input$kcal_out - input$kcal_in
days_needed = ceiling(weight_diff * kcal_per_kg / deficit)
loss_per_day = deficit / kcal_per_kg
list(
fat_pct = fat_pct,
weight_goal = weight_goal,
fat_goal = weight_goal - rest_kg,
kg_left = weight_diff,
days_needed = days_needed,
loss_per_day = loss_per_day)
}

In my case I obtain:

knitr::kable(tibble::as_tibble(derived(input_aug27)), digits = 2)
fat_pct weight_goal fat_goal kg_left days_needed loss_per_day
0.12 67.93 5.43 3.17 15 0.22

So I have $15$ days of alternate day fasting left until I reach my goal, which happens to be $5.43$ kilograms of body fat. Moreover, I expect to lose $0.22$ kilograms of body fat each day.

## Sensitivity of the analysis

I used the data from August 27, but today is August 28. I used August 27 since I weighed 2 kilograms less on Auguest 28 than on August 27 and had 0.1 kg more fat mass. I believe this measurement to be an outlier, but let’s see what effects it has on the derived quantities:

input_aug28 <- input_aug27
input_aug28$weight <- 69.1 input_aug28$fat <- 8.7
knitr::kable(tibble::as_tibble(derived(input_aug28)), digits = 2)
fat_pct weight_goal fat_goal kg_left days_needed loss_per_day
0.13 65.65 5.25 3.45 16 0.22

The practical difference turns out to minuscule. Using this outlier I’m told I’m 16 days from reaching my goals, and increase of just one day. Of course, the goal weight is far lower (65.65 vs 67.93, a difference of more than two kgs), but since the practical implications are similar it doesn’t bother me much.