# lcv

## PURPOSE

## SYNOPSIS

function g=lcv(varargin)

## DESCRIPTION

     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.

## CROSS-REFERENCE INFORMATION

This function calls:

- locfit Smoothing noisy data using Local Regression and Likelihood.
- rsum

This function is called by:

- lcvplot

## SOURCE CODE

    0001 function g=lcv(varargin)
    0002 %
    0003 % likelihood cross-validation.
    0004 %
    0005 % returned vector consists of log-likelihood, trace(H), trace(H'H)
    0006 % and cross-validated deviance (-2 * cross-validated log-likelihood).
    0007 %
    0008 % Author: Catherine Loader.
    0009
    0010 fit = locfit(varargin{:},'ev','cros');
    0011 rs = rsum(fit);
    0012
    0013 df0 = rs(1);
    0014 df1 = rs(2);
    0015 llk = rs(3);
    0016
    0017 g = [llk df0 df1 -2*llk];
    0018
    0019 return;