# fig4_3

## PURPOSE

Local Regression and Likelihood, Figure 4.3.

## SYNOPSIS

This is a script file.

## DESCRIPTION

     Local Regression and Likelihood, Figure 4.3.
     Author: Catherine Loader

     Residual plots for local likelihood.
     Henderson-Shepherd Mortality Data.

## CROSS-REFERENCE INFORMATION

This function calls:

- 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 4.3.
    0002 % Author: Catherine Loader
    0003 %
    0004 % Residual plots for local likelihood.
    0005 % Henderson-Shepherd Mortality Data.
    0006
    0007 load morths;
    0008 fit = locfit(age,deaths,'weights',n,'family','binomial','alpha',0.5);
    0009
    0010 figure('Name','fig4_3a: Residual plots for local likelihood');
    0011 plot(age,residuals(fit,'dev'),'.-');
    0012 xlabel('Age');
    0013 ylabel('Residual');
    0014 title('Deviance Residuals');
    0015 hold on;
    0016 plot([min(age) max(age)],[0 0],':');
    0017 hold off;
    0018
    0019 figure('Name','fig4_3b: Residual plots for local likelihood');
    0020 plot(age,residuals(fit,'pear'),'.-');
    0021 xlabel('Age');
    0022 ylabel('Residual');
    0023 title('Pearson Residuals');
    0024 hold on;
    0025 plot([min(age) max(age)],[0 0],':');
    0026 hold off;
    0027
    0028 figure('Name','fig4_3c: Residual plots for local likelihood');
    0029
    0030 plot(age,residuals(fit,'raw'),'.-');
    0031 xlabel('Age');
    0032 ylabel('Residual');
    0033 title('Raw (response) Residuals');
    0034 hold on;
    0035 plot([min(age) max(age)],[0 0],':');
    0036 hold off;
    0037
    0038 figure('Name','fig4_3d: Residual plots for local likelihood');
    0039 plot(age,residuals(fit,'ldot'),'.-');
    0040 xlabel('Age');
    0041 ylabel('Residual');
    0042 title('ldot Residuals');
    0043 hold on;
    0044 plot([min(age) max(age)],[0 0],':');
    0045 hold off;
    0046