# Calculation of standard body weights, obesity degree (%), and BMI # based on the method of Japanese School Health Statistics # http://www.mext.go.jp/component/b_menu/other/__icsFiles/afieldfile/2013/03/29/1331750_3.pdf # (C) Minato Nakazawa, Ph.D. 13 August 2014 SWTBL <- data.frame( Age = c(5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), Ba = c(0.386, 0.461, 0.513, 0.592, 0.687, 0.752, 0.782, 0.783, 0.815, 0.832, 0.766, 0.656, 0.672), Bb = c(23.699, 32.382, 38.878, 48.804, 61.39, 70.461, 75.106, 75.642, 81.348, 83.695, 70.989, 51.822, 53.642), Ga = c(0.377, 0.458, 0.508, 0.561, 0.652, 0.73, 0.803, 0.796, 0.655, 0.594, 0.56, 0.578, 0.598), Gb = c(22.75, 32.079, 38.367, 45.006, 56.992, 68.091, 78.846, 76.934, 54.234, 43.264, 37.002, 39.057, 42.339)) stwt <- function(age, sex, height) { ifelse(sex==1, SWTBL\$Ba[SWTBL\$Age==age]*height-SWTBL\$Bb[SWTBL\$Age==age], SWTBL\$Ga[SWTBL\$Age==age]*height-SWTBL\$Gb[SWTBL\$Age==age]) } stwtv <- Vectorize(stwt) # Definition of a sample data sampledata <- data.frame( Age = c(7, 11, 17, 11, 14, 17), Sex = c(1, 1, 1, 2, 2, 2), # 1: Boy, 2: Girl Height = c(115, 155, 185, 150, 150, 150), Weight = c(20, 46, 71, 50, 50, 50)) # Calculation sampledata\$StandardWt <- stwtv(sampledata\$Age, sampledata\$Sex, sampledata\$Height) sampledata\$Obese <- (sampledata\$Weight - sampledata\$StandardWt)/sampledata\$StandardWt*100 sampledata\$BMI <- sampledata\$Weight/(sampledata\$Height/100)^2 print(sampledata)