***Data from Exercise 6.2 Postnatal-depression data *These data are from a 1996 study (Gregoire, Kumar Everitt, Henderson & Studd) on the efficacy of estrogen patches in treating postnatal depression. *Women were randomly assigned to either a placebo control group (group=0, n=27) or estrogen patch group (group=1, n=34). *Prior to the first treatment all patients took the Edinburgh Postnatal Depression Scale (EPDS). *EPDS data was collected monthly for six months once the treatment began. Higher scores on the EDPS are indicative of higher levels of depression. * Read data set use http://www.stata-press.com/data/mlmus3/postnatal, clear * Describe data, min/max: -9=missing tabstat pre dep*, statistics(min max) by(group) * Ex 6.2: 1. reshape long dep, i(subj) j(month) mvdecode dep pre, mv(-9) * Missing: xtset subj month xtdescribe if dep<. * Month 1 = time 0 generate time = month - 1 *** Plot data: * mean by group and month: egen depmean = mean(dep), by(group month) * separate dep-variables for each group: separate dep, by(group) sort subj mont twoway (scatter dep0 month, jitter(2) msym(o) mcolor(red))(scatter dep1 month, jitter(2) msym(o) mcolor(blue))(line dep0 month if subj<11, lcolor(red) connect(ascending))(line dep1 month if subj>51, lcolor(blue) connect(ascending)) (line depmean month if subj==1, lcolor(red) connect(ascending) lwidth(medthick) lpattern(dash)) (line depmean month if subj==61, lcolor(blue) connect(ascending) lwidth(medthick) lpattern(dash)), legend(label(1 "Placebo") label(2 "Treatment") label(3 "Placebo") label(4 "Treatment") label(5 "Mean, placebo") label(6 "Mean, treatment")) * box-plot: graph box dep, over(month) over(group) * Simple linear regression ignoring subject effects and correlated within-subject error terms. regress dep pre group time regress dep pre group time,vce(robust) regress dep pre group time,vce(cluster subj) * Ex 6.2: 4. * RI xtmixed dep pre group time || subj:, mle variance estimates store ri display sqrt(14.38943 +11.10913) display 14.38943/(14.38943 +11.10913