* do-file for Supplementary Exercises 6.13 and 6.14 of IPS7e version 13 /* see below for a better way with version 14 */ import delimited "H:\VHM\VHM801\Datasets\csv\Chapter 6\ex06_013.csv" summarize yield * Stata 13 does not offer confidence intervals with KNOWN sigma. * One way to trick the program is to pretend the dataset to be huge; * below we assume 10000 times as many observations, and a standard deviation * 100 (=sqrt(10000)) times as large, so that the standard deviation of * the mean is the same. cii 150000 123.8 1000, level(90) cii 150000 123.8 1000, level(95) cii 150000 123.8 1000, level(99) * As you'll have guessed by now, the cii command with parameters * n, mu and sigma, gives a confidence interval for a sample of size n * from a normal distribution with mean mu and standard deviation sigma. * Other variants of the command give confidence intervals for other * situations (later in course). * 6.14 cii 500000 123.8 1000, level(95) ******************************************************************************* * Stata 14 code * the ztest command offers inference for a normal distribution with known sigma * the hypothesized mean (for a test) is required, but we can set it at any value and ignore the result * note that the default confidence level is 95, so the option "level(95)" can be omitted * 6.13 ztest yield=0, sd(10) level(90) ztest yield=0, sd(10) level(95) ztest yield=0, sd(10) level(99) * 6.14 ztesti 50 123.8 10 0, level(95)