Do you have too many body fat?

Predict your body fat with basic body measurements

angelayuan
Developing Data Product @ Coursera

Introduction

Nowadays, more and more people get too many body fat. An possible way to prevent people from getting fat is to make them focus on their body measurements and give them direct feedback of further information (e.g. BMI, Percent body fat) which could be calculated or predicted based on their basic body measurements.

To this end, I developed a Shiny App to calculate people's BMI and to predict their Fat Free Weigh as well as Percentage body fat based on their body measurements (e.g., height, weight, circumference of several body parts).

Linear models are trained based on the fat dataset in the UsingR package.

Getting to know the fat data

To build a suitable linear model, we should get to know the data first. To this end, I did the following steps (hide the results because of the page limitation):

  • Load the data
library(UsingR); data(fat)
  • Exploratory Analysis, e.g. checking the first few lines
head(fat, 3)
  • Fit a model with body.fat as outcome and all other variables as predictors, and then identify useful predictors from the summary of model information
fit <- lm(body.fat ~ ., data=fat)
summary(fit)
  • Fit a new model with selected predictors and check the accuracy

Key step in the prediction of body fat

During exploratory data analysis, I found that the BMI and fat free weight are key predictors of body fat. However, these two predictors are not basic measurements which user could easily measure with a ruler. Therefore key steps are as follows

  • train a model to predict the fat free weight.
ffw_fit <- lm(ffweight ~ weight + BMI + chest + abdomen + thigh + forearm + wrist, data = fat)
  • train a model (including BMI and fat free weight etc.) to predict the body fat
bfat_fit <- lm(body.fat ~ weight + BMI + ffweight + chest + abdomen + thigh + forearm + wrist, data = fat)
  • for new data of body measurements, (1) calculating BMI, (2) predicting fat free weight, and (3) predicting body fat. The following code is an example of calculating BMI.
weight <- 110; height <- 80; (weight*0.4535)/(height*0.0254)^2
## [1] 12.08155

User Guide

My Shiny App is really easy to use. Just enter your body measurements (you need a ruler) and press the submit button. In order to get accurate prediction, you need to manually enter you weight and height and adjust other measurements according to your own data.

BMI, fat free weight, and the body fat will be presented. Morover, a histogram of the distribution of body fat will be also provided. You can compare your own body fat (indicated by a red line) with this population. Enjoy!

How should you use the App?

  1. directly click submit button
  2. first fill in my information and then click submit button
  3. just fill in my height and weight, click submit button, and then I can get an accurate results
  4. fill in my information and wait

Fill in your information and click submit button to initiate the prediction processes.

You should fill in your information (enter height and weight and adjust other options). The more accurate your information, the more accurate the prediction.