Maarten Buis wrote:
> ---Tim Asked:
> i have checked the manuals and searched the help. e(b) gives the
> coefficient estimates, and e(V) gives the covariance of the
> estimates. But do I then have to calculate the p, the t, and the
> Confidence Intervals by hand?
--- Michael Blasnik answered:
> Otherwise, you will have to do it "by hand", which can
> be automated fairly easily depending on your ultimate goal.
Examples of automating these calculations can be found in earlier post
on the statalist, e.g.
http://www.stata.com/statalist/archive/2005-02/msg00481.html
--------------------------------------------------------------------------------
As Michael and Maarten mention, the task is fairly straightforward and has
come up on the list before.
If Tim is just putting the Wald t, p and CLs for each of the predictors and
intercept of a single-equation linear model into a series of local or global
macros, then it's scarcely more than a half-dozen lines of code for the
whole kit and caboodle.
Joseph Coveney
set more off
sysuse auto, clear
regress headroom trunk weight length turn
*
* Begin here
*
local predictor_list : colnames e(b) // Watch for dropped variables
foreach predictor of local predictor_list {
local t_`predictor' = _b[`predictor'] / _se[`predictor']
local p_`predictor' = 2 * ttail(e(df_r), abs(`t_`predictor''))
local half_alpha = (1 - `c(level)' / 100) / 2
local lcl_`predictor' = _b[`predictor'] + ///
invttail(e(df_r), 1-`half_alpha') * _se[`predictor']
local ucl_`predictor' = _b[`predictor'] + ///
invttail(e(df_r), `half_alpha') * _se[`predictor']
}
*
* Done
*
macro list
exit
*
* 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/