* do-file for Additional exercise 10.2, VHM 802, Winter 2014
version 13
set more off
cd "h:\vhm\vhm802"

insheet using data_csv\hs10_2.csv, clear
anova moist lot
* fixed and random effects 1-way ANOVA table coincide

mixed moist || lot:, reml /* xtmixed in Stata 11-12 */
predict pred, fitted
predict stdres, rstandard
scatter stdres pred
qnorm stdres
swilk stdres
predict pred_ref, reffects
bysort lot: gen within_n=_n
qnorm pred_ref if within_n==1
swilk pred_ref if within_n==1
