# fig2_5

## PURPOSE

Local Regression and Likelihood, Figure 2.5.

## SYNOPSIS

This is a script file.

## DESCRIPTION

     Local Regression and Likelihood, Figure 2.5.

     Using different smoothing parameters.

## 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.
- residuals Residuals (or a few other things) from a locfit() fit.

This function is called by:

- runbook

## SOURCE CODE

    0001 % Local Regression and Likelihood, Figure 2.5.
    0002 %
    0003 % Using different smoothing parameters.
    0004
    0005 load ethanol;
    0006
    0007 alp = [0.2 0.4 0.6 0.8];
    0008 f=['a','b','c','d'];
    0009 for (i=1:4)
    0010   figure('Name', sprintf( 'figure2_5%c: Smoothing parameters', f(i) ) );
    0011   fit = locfit(E,NOx,'alpha',alp(i));
    0012   res = residuals(fit);
    0013   fit2 = locfit(E,res,'alpha',0.2);
    0014   lfplot(fit2);
    0015   title(strcat('a = ',num2str(alp(i))));
    0016   ylabel('Residual');
    0017   hold on;
    0018   plot([min(E) max(E)], [0 0], ':');
    0019   hold off;
    0020 end;