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

st: RE: RE: Leave one out


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Leave one out
Date   Tue, 4 Oct 2005 21:07:35 -0500

Nick Cox kindly pointed out to me that -regress- automatically returns the
root mean square error, so this could be rewritten as:

sysuse auto,clear
count
tempvar rmse
gen `rmse' = .
qui {
forv i = 1/`=r(N)' {
	reg mpg gear if _n != `i'
	replace `rmse' = e(rmse) in `i'
	}
 sum `rmse'
}	

disp "RMSE (LOOCV) = "r(mean)

Scott





*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index