| From | "Scott Merryman" <[email protected]> |
| To | <[email protected]> |
| 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–2025 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |