require(gammaFuncModel)
require(dplyr)
require(nlme)
df <- data.frame(
ID = rep(sprintf("%02d", 1:10), each = 9 * 3),
Time = rep(rep(1:9, each = 3), 10),
Diet = as.factor(rep(1:3, times = 9 * 10)),
Age = rep(sample(20:70, 10, replace = TRUE), each = 9 * 3),
BMI = round(rep(runif(10, 18.5, 35), each = 9 * 3), 1),
Concentration = round(runif(270, 5, 15), 2)
)
covariates <- c("ID", "Diet", "Age", "BMI")
model <- gammaFunction(
df,
covariates,
random_formula = ~ 1 | ID/Diet,
correlation_formula = corAR1(form = ~ Time | ID/Diet),
weights = NULL,
include_grp = TRUE)[[1]]
summary(model)
Run the code above in your browser using DataLab