Skip to content

Instantly share code, notes, and snippets.

@rmcelreath
Created June 29, 2021 11:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rmcelreath/6eb3c96ac52d53ae8f972e8fbf88e30d to your computer and use it in GitHub Desktop.
Code example for RFDT
# version that marginalizes out the missing data
flbi_plus <- ulam(
alist(
c(M,D) ~ multi_normal( c(mu,nu) , Rho , Sigma ),
mu <- a1 + b*B1,
nu <- a2 + b*B2 + m*M,
c(a1,a2,b,m) ~ normal( 0 , 0.5 ),
Rho ~ lkj_corr( 2 ),
Sigma ~ exponential( 1 )
), data=dat , chains=4 , cores=4 , cmdstan=TRUE )
precis(flbi_plus,3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment