Last active
March 1, 2017 15:43
-
-
Save cimentadaj/f50c0758dc59623f3f94e7d5220f4b5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (b) Use the same model fit to generate simulations of CD4 percentages at | |
# each of the time periods for a new child who was 4 years old at baseline. | |
# For that we have to first create the dataset with the hypothetical child: | |
# I'll assume 7 hypothetical dates | |
hyp_child <- data.frame(newpid = 120, | |
VDATE = sample(cd4$VDATE[!is.na(cd4$VDATE)], 7), | |
baseage = 4, | |
treatmnt = 1) | |
# The exercise doesn't say anything about the treatment variable but I have | |
# to assign a value to it because it's present in the previous model. I'll assume | |
# this new child was in the treatment. | |
year_pred <- predict(mod2, newdata = hyp_child) | |
# That's it! Now we have the predicted CD4 percentage for different time points | |
# for a hypothetical child. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment