diff rDiff/src/locfit/m/lcv.m @ 0:0f80a5141704

version 0.3 uploaded
author vipints
date Thu, 14 Feb 2013 23:38:36 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rDiff/src/locfit/m/lcv.m	Thu Feb 14 23:38:36 2013 -0500
@@ -0,0 +1,19 @@
+function g=lcv(varargin)
+%
+% likelihood cross-validation.
+%
+% returned vector consists of log-likelihood, trace(H), trace(H'H)
+% and cross-validated deviance (-2 * cross-validated log-likelihood).
+%
+% Author: Catherine Loader.
+
+fit = locfit(varargin{:},'ev','cros');
+rs = rsum(fit);
+
+df0 = rs(1);
+df1 = rs(2);
+llk = rs(3);
+
+g = [llk df0 df1 -2*llk];
+
+return;