* do-file for Supplementary Exercises 2.11, 2.48, 10.38 and 10.39 of IPS7e version 17 /* works also with versions 13-16 */ import delimited "R:\Chapter 2\ex02_011.csv" scatter hav ma pwcorr hav ma, sig twoway (scatter hav ma) (lfit hav ma) regress hav ma * Stata does not give a prediction interval but it can be computed * from the fitted value, the prediction ("forecast") error and the t-percentile * To get the values for MA=25, look for an observation with that value! predict fit, xb predict pe_fit, stdf display invttail(36,0.025) /* our t-star value */ generate pi_lower = fit - invttail(36,0.025)*pe_fit generate pi_upper = fit + invttail(36,0.025)*pe_fit * analyses without the suspected outlier pwcorr hav ma if hav<50, sig regress hav ma if hav<50