Why everything so normal

Why normal distributions are normal A Gaussian Model of Height Quadratic Approximation and Prior Predictive Checks These are code snippets and notes for the fourth chapter, Geocentric Models, sections 1 to 3, of the book Statistical Rethinking (version 2) by Richard McElreath. Why normal distributions are normal The chapter discusses linear models and starts with a recap on the normal distributions. Why is it such a commonly used distribution and how does it arise? »

Ordered Categories

Ordered Categorical Outcomes library(rethinking) data(Trolley) d <- Trolley The data contains answers of 331 individuals for different stories, about how morally permissible the action in the story is. The answer is an integer from 1 to 7. The outcome is thus categorical and ordered. simplehist( d$response, xlim=c(1,7), xlab="response") Describing an ordered distribution with intercepts We want to redescribe this histogram on the log-cumulative-odds scale. We first compute the cumulative probabilities: »

Of Monsters and Mixtures

Over-dispersed outcomes For the beta-binomial model, we’ll make use of the beta distribution. The beta distribution is a probability distribution over probabilities (over the interval \([0, 1]\)). library(rethinking) pbar <- 0.5 theta <- 5 curve( dbeta2( x, pbar, theta), from=0, to=1, xlab="probability", ylab="Density") There are different ways to parametrize the beta distribution: dbeta2 <- function( x , prob , theta , log=FALSE ) { a <- prob * theta b <- (1-prob) * theta dbeta( x , shape1=a , shape2=b , log=log ) } We use the beta-binomial for the UCBadmit data, which is over-dispersed if we ignore department (since the admission rate varied quite a lot for different departments). »