# NOT RUN {
#EXAMPLE 1: INDIVIDUAL MODELLING
#--------------------------------------------------------
#For one female in a diet of 100 kcal reduction.
adult_weight(80, 1.8, 40, "female", rep(-100, 365))
#Same female also reducing sodium in -25mg
adult_weight(80, 1.8, 40, "female", rep(-100, 365), rep(-25, 365))
#Same female modelled for 400 days
adult_weight(80, 1.8, 40, "female", rep(-100, 400), rep(-25, 400), days = 400)
#Same female reducing -50 kcals per 100 days and not reducing sodium
kcalvec <-c(rep(-50, 100), rep(-100, 100), rep(-150, 100), rep(-200, 100))
adult_weight(80, 1.8, 40, "female", kcalvec, days = 400)
#Same female with known energy intake
adult_weight(80, 1.8, 40, "female", rep(-100, 365), rep(-25, 365), EI = 2000)
#Same female with known fat mass
adult_weight(80, 1.8, 40, "female", rep(-100, 365), rep(-25, 365), fat = 32)
#Same female with known fat mass and known energy consumption
adult_weight(80, 1.8, 40, "female", rep(-100, 365), rep(-25, 365), EI = 2000, fat = 32)
#EXAMPLE 2: DATASET MODELLING
#--------------------------------------------------------
#Antropometric data
weights <- c(45, 67, 58, 92, 81)
heights <- c(1.30, 1.73, 1.77, 1.92, 1.73)
ages <- c(45, 23, 66, 44, 23)
sexes <- c("male", "female", "female", "male", "male")
#Matrix of energy consumption reduction:
EIchange <- rbind(rep(-100, 365), rep(-200, 365), rep(-200, 365),
rep(-123, 365), rep(-50, 365))
#Returns a weight change matrix and other matrices
model_weight <- adult_weight(weights, heights, ages, sexes,
EIchange)["Body_Weight"][[1]]
# }
Run the code above in your browser using DataLab