# fig7_1

## PURPOSE

Local Regression and Likelihood, Figure 7.1.

## SYNOPSIS

This is a script file.

## DESCRIPTION

     Local Regression and Likelihood, Figure 7.1.

     Estimating the hazard rate for censored survival (or
     failure time) data. Hazard rate estimation is specified
     by 'family','hazard'.

     The censoring indicator variable is passed as the 'cens'
     argument. This should be a vector of 0's and 1's, with 1
     indicating a censored observation, 0 uncensored.

     The 'xlim' argument specifies bounds on the domain of the
     x variable (survival times). Usually, survival times are
     non-negative (lower bound 0), but with theoretically no
     upper bound. The specification [0;10000] gives the lower
     bound of 0, and the upper bound is effectively infinite.

     Author: Catherine Loader

     NEEDS: m argument to lfplot.
     Also, lfplot symbols should distinguish between censored and
     uncensored data points.

## 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.1.
    0002 %
    0003 % Estimating the hazard rate for censored survival (or
    0004 % failure time) data. Hazard rate estimation is specified
    0005 % by 'family','hazard'.
    0006 %
    0007 % The censoring indicator variable is passed as the 'cens'
    0008 % argument. This should be a vector of 0's and 1's, with 1
    0009 % indicating a censored observation, 0 uncensored.
    0010 %
    0011 % The 'xlim' argument specifies bounds on the domain of the
    0012 % x variable (survival times). Usually, survival times are
    0013 % non-negative (lower bound 0), but with theoretically no
    0014 % upper bound. The specification [0;10000] gives the lower
    0015 % bound of 0, and the upper bound is effectively infinite.
    0016 %
    0017 % Author: Catherine Loader
    0018 %
    0019 % NEEDS: m argument to lfplot.
    0020 % Also, lfplot symbols should distinguish between censored and
    0021 % uncensored data points.
    0022
    0023 load heart;
    0024 fit = locfit(surv,'cens',cens,'family','hazard','alpha',0.4,'xlim',[0;10000]);
    0025 figure('Name','fig7_1: Hazard rate for censored data' );
    0026 lfplot(fit);
    0027 xlabel('Survival Time');
    0028 ylabel('Hazard Rate');