0001
0002
0003
0004
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