Confidence Intervals for t-test ------------------------------- ^tci^ continuous_var group_var [^if^ exp] [^in^ range] ^tci^ gives 99.9%, 99%, 95%, 90%, 80%, 65% and 50% confidence intervals, and t-test results, ^assuming^ that the variances are equal. A graph showing these limits is produced at the end; this is saved as #.gph, where # is replaced by 1...n for the number of continuous variables you run this ado for file, ^without^ leaving STATA. If you leave STATA and then re-enter and try to run this you will get an error message when the program tries to save the first graph unless you have changed the name of the graphs previously saved. The ado file is written this way assuming you want to keep old graphs, or at least you do not want to automatically destroy them. Your group_var will automatically be, temporarily, replaced by a 0-1 version so that the differences shown in the output will be correct. The 0-1 code will be 0 for the smallest of the first two codes found and the 1 will be for the largest, even if you have more than two groups in your original group_var. If you want this handled some other way, then make your own dummy variable prior to calling ^tci^. Your data set is replaced as it was saved on disk at the end of the run. Note that the xlabels and the top labels are not complete since this would lead to overlap of .99 and .999--however there are tick marks at each of the confidence levels graphed; seven levels are graphed, the same as the numbers that are shown (see the examples below). Examples using auto.dta (without the graphs): . us auto (1978 Automobile Data) . tci mpg for Lower Limit Upper Limit The level(.999) confidence interval is: 0.2701 9.6215 The level(.99) confidence interval is: 1.3417 8.5499 The level(.95) confidence interval is: 2.2304 7.6612 The level(.90) confidence interval is: 2.6760 7.2156 The level(.80) confidence interval is: 3.1840 6.7077 The level(.65) confidence interval is: 3.6644 6.2272 The level(.50) confidence interval is: 4.0224 5.8692 mean for first group is 19.8269 mean for second group is 24.7727 The difference is: 4.9458 t: 3.6308 and p-value is 0.0005 (N=74) (1978 Automobile Data) The second example uses ^if^ to test two of five groups: . tci mpg rep78 if rep78==3 | rep78==5 Following are confidence intervals for the difference: Lower Limit Upper Limit The level(.999) confidence interval is: 0.7051 15.1555 The level(.99) confidence interval is: 2.5028 13.3578 The level(.95) confidence interval is: 3.8780 11.9826 The level(.90) confidence interval is: 4.5548 11.3058 The level(.80) confidence interval is: 5.3186 10.5420 The level(.65) confidence interval is: 6.0352 9.8254 The level(.50) confidence interval is: 6.5663 9.2943 mean for first group is 19.4333 mean for second group is 27.3636 The difference is: 7.9303 t: 3.9584 and p-value is 0.0004 (N=41) (1978 Automobile Data) The data set name is shown at the end since the ado file re-sets the data file to the way it was before running the ado file; thus, all new variables disappear. However, the nonlocal macros, including the graph counter, do not disappear; they can be examined by typing "mac li" at the STATA command.