Last active
June 18, 2021 18:39
-
-
Save rmcelreath/3c358c51facce46cf8645df378a01cdb to your computer and use it in GitHub Desktop.
Code examples for RFDT
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
| set.seed(1908) | |
| N <- 200 # number of pairs | |
| U <- rnorm(N) # simulate confounds | |
| # birth order and family sizes | |
| B1 <- rbinom(N,size=1,prob=0.5) # 50% first borns | |
| M <- rnorm( N , 2*B1 + U ) | |
| B2 <- rbinom(N,size=1,prob=0.5) | |
| D <- rnorm( N , 2*B2 + U + 0*M ) # change the 0 to turn on causal influence of mom |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment