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

RE: st: return of p-value for beta after regress command


From   Richard Williams <[email protected]>
To   [email protected]
Subject   RE: st: return of p-value for beta after regress command
Date   Sun, 01 Jan 2006 17:34:43 -0500

At 05:20 PM 1/1/2006, Maarten buis wrote:
Hi Colin,

Something like this was discussed a while ago on statalist:
http://www.stata.com/statalist/archive/2005-02/msg00481.html

HTH,
Maarten
Based on that message, this is an improvement on what I sent before:

* Run the regression first, then run this
mat b = e(b)
mat v = e(V)
local k = colsof(b)
mat t = J(1, `k', 0)
mat p = J(1, `k', 0)
local dfr = e(df_r)

forval j = 1/`k' {
local t = b[1,`j'] / sqrt( v[`j', `j'] )
local p = 2*ttail(`dfr',abs(`t'))
mat t[1,`j'] = `t'
mat p[1,`j'] = `p'
}
mat list t
mat list p

The main advantage of this is that the results are stored in matrices if you want them.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index