# fig9_2

## PURPOSE

Local Regression and Likelihood, Figure 9.2.

## SYNOPSIS

This is a script file.

## DESCRIPTION

     Local Regression and Likelihood, Figure 9.2.

     Hardle's Motorcycle accelaration dataset.
     Local Variance Estimation.

     Author: Catherine Loader

     NEED: lfknots function to extract fit points.

## CROSS-REFERENCE INFORMATION

This function calls:

- lfplot Plot (for one or two dimensions) a locfit() fit.
- locfit Smoothing noisy data using Local Regression and Likelihood.
- predict Interpolate a fit produced by locfit().

This function is called by:

- runbook

## SOURCE CODE

    0001 % Local Regression and Likelihood, Figure 9.2.
    0002 %
    0003 % Hardle's Motorcycle accelaration dataset.
    0004 % Local Variance Estimation.
    0005 %
    0006 % Author: Catherine Loader
    0007 %
    0008 % NEED: lfknots function to extract fit points.
    0009
    0010 load mcyc;
    0011 fit = locfit(time,'y',accel,'nn',0.1);
    0012 y = -2*predict(fit,'fitp','what','lik');
    0013 w = predict(fit,'fitp','what','rdf');
    0014 x = fit.fit_points.evaluation_points';
    0015 [x y w]
    0016 fitv = locfit(x,y,'weights',w,'family','gamma','nn',0.4);
    0017 figure('Name','fig9_2: Motorcycle acceleration');
    0018 lfplot(fitv);
    0019 xlabel('Time');
    0020 ylabel('Variance');