Skip to content

Instantly share code, notes, and snippets.

@necronet
Created December 11, 2022 18:33
Show Gist options
  • Save necronet/1f2526dbd33f30c50c65bde448ddca4a to your computer and use it in GitHub Desktop.
Save necronet/1f2526dbd33f30c50c65bde448ddca4a to your computer and use it in GitHub Desktop.
Plotting the africa and non africa model on GDP and road ruggeness. Chapter on "Coditional Manaies"
## Assuming we already have the model describe on page 246 - 247
## Here is a possible way to get the graph describe on figure 8.5 from Statistical Rethinking Figure 8.4
plot(NULL, xlim=c(0,1), ylim=c(0.5, 1.5), xlab="rudgeness", ylab="gdp log std")
points(dd$rugged_std[dd$cont_africa==1], dd$log_gdp_std[dd$cont_africa==1], col="blue")
points(dd$rugged_std[!dd$cont_africa], dd$log_gdp_std[!dd$cont_africa], col="black")
lines(rudge_seq, mu.NotAfrica_mu)
shade(mu.NotAfrica_ci, rudge_seq)
lines(rudge_seq, mu.Africa_mu)
shade(mu.Africa_ci, rudge_seq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment