< >
Here is a slightly less toylike example:
webuse grunfeld, clear
scalar tavg = 0
scalar navg = 0
forv i=1/10 {
reg invest mvalue if company == `i'
scalar tavg = tavg + e(N) * abs(_b[mvalue] / _se[mvalue])
di `i' " " tavg
scalar navg = navg + e(N)
}
scalar tavg = tavg / navg
scalar navg = navg / 10
scalar pavg = ttail(navg, abs(tavg))
di _n "Average t(" navg ") = " tavg " with pval = " pavg
Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/