Statalist


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

st: RE: re: how to save VIF measure in a file


From   "Nuno" <[email protected]>
To   <[email protected]>
Subject   st: RE: re: how to save VIF measure in a file
Date   Sun, 20 Apr 2008 16:40:29 +0100

Just a minor clarification to the previous code:

 webuse grunfeld,clear
 mat vif = J(10,3,.)
 mat colnames vif = "mvalue kstock time"

 forv i=1/10 {
 	qui reg invest mvalue kstock time if company == `i'
 	vif	
 	forv j=1/3 {
 		mat vif[`i', colnumb(vif,r(name_`j'))] = r(vif_`j')
 	}
 }
 mat list vif
 // mat2txt from ssc
 mat2txt, mat(vif) saving(myvifs) format(%9.3f) replace type myvifs.txt
 

For some reason (at least in my code), the identifier of each variable was
changing in some of iteractions. This meant that, I could have started with
mvalue vif at the first iteraction and on the next iteraction I could have
kstock vif in the same column. This way the code names the columns and
searches the correct column to input the corresponding vif.

Best,

Nuno

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kit Baum
Sent: 19 April 2008 23:12
To: [email protected]
Subject: st: re: how to save VIF measure in a file


This should work for you:

> webuse grunfeld,clear
> mat vif = J(10,3,.)
> forv i=1/10 {
> 	qui reg invest mvalue kstock time if company == `i'
> 	vif	
> 	forv j=1/3 {
> 		mat vif[`i', `j'] = r(vif_`j')
> 	}
> }
> mat list vif
> // mat2txt from ssc
> mat2txt, mat(vif) saving(myvifs) format(%9.3f) replace type myvifs.txt



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/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

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