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

st: RE: Leave one out


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Randolph M Siverson
> Sent: Tuesday, October 04, 2005 2:40 PM
> To: statalist@hsphsun2.harvard.edu
> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index