From: Brian Junker Date: Fri, 4 Feb 2022 13:43:23 -0500 Subject: Re: late hw01's To: Siddhaarth Sarkar I haven't got solutions for hw02 for you yet, but here are some general notes: Problem #1: see my response on Piazza (https://piazza.com/class/kykc45ull1j7dh?cid=19) for a rather complete example of the sort of thing I am expecting (most students' answers will not be that complete, but as long as it is clear they know what they are doing, that's OK) Problem #2: The four models are y ~ 1 + x + x + u + (1 + x | County) y ~ 1 + x + x * u + (1 + x | County) y ~ 1 + x + x + nj + (1 + x | County) y ~ 1 + x + x * nj + (1 + x | County) Problem #3: literally this is just calculating -2*(logLik(M1) - logLik(M2)) and using pchisq() with 1 df in R to calculate a p-value and draw an inference. Problem #4: Part (a) is a ggplot with facets similar to one of the problems in hw01. For part (b) the model should be something like y_i = a_{0j[i]} + a_{1j[i]} t_i + b_2 u_{j[i]} + \epsilon_i a_{0j} = b_0 + \eta_{0j} a_{1j} = b_1 + \eta_{1j} where: * i is the observation index number (row in the data frame) * j[i] is the child j that observation i belongs to * t_i is the time of a visit for child i * y_i is sqrt(CD4PCT) * u_{j[i]} is the treatment status (0 or 1) for the child that observation i belongs to Note that the term b_2 u_{j[i]} could appear in the level 1 equation as it does above, or it could occur in the level 2 equation for a_{0j}. For part (c) the model with the cross-level interaction would be the same, but with this level 1 equation (adding in the cross-level interaction): y_i = a_{0j[i]} + a_{1j[i]} t_i + b_2 u_{j[i]} + b_3 t_i u_{j[i]} + \epsilon_i of course, the notation the students use may be slightly different... hope this helps, -BJ