Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: Adding t-test (test difference from zero, not between two groups) to estpost

 From Richard Williams To statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu Subject Re: st: Adding t-test (test difference from zero, not between two groups) to estpost Date Sun, 03 Mar 2013 11:15:25 -0500

```It is easy enough to set up a loop for this. Something like

foreach var of varlist firstvar-lastvar {
ttest `var' = 0
}

See the help for -foreach-.

```
Incidentally, I am not sure this is legitimate in the first place. Your sample is a bunch of regression results. What population is being generalized too? i.e. is each regression viewed as being pulled from the population of all possible regressions (and if so what kind of population is that?) Why would you think their mean is 0 anyway? You don't describe the substance of your problem, but to me it seems like an odd thing to test.
```

At 08:14 AM 3/3/2013, Fabio Motoki wrote:
```
```Hi Richard! Thanks for your reply. Yes, I do use estadd in other
cases. But the thing is I have several coefficients, and I'd like to
have a t-test beta=0 for each of them, and then add a line with all
tests instead of several separated scalars.

2013/3/2 Richard Williams <richardwilliams.ndu@gmail.com>:
> Will something like this do what you want? You need -estadd- from SSC.
>
> ttest educ = 0
> estadd scalar teduc = r(t)
>
>
>
> At 06:05 PM 3/2/2013, Fabio Motoki wrote:
>>
>> Hi there! I have run several regressions with statsby, and I need to
>> present summary statistics on the coefficients. Particularly, I want
>> to test whether the mean of the coefficients is statistically
>> different from zero. Using estpost summarize there is no option for
>> that. Any suggestions? The other stats I need (mean, median,
>> percentiles, count) I get from estpost summarize.
>>
>> Cheers,
>>
>>    Fabio
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
>
>
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> HOME:   (574)289-5227
> EMAIL:  Richard.A.Williams.5@ND.Edu
> WWW:    http://www.nd.edu/~rwilliam
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```
```
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```