# fig7_6

## PURPOSE

Local Regression and Likelihood, Figure 7.6.

## SYNOPSIS

This is a script file.

## DESCRIPTION

     Local Regression and Likelihood, Figure 7.6.

     Estimating the mean survival time using a local weibull
     (transformed Gamma) model.

## CROSS-REFERENCE INFORMATION

This function calls:

- lfmarg computes grid margins from a locfit object, used for plotting.
- locfit Smoothing noisy data using Local Regression and Likelihood.
- predict Interpolate a fit produced by locfit().

This function is called by:

- runbook

## SOURCE CODE

    0001 % Local Regression and Likelihood, Figure 7.6.
    0002 %
    0003 % Estimating the mean survival time using a local weibull
    0004 % (transformed Gamma) model.
    0005
    0006 load heart;
    0007 z = 0.625;
    0008 ts = (surv+0.5).^z;
    0009 fit = locfit(age,ts,'cens',cens,'family','gamma','nn',0.8);
    0010 i = find(cens==0);
    0011 figure('Name','fig7_6: mean survival time local weibull');
    0012 plot(age(i),log(surv(i)+0.5),'o');
    0013 hold on;
    0014 i = find(cens==1);
    0015 plot(age(i),log(surv(i)+0.5),'r+');
    0016 xlabel('Age at Transplant (Years)');
    0017 ylabel('log(0.5+Survival Time (Days))');
    0018
    0019 xev = lfmarg(fit);
    0020 y = predict(fit,xev);
    0021 plot(xev{1},log(exp(y./z)*gamma(1+1./z)+0.5));
    0022 hold off;
    0023