These are code snippets and notes for the fourth chapter, Geocentric Models, , sections 5, of the book “Statistical Rethinking” (version 2) by Richard McElreath. Polynomial Regression Standard linear models using a straight line to fit data are nice for their simplicity but a straight line is also very restrictive. Most data does not come in a straight line. We can use polynomial regression to extend the linear model. »

These are my solutions to the practice questions of chapter 4, Linear Models, of the book “Statistical Rethinking” (version 2) by Richard McElreath. Easy. 4E1. In the model definition below, which line is the likelihood: \begin{align*} y_i &\sim \text{Normal}(\mu, \sigma) & & \text{This is the likelihood}\\ \mu &\sim \text{Normal}(0, 10) \\ \sigma &\sim \text{Exponential}(1) \end{align*} 4E2. In the model definition just above, how many parameters are in the posterior distribution? »

These are code snippets and notes for the fourth chapter, Geocentric Models, , sections 4, of the book “Statistical Rethinking” (version 2) by Richard McElreath. In this section, we work with our first prediction model where we use the weight to predict the height of a person. We again use the !Kung data and restrict to adults above 18. library(rethinking) data("Howell1") d <- Howell1 d2 <- d[ d\$age >= 18, ] plot(height ~ weight, data=d2) It looks like there is a nice, clear linear relationship between the weight and height of a person. »

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? Normal by addition Normalcy arises when we sum up random variables: pos <- replicate( 1000, sum( runif(16, -1, 1))) dens(pos, norm. »

These are my solutions to the practice questions of chapter 2, Small Words and Large Worlds, of the book “Statistical Rethinking” (version 2) by Richard McElreath. Easy. 2E1. Which of the expressions below correspond to the statement: the probability of rain on Monday? Pr(rain) Pr(rain | Monday) Pr(Monday | rain) Pr(rain, Monday) / Pr(Monday) Statement (4) is equivalent to (2) by Bayes theorem using joint probability. 2E2. Which of the following statements corresponds to the expression: Pr(Monday | rain )? »