Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: test command


From   Kit Baum <Baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: test command
Date   Sat, 10 Sep 2005 16:04:25 -0400

A. Santos wrote

Does anyone knows a command in STATA that uses the t-stat test for testing
individual or joint coefficients in regressions, i.e., B1=.5 or B1=B2, etc.
I know that the F test that is used in the test command is the general case
for the hypothesis testing, but we normally see the t-stat and asscoiated
p-value in published papers (at least in my area), that we would like to
stick with the convention (eventhough is the same thing)...


The test command, when applied to a single hypothesis, produces an F- statistic with one numerator d.f. The t-statistic of which you speak is the square root of that F-statistic. Its p-value is identical to that of the F-statistic. E.g.

webuse auto
regress price mpg weight
test mpg

You will find that the F-statistic is the square of the t, and it has the same p-value. Follow the test command with

scalar tstat = sqrt(r(F))

and you will get the |tstat| that you seek. If you want to get fancy and preserve the sign,

mat b = e(b)
scalar tstat = sqrt(r(F))*sign(_b[mpg])

display tstat will then give you the tstat with sign.

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index