* do-file for Supplementary Exercise 13.31 of IPS7e version 17 /* works also with versions 13-16 */ import delimited "R:\Chapter 13\ex13_031.csv" table promo percent, contents( mean eprice sd eprice ) anova eprice promo percent promo#percent predict pred, xb sort promo percent overlay pred percent, by(promo) c(l) sort percent promo overlay pred promo, by(percent) c(l) predict stdres, rstandard scatter stdres pred qnorm stdres * confidence intervals and margins using pwcompare command pwcompare promo percent, cimargins pwcompare promo percent, pveffects pwcompare promo percent, pveffects mcompare(bon) * t-distribution percentiles for CI and LSD, without/with Bonferroni correction di invttail(144,.025) di invttail(144,.025/6) * confidence intervals and pairwise comparisons can also be done by hand * percent group means should have a margin of error for a 95% CI of * t(.975,144)*0.241648*sqrt(1/40) = 0.076, using a t-value of 1.977 * and the same margin of error applies to promotion means. * Also, LSD_0.95-values for pairwise comparisons are computed as * t(.975,144)*0.241648*sqrt(2/40) = 0.107 * and Bonferroni-corrected LSD values (as in IPS) as follows * t(1-0.025/6,144)*0.241648*sqrt(2/40) = 0.145, using a t-value of 2.675