image thumbnail
from New Statistics Tools in MATLAB(R) and the Statistics ToolboxTM by Dan Doherty
M-files used in the webinar held on November 18, 2004.

censplot(obstime,censored)
function censplot(obstime,censored)

T = max(obstime);

nfailed = sum(~censored);
nsurvived = sum(censored);

plot([zeros(size(obstime)),obstime]', repmat(1:length(obstime),2,1), ...
     'Color','b','LineStyle','-')
line([T;2*T], repmat(nfailed+(1:nsurvived), 2, 1), 'Color','b','LineStyle',':');
line([T;T], [0;nfailed+nsurvived],'Color','k','LineStyle','-')
text(T,30,'<--Some survive beyond the end of test')
xlabel('Survival time'); ylabel('Observation number')

Contact us at files@mathworks.com