if (FALSE) {
#### univariate linear regression ####
data(gastricbypassW, package = "LMMstar")
## rescale to ease optimization
gastricbypassW$weight1 <- scale(gastricbypassW$weight1)
gastricbypassW$weight2 <- scale(gastricbypassW$weight2)
gastricbypassW$glucagonAUC1 <- scale(gastricbypassW$glucagonAUC1)
e.lm <- lmm(weight2~weight1+glucagonAUC1, data = gastricbypassW)
model.tables(e.lm)
## non-parametric bootstrap
resample(e.lm, type = "boot", effects = c("weight1","glucagonAUC1"), seed = 10)
## permutation test
resample(e.lm, type = "perm-var", effects = "weight1", seed = 10)
resample(e.lm, type = "perm-var", effects = "glucagonAUC1", seed = 10)
## using multiple cores
resample(e.lm, type = "boot", effects = c("weight1","glucagonAUC1"), cpus = 4)
#### random intercept model ####
data(gastricbypassL, package = "LMMstar")
gastricbypassL$weight <- scale(gastricbypassL$weight)
gastricbypassL$glucagonAUC <- scale(gastricbypassL$glucagonAUC)
gastricbypassL$gender <- as.numeric(gastricbypassL$id) %% 2
gastricbypassLR <- na.omit(gastricbypassL)
eCS.lmm <- lmm(weight~glucagonAUC+gender, data = gastricbypassLR,
repetition = ~visit|id, structure = "CS")
model.tables(eCS.lmm)
## non-parametric bootstrap
resample(eCS.lmm, type = "boot", effects = c("glucagonAUC","gender"), seed = 10, trace = FALSE)
## permutation test
resample(eCS.lmm, type = "perm-var", effects = "gender", seed = 10)
resample(eCS.lmm, type = "perm-res", effects = "glucagonAUC", seed = 10)
}
Run the code above in your browser using DataLab