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 <Richard.A.Williams.5@ND.edu>
To   statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu
Subject   Re: st: return of p-value for beta after regress command
Date   Sun, 01 Jan 2006 17:25:40 -0500

At 04:10 PM 1/1/2006, Colin Cooke wrote:
I am interested in looking at the p-value for each beta after running
a series of regression commands.  I have a program that performs
regression after each "leave one out" iteration in order to determine
how infuential outliers effect the beta coefficients and p-values for
my model.  Unfortunately, I am unable to determine how to get stata to
return the p-value for each beta coefficient after a -regress-
command.  -ereturn list- does not appear to have the beta p-values as
an option.  Can anyone help? Thanks.
Here is a quick and dirty solution. You'll need to modify the calculation of p if the sample is too small to justify a z approximation, i.e. use the t distribution instead.

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

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


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: Richard.A.Williams.5@ND.Edu
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–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index