Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: how do i save the significance levels of coefficients after estimation?


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: how do i save the significance levels of coefficients after estimation?
Date   Tue, 18 Apr 2006 17:26:36 +0200

Ada:
Regression commands store the variance covariance matrix. The standard errors of the coefficients are the square roots of the diagonal elements of that matrix, and that is what the line -mat se= vecdiag(cholesky(diag(vecdiag(e(V)))))'- does. Now, you can also just store the diagonal elements and take the square root ones you have put them in a dataset, like in the example below. This should not break down when zeros occur. 
HTH,
Maarten
*-------------begin example-----------
clear
sysuse auto
regress mpg len turn head gear
qui{
	drop _all
	mat b=e(b)'
	mat var= vecdiag(e(V))'
	gen vars=""
	local names: rownames b
	tokenize `names'
	local num : word count `names'
	set obs `num'
	forvalues i=1/`num'{
		replace vars= "``i''" in `i'
	}
	svmat b
	svmat var
	rename b1 coef
	gen se = sqrt(var1)
	drop var1
	gen t=coef/se
	gen pvalue=2*ttail(e(df_r),abs(t))
	gen lb=coef-invttail(e(df_r),0.025)*se
	gen ub=coef+invttail(e(df_r),0.025)*se
}
list
*-----------------end example--------------------


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Ada Ma
Sent: dinsdag 18 april 2006 17:09
To: [email protected]
Subject: Re: st: RE: how do i save the significance levels of coefficients after estimation?

Thanks for the suggestion.  I'm looping the estimation through
different samples, so often quite a (big) bunch of the variables got
dropped.  I'll need to think of a way to drop the variables or the
zeros from the matrices.

Cheers,
Ada



On 4/18/06, Maarten Buis <[email protected]> wrote:
> Probably the easiest way to do that is to not enter the dropped the variables in the regression statement, and use the e(V) of that regression.
> HTH,
> Maarten
>
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
>
> visiting adress:
> Buitenveldertselaan 3 (Metropolitan), room Z214
>
> +31 20 5986715
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]On Behalf Of Ada Ma
> Sent: dinsdag 18 april 2006 16:40
> To: [email protected]
> Subject: Re: st: RE: how do i save the significance levels of coefficients after estimation?
>
> the estimation I did have lost of
> dropped variables, and when I tried to implement:
>
> mat se= vecdiag(cholesky(diag(vecdiag(e(V)))))'
>
> Stata replies saying:
> matrix not positive definite
> r(506);
>
> How can I trim the zeros from the e(b) and e(V) matrices before I
> perform the commands posted by Maarten?
>
 

*
*   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