# residuals

## PURPOSE

Residuals (or a few other things) from a locfit() fit.

## SYNOPSIS

function y = residuals(fit,type)

## DESCRIPTION

     Residuals (or a few other things) from a locfit() fit.

     Input arguments:
       fit - the locfit() fit.
       type (optional) type of residuals. Valid types are
         'dev'    (deviance, the default)
         'd2'     (deviance squared)
         'pearson'(Pearson)
         'raw'    (observed - fitted)
         'ldot'   (derivative of log-likelihood)
         'lddot'  (second derivative)
         'fit'    (fitted values - no transformation)
         'mean'   (fitted values - with back transformation)

      Author: Catherine Loader.

## CROSS-REFERENCE INFORMATION

This function calls:

- predict Interpolate a fit produced by locfit().

This function is called by:

- fig2_5 Local Regression and Likelihood, Figure 2.5.
- fig4_3 Local Regression and Likelihood, Figure 4.3.
- fig6_3 Local Regression and Likelihood, Figure 6.3.
- fig6_4 Local Regression and Likelihood, Figure 6.4.

## SOURCE CODE

    0001 function y = residuals(fit,type)
    0002
    0003 % Residuals (or a few other things) from a locfit() fit.
    0004 %
    0005 % Input arguments:
    0006 %   fit - the locfit() fit.
    0007 %   type (optional) type of residuals. Valid types are
    0008 %     'dev'    (deviance, the default)
    0009 %     'd2'     (deviance squared)
    0010 %     'pearson'(Pearson)
    0011 %     'raw'    (observed - fitted)
    0012 %     'ldot'   (derivative of log-likelihood)
    0013 %     'lddot'  (second derivative)
    0014 %     'fit'    (fitted values - no transformation)
    0015 %     'mean'   (fitted values - with back transformation)
    0016 %
    0017 %  Author: Catherine Loader.
    0018
    0019 if (nargin<2) type = 'dev'; end;
    0020
    0021 y = predict(fit,'d','restyp',type);
    0022
    0023 return;