fig7_6.m 618 B

1234567891011121314151617181920212223
  1. % Local Regression and Likelihood, Figure 7.6.
  2. %
  3. % Estimating the mean survival time using a local weibull
  4. % (transformed Gamma) model.
  5. load heart;
  6. z = 0.625;
  7. ts = (surv+0.5).^z;
  8. fit = locfit(age,ts,'cens',cens,'family','gamma','nn',0.8);
  9. i = find(cens==0);
  10. figure('Name','fig7_6: mean survival time local weibull');
  11. plot(age(i),log(surv(i)+0.5),'o');
  12. hold on;
  13. i = find(cens==1);
  14. plot(age(i),log(surv(i)+0.5),'r+');
  15. xlabel('Age at Transplant (Years)');
  16. ylabel('log(0.5+Survival Time (Days))');
  17. xev = lfmarg(fit);
  18. y = predict(fit,xev);
  19. plot(xev{1},log(exp(y./z)*gamma(1+1./z)+0.5));
  20. hold off;