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

st: RE: Leave one out


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: Leave one out
Date   Tue, 4 Oct 2005 17:40:41 -0500

Is LOOCV something like this?

sysuse auto,clear
count
tempvar mse
gen `mse' = .
qui {
forv i = 1/`=r(N)' {
	reg mpg gear if _n != `i'
	predict res if _n != `i', res 
	replace res = res^2 
	sum res, meanonly
	replace `mse' = r(mean) in `i'
	drop res
	}
 sum `mse'
}	

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


Scott


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Randolph M Siverson
> Sent: Tuesday, October 04, 2005 2:40 PM
> To: [email protected]
> Subject: st: Leave one out
> 
> Does anyone know of ado files written to perform Leave One Out Cross
> Validation (LOOCV)?
> 
> Randolph M. Siverson
> Professor of Political Science and
> Director, International Relations Program
> University of California, Davis
> Davis, CA 95616
> 530-752-3078, voice and fax
> 
> 


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