<div dir="ltr">
<div></div>
<div></div>
<div>For over a century, academics have been teaching the Student’s T-test and practitioners have been running it to determine if the mean values of a variable for two groups were statistically different. </div>
<div></div>
<div>It is time to ditch the Comparison of Means (T) Test and rely instead on the ordinary least squares (OLS) Regression. </div>
<div></div>
<div>My motivation for this suggestion is to reduce the learning burden on non-statisticians whose goal is to find a reliable answer to their research question. The current practice is to devote a considerable amount of teaching and learning effort on statistical tests that are redundant in the presence of disaggregate data sets and readily available tools to estimate Regression models.</div>
<div></div>
<div>Before I proceed any further, I must confess that I remain a huge fan of William Sealy Gosset who introduced the T-statistic in 1908. He excelled in intellect and academic generosity. Mr. Gosset published the very <a rel="nofollow" href="http://seismo.berkeley.edu/~kirchner/eps_120/Odds_n_ends/Students_original_paper.pdf" target="_blank">paper that introduced the t-statistic</a> under a pseudonym, the Student. To this day, the T-test is known as the Student’s T-test.   </div>
<div></div>
<div></div>
<div>My plea is to replace the Comparison of Means (T-test) with OLS Regression, which of course relies on the T-test. So, I am not necessarily asking for ditching the T-test but instead asking to replace the Comparison of Means Test with OLS Regression.</div>
<div></div>
<div>The following are my reasons:</div>
<div></div>
<div>1.<span>       </span>Pedagogy related reasons:</div>
<div>a.<span>       </span>Teaching Regression instead of other intermediary tests will save instructors considerable time that could be used to illustrate the same concepts with examples using Regression.</div>
<div>b.<span>       </span>Given that there are fewer than 39 hours of lecture time available in a single semester introductory course on applied statistics, much of the course is consumed in covering statistical tests that would be redundant if one were to introduce Regression models sooner in the course.</div>
<div>c.<span>        </span>Academic textbooks for undergraduate students in business, geography, psychology dedicate huge sections to a battery of tests that are redundant in the presence of Regression models.</div>
<div><span>                                                               </span>i.<span>      </span>Consider the widely used textbook <i>Business Statistics</i> by Ken Black that requires students and instructors to leaf through 500 pages before OLS Regression is introduced.</div>
<div><span>                                                             </span>ii.<span>      </span>The learning requirements of undergraduate and graduate students not enrolled in economics, mathematics, or statistics programs are quite different. Yet most textbooks and courses attempt to turn all students into professional statisticians.</div>
<div>2.<span>       </span>Applied Analytics reasons</div>
<div>a.<span>       </span>OLS Regression model with a continuous dependent variable and a dichotomous explanatory variable produces the exact same output as the standard Comparison of Means Test.</div>
<div>b.<span>       </span>Extending the comparison to more than two groups is a straightforward extension in Regression where the dependent variable will comprise more than two groups. </div>
<div><span>                                                               </span>i.<span>      </span>In the tradition statistics teaching approach, one advises students that the T-test is not valid to compare the means for more than two groups and that we must switch to learning a new method, ANOVA.</div>
<div><span>                                                             </span>ii.<span>      </span>You might have caught on my drift that I am also proposing to replace teaching ANOVA in introductory statistics courses with OLS Regression.</div>
<div>c.<span>        </span>A Comparison of Means Test illustrated as a Regression model is much easier to explain than explaining the output from a conventional T-test. </div>
<div></div>
<div>After introducing Normal and T-distributions, I would, therefore, argue that instructors should jump straight to Regression models.</div>
<div></div>
<h2><b>Is Regression a valid substitute for T-tests?</b></h2>
<div></div>
<div>In the following lines, I will illustrate that the output generated by OLS Regression models and a Comparison of Means test are identical. I will illustrate examples using Stata and R.</div>
<div></div>
<h3><b>Dataset</b></h3>
<div>I will use Professor Daniel Hamermesh’s data on teaching ratings to illustrate the concepts. In a popular paper, <a rel="nofollow" href="https://sites.google.com/site/statsr4us/intro/software/rcmdr-1/Beautyandteacherratings.pdf?attredirects=0&d=1" target="_blank">Professor Hamermesh and Amy Parker</a> explore whether good looking professors receive higher teaching evaluations. The dataset comprises teaching evaluation score, beauty score, and instructor/course related metrics for 463 courses and is available for download in R, Stata, and Excel formats at: </div>
<div></div>
<div><a rel="nofollow" href="https://sites.google.com/site/statsr4us/intro/software/rcmdr-1" target="_blank">https://sites.google.com/site/statsr4us/intro/software/rcmdr-1</a></div>
<div></div>
<h3><b>Hypothetically Speaking</b></h3>
<div>Let us test the hypothesis that the average beauty score for male and female instructors is statistically different. The average (normalized) beauty score for male instructors was -0.084 for male instructors and 0.116 for female instructors. The following Box Plot illustrates the difference in beauty scores. The question we would like to answer is whether this apparent difference is statistically significant.</div>
<div></div>
<div><a rel="nofollow" href="https://i1.wp.com/1.bp.blogspot.com/-Wki7v9Q9MZE/Wp_6Q7nLJRI/AAAAAAAAG6A/R9wGZeEi02YEIOXOxYN_ugNXUUFCMy3AwCEwYBhgL/s1600/2.png?ssl=1" target="_blank"><img border="0" src="https://i0.wp.com/1.bp.blogspot.com/-Wki7v9Q9MZE/Wp_6Q7nLJRI/AAAAAAAAG6A/R9wGZeEi02YEIOXOxYN_ugNXUUFCMy3AwCEwYBhgL/s400/2.png?resize=450%2C657&ssl=1" data-original-width="450" width="450" data-original-height="657" data-recalc-dims="1"></a></div>
<div></div>
<div>I first illustrate the Comparison of Means Test and OLS Regression assuming Equal Variances in <a rel="nofollow" href="http://www.stata.com/" target="_blank">Stata</a>.</div>
<div></div>
<div></div>
<h3><b>Assuming Equal Variances (Stata)</b></h3>
<div><b><br></b></div>
<div><b>Download data</b></div>
<div><b></b></div>
<div><b><span>       use “https://sites.google.com/site/statsr4us/intro/software/rcmdr-1/teachingratings.dta” </span></b></div>
<div><b><span>encode gender, gen(sex) // To convert a character variable into a numeric variable.</span></b></div>
<div></div>
<div>The T-test is conducted using:<br><br></div>
<div><b><span>       ttest beauty, by(sex)</span></b></div>
<div></div>
<div>The above generates the following output:</div>
<div></div>
<div><a rel="nofollow" href="https://i2.wp.com/4.bp.blogspot.com/-G9eOPFB3ooc/Wp_7BXTo65I/AAAAAAAAG6I/cFfN-J80BM4Jv3SiXOe7hHUeDOYQqiT6wCLcBGAs/s1600/3.png?ssl=1" target="_blank"><img border="0" data-original-height="302" src="https://i2.wp.com/4.bp.blogspot.com/-G9eOPFB3ooc/Wp_7BXTo65I/AAAAAAAAG6I/cFfN-J80BM4Jv3SiXOe7hHUeDOYQqiT6wCLcBGAs/s1600/3.png?resize=450%2C302&ssl=1" data-recalc-dims="1" data-original-width="450"></a></div>
<div></div>
<div>As per the above estimates, the average beauty score of female instructors is 0.2 points higher and the t-test value is 2.7209. We can generate the same output by running an OLS regression model using the following command:</div>
<div></div>
<div></div>
<div><b><span>reg beauty i.sex</span></b></div>
<div></div>
<div>The regression model output is presented below.</div>
<div></div>
<div></div>
<div><a rel="nofollow" href="https://i0.wp.com/2.bp.blogspot.com/-MIKlH6lOWfQ/Wp_7BcQyCTI/AAAAAAAAG6M/10SCJDgHC0I4xbOwt5_FSiKPpwZa1GVnACEwYBhgL/s1600/4.png?ssl=1" target="_blank"><img border="0" data-original-height="264" src="https://i0.wp.com/2.bp.blogspot.com/-MIKlH6lOWfQ/Wp_7BcQyCTI/AAAAAAAAG6M/10SCJDgHC0I4xbOwt5_FSiKPpwZa1GVnACEwYBhgL/s1600/4.png?resize=450%2C264&ssl=1" data-recalc-dims="1" data-original-width="450"></a></div>
<div></div>
<div>Note that the average beauty score for male instructors is -0.2 points lower than that of females and the associated standard errors and t-values (highlighted in yellow) are identical to the ones reported in the Comparison of Means test. </div>
<div></div>
<h3><b>Unequal Variances</b></h3>
<div><b><br></b></div>
<div>But what about unequal variances? Let us first conduct the t-test using the following syntax:</div>
<div></div>
<div></div>
<div><b><span>ttest beauty, by(sex) unequal</span></b></div>
<div></div>
<div>The output is presented below:</div>
<div></div>
<div><a rel="nofollow" href="https://i1.wp.com/2.bp.blogspot.com/-xJxOfmz9tiU/Wp_7BQrh9NI/AAAAAAAAG6g/b-GmoP_eKxwVCjofEUrmF7pJMfflJOa0ACEwYBhgL/s1600/5.png?ssl=1" target="_blank"><img border="0" data-original-height="297" src="https://i1.wp.com/2.bp.blogspot.com/-xJxOfmz9tiU/Wp_7BQrh9NI/AAAAAAAAG6g/b-GmoP_eKxwVCjofEUrmF7pJMfflJOa0ACEwYBhgL/s1600/5.png?resize=450%2C297&ssl=1" data-recalc-dims="1" data-original-width="450"></a></div>
<div></div>
<div></div>
<div></div>
<div>Note the slight change in standard error and the associated t-test.</div>
<div></div>
<div></div>
<div>To replicate the same results with a Regression model, we need to run a different Stata command that estimates a <a rel="nofollow" href="https://www.stata.com/manuals13/rvwls.pdf" target="_blank">variance weighted least squares regression</a><span>. U</span>sing Stata’s <b><u>vwls</u></b> command:</div>
<div></div>
<div><b><span>vwls beauty i.sex</span></b></div>
<div><b><span><br></span></b></div>
<div><a rel="nofollow" href="https://i0.wp.com/2.bp.blogspot.com/-pbed7DjRHaw/Wp_7B-yoX9I/AAAAAAAAG6s/Mi-IvRn10wMVpGzl1mq_TjeTx63P8pjgQCEwYBhgL/s1600/6.png?ssl=1" target="_blank"><img border="0" data-original-height="231" src="https://i0.wp.com/2.bp.blogspot.com/-pbed7DjRHaw/Wp_7B-yoX9I/AAAAAAAAG6s/Mi-IvRn10wMVpGzl1mq_TjeTx63P8pjgQCEwYBhgL/s1600/6.png?resize=450%2C231&ssl=1" data-recalc-dims="1" data-original-width="450"></a></div>
<div></div>
<div>Note that the last two outputs are identical. </div>
<div></div>
<h2><b>Repeating the same analysis in R</b></h2>
<div><b><br></b></div>
<div></div>
<div>To download data in R, use the following syntax:</div>
<div></div>
<div></div>
<div><b><span>url = “https://sites.google.com/site/statsr4us/intro/software/rcmdr-1/TeachingRatings.rda”</span></b></div>
<div><b><span>download.file(url,”TeachingRatings.rda”)</span></b></div>
<div><b><span>load(“TeachingRatings.rda”)</span></b></div>
<div></div>
<div>For equal variances, the following syntax is used for T-test and the OLS regression model.</div>
<div><b><span>t.test(beauty ~ gender, var.equal=T)</span></b></div>
<div><b><span>summary(lm(beauty ~ gender))</span></b></div>
<div></div>
<div>The above generates the following identical output as Stata.</div>
<div></div>
<div><a rel="nofollow" href="https://i2.wp.com/1.bp.blogspot.com/-e5hODyJXTvQ/Wp_7CXvrCrI/AAAAAAAAG6o/lNkbAnpLakkgnxgRvQATU7TViAbddehjACEwYBhgL/s1600/7.png?ssl=1" target="_blank"><img border="0" data-original-height="491" src="https://i2.wp.com/1.bp.blogspot.com/-e5hODyJXTvQ/Wp_7CXvrCrI/AAAAAAAAG6o/lNkbAnpLakkgnxgRvQATU7TViAbddehjACEwYBhgL/s1600/7.png?resize=450%2C491&ssl=1" data-recalc-dims="1" data-original-width="450"></a></div>
<div></div>
<div>For unequal variances, we need to install and load the <b>nlme </b>package to run a <b>gls</b> version of the variance weighted least square Regression model.</div>
<div></div>
<div></div>
<div><b><span>t.test(beauty ~ gender)</span></b></div>
<div><b><span>install.packages(“nlme”)</span></b></div>
<div><b><span>library(nlme)</span></b></div>
<div><b><span>summary(gls(beauty ~ gender,  weights=varIdent(form = ~ 1 | gender)))</span></b></div>
<div></div>
<div>The above generates the following output:</div>
<div></div>
<div><a rel="nofollow" href="https://i2.wp.com/2.bp.blogspot.com/-w5uwBfXs19I/Wp_7C3XTxAI/AAAAAAAAG6o/SNzHe_mF3I4pCobGJh-alVBOnTrjJ7p-QCEwYBhgL/s1600/8.png?ssl=1" target="_blank"><img border="0" data-original-height="506" src="https://i2.wp.com/2.bp.blogspot.com/-w5uwBfXs19I/Wp_7C3XTxAI/AAAAAAAAG6o/SNzHe_mF3I4pCobGJh-alVBOnTrjJ7p-QCEwYBhgL/s1600/8.png?resize=450%2C506&ssl=1" data-recalc-dims="1" data-original-width="450"></a></div>
<div></div>
<div>So there we have it, OLS Regression is an excellent substitute for the Comparison of Means test.</div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
	<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/160K_aENStE" height="1">