Question

3 Lakers This question uses data on basketball games involving the LA Lakers in the 2008-2009 season. Once you've loaded in the tidyverse package, you should be able to access the

data using data("lakers"). The outcome of interest is whether or not a particular shot i made the basket: 0 if shot i missed. We are interested in studying the association between the shot being made and where the shot was taken on the court. The variables of interest for these questions are • result, which you can use to create z; above; is the horizontal coordinate of where the shot was taken; • y, which is the vertical coordinate of where the shot was taken. If you do a search ?lakers, this will tell you a bit more about the dataset. If you go to the original source (www.basketballgeek.com/data/), this tells you a bit more about how to interpret the (x,y) coordinates. Note that only shots have (x,y) coordinates, so for this question you can filter out all other events (rebounds, free throws, etc). a) Do an exploratory data analysis illustrating the relationship between making a shot, and the location on the court where the play was made. Think about different ways of effectively illustrating the relationships given the binary outcome. As usual, a good EDA includes well- thought-out descriptions and analysis of any graphs and tables provided, well-labelled axes, titles etc. Assume z; ~ Bern(p;), where p; refers to the probability of making a shot Consider two candidate models. . Model 1: • Model 2: logit (pi) = Bo + B₁ (Ti — Io) + B₂ · (Yi - Yo) + ß3· (Ti — xo) (Yi - Yo) logit (p;) = 30 +3₁ (|T₁ – 1o|) + B₂ · (Yi - Yo) + B3 · (|Ti — xo) (Yi - Yo) where z; is the x-coordinate and y, is the y-coordinate of the shot. The values zo and yo refer to the coordinates of the basket./nwhere z; is the x-coordinate and y; is the y-coordinate of the shot. The values zo and yo refer to the coordinates of the basket. b) Fit both of these models using Stan. Put N(0, 1) priors on all the 3s. You should generate pointwise log likelihood estimates (to be used in later questions), and also samples from the posterior predictive distribution (unless you'd prefer to do it in R later on). For both models, interpret each coefficient. 4 c) Let t(z) = 1 1 (zi= 1, yi > 10)/₁1 (>10) i.e. the proportion of shots made at a y-distance greater than 10. Calculate t(zrep) for each replicated dataset for each model, plot the resulting histogram for each model and compare to the observed value of t(z). Calculate P (t (zep)

Question image 1Question image 2