cd C:\StataData\LDA use nepal.dta, replace sort id age ** generate visit/time by id: gen time=_n ** generate gappy time. by id: gen timeGappy=_n if id <101 by id: replace timeGappy=_n+1 if id >100 ** change spacing within individuals by id: gen timeDisplace=_n if id <101 by id: replace timeDisplace=_n+1 if id >100 by id: replace timeDisplace=9 if timeDisplace ==6 by id: replace timeDisplace=7 if timeDisplace ==5 **Remove observations with weight above 80kg (Q2-4 I used this dataset) drop if (wt>80) **Or, code observations with weight above 80kg as missing replace wt=. if wt>80 ** prais requires tsset ** only run one of the tsset. ** then continue to praise and ** xtregar command below. tsset id time tsset id timeGappy tsset id timeDisplace ** serially correlated data...(slide 39 lecture 6) prais arm wt age sex matrix list e(b) display e(rho) matrix list e(V) ** random intercept plus serial correlation (slide 42 lecture 6) xtregar arm wt age sex