# fig7_4

## PURPOSE

Local Regression and Likelihood, Figure 7.4.

## SYNOPSIS

This is a script file.

## DESCRIPTION

     Local Regression and Likelihood, Figure 7.4.

     Censored Local Likelihood

     Author: Catherine Loader

     NEED: this is given problems for unknown reasons. something
     to do with censored observations and the ibeta routine.
     if i replace this by
     res[ZLIK] = th*y-y*log(p)
     res[ZDLL] = y*p
     res[ZDDLL] = y*p*(1-p)
     works fine. Memory leak somewhere??
     also works if i ignore censoring.

## 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.

This function is called by:

- runbook

## SOURCE CODE

    0001 % Local Regression and Likelihood, Figure 7.4.
    0002 %
    0003 % Censored Local Likelihood
    0004 %
    0005 % Author: Catherine Loader
    0006 %
    0007 % NEED: this is given problems for unknown reasons. something
    0008 % to do with censored observations and the ibeta routine.
    0009 % if i replace this by
    0010 % res[ZLIK] = th*y-y*log(p)
    0011 % res[ZDLL] = y*p
    0012 % res[ZDDLL] = y*p*(1-p)
    0013 % works fine. Memory leak somewhere??
    0014 % also works if i ignore censoring.
    0015
    0016
    0017 load border;
    0018 fit = locfit(day,runs,'cens',no,'family','geom','alpha',0.7);
    0019 figure('Name','fig7_4: censored local likelihood;' );
    0020 lfplot(fit);
    0021 xlabel('Date');
    0022 ylabel('Runs');