Week 2 HW and Presentation Questions


  1. McElreath’s HW: https://github.com/rmcelreath/statrethinking_winter2019/blob/master/homework/week02.pdf


  1. 4H1/ HW Q1
  2. 4H2
  3. 4H3 / HW Q2
  4. Fit linear regression’s to anscombe’s quartet to get good fits (type ‘anscombe’ into R). Can you choose good prior’s and models to get good fits?
    1. Show what happens when the quadratic term is added to the 2nd quartet on the posterior of the other terms.
    2. Use a T distribution on the error model for the 3rd quartet, one with a low df and another with high df.
    3. Invert y and x for Anscombe’s 4th and model. Can you make the prior strong enough to overcome the outlier?
    4. (Bonus) Without using quap, can you create a naive linear regression using something like rejection sampling?
  5. You’re on a cityrail train and you see that it’s numbered 4031. You know that the train numbering cannot exceed 10,000 due to it’s typefacing and you assume that each number is unique and in sequence.
    1. Explain why the likelihood P(X|N) ∝ 1/N (is proportional to) for 4031 <= N < 10000.
    2. Using a convenient prior, plot the posterior, remembering to normalize. Report median and mean. Report again
    3. Now you’ve seen a carriage numbered 2031. Make use of Bayesian Updating to get a new posterior (this can be done by multiplying the two posteriors element wise, taking care to normalise).
    4. What if the carriage number was 6031 instead? Report median and mean.
    5. Now with all 3 carriage observations, what’s your estimate of the number of carriages in Sydney
    6. (Bonus) Suggest a method that would work if you didn’t know what the upper bound on the number of trains would be. (Hint the right prior is needed)
  6. (Bonus) explain the maths behind the quap method in McElreath (you can go and read the code too)

And the sweepstakes are in. 5 questions, 4 new teams.

Q1. Ganymede
Q2. Conditional Experience
Q3. No Prior Experience
Q4. R^2
Q5. Casual Inferencing

Can team leaders please choose two members to present for next week.

Q4 and Q5, please post if you need clarifications - if it seems too hard, it’s likely because I haven’t worded it very well!