## Not run:
# data(NHANES)
# # Example of analyzing NHANES data
# # Example 1: Not adjusted for sampling weights
# nhanesToFit <- NHANES[ which(NHANES$mvpaMinutes!=0), ]
# formula <- aee(ID, Day, mvpaMinutes) ~ Age+raceBi+VO2max+Gender
# fitted1 <- aeefit(formula=formula, data=nhanesToFit)
# summary(fitted1)
#
# # Example 2: Adjusted for sampling weights
# data(weight)
# nhanesToFit <- NHANES[ which(NHANES$mvpaMinutes!=0), ]
# nhanesUnique <- nhanesToFit[!duplicated(nhanesToFit$ID),]
# weightUnique <- merge(nhanesUnique, weight, by="ID")
# selProb=(1/weightUnique$weight)
# formula <- aee(ID, Day, mvpaMinutes) ~ Age+raceBi+VO2max+Gender
# fitted2 <- aeefit(formula=formula, data=nhanesToFit, weight = selProb)
# summary(fitted2)
# ## End(Not run)
Run the code above in your browser using DataLab