Last active
July 8, 2025 14:58
-
-
Save njudd/4a2c53490eb4353cda29426e431be6ad to your computer and use it in GitHub Desktop.
Two Timepoint Reschange
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
| if (!require(pacman)) {install.packages("pacman")} | |
| pacman::p_load(data.table, psych) | |
| load(url("http://alecri.github.io/downloads/data/dental.RData")) # snagging random long data | |
| setDT(dental) | |
| dental | |
| dental$delta <- dental$y14 - dental$y8 | |
| describe(dental$delta) | |
| dental$res <- as.numeric(lm(y14 ~ y8, data = dental)$residuals) | |
| dental$deltaRES <- as.numeric(lm(delta ~ y8, data = dental)$residuals) | |
| cor(dental$res, dental$deltaRES) # R = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment