# fig13_1

## PURPOSE

Local Regression and Likelihood, Figure 13.1

## SYNOPSIS

This is a script file.

## DESCRIPTION

     Local Regression and Likelihood, Figure 13.1

     Author: Catherine Loader

## CROSS-REFERENCE INFORMATION

This function calls:

- 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 13.1
    0002 %
    0003 % Author: Catherine Loader
    0004
    0005 load mmsamp;
    0006
    0007 figure('Name','fig13_1a');
    0008 plot(x,y,'o');
    0009 hold on;
    0010
    0011 fit = locfit(x,y,'deg',1,'kern','minmax','alpha',4000,'ev','grid','mg',200,'ll',0,'ur',1);
    0012 xev = fit.fit_points.evaluation_points';
    0013 yev = predict(fit,'fitp');
    0014 plot(xev,yev);
    0015
    0016 fit = locfit(x,y,'deg',1,'h',0.05,'ev','grid','mg',100,'ll',0,'ur',1);
    0017 xev = fit.fit_points.evaluation_points';
    0018 yev = predict(fit,'fitp');
    0019 plot(xev,yev,'red');
    0020
    0021 xx = 0:0.01:1;
    0022 yy = 2-5*xx+5*exp(-(20*xx-10).*(20*xx-10));
    0023 plot(xx,yy,'green');
    0024
    0025 legend('Data','Minimax','Constant h','True Mean');
    0026
    0027 hold off;