Compute the Kaplan-Meier estimate of the cumulative distribution function (cdf) for simulated survival data.

Generate survival data from a Weibull distribution with parameters 3 and 1.

Compute the Kaplan-Meier estimate of the cdf for survival data.

ans =
0 0.0895
0.0667 0.0895
0.1333 0.1072
0.2000 0.1303
0.2667 0.1313
0.3333 0.2718
0.4000 0.2968
0.4667 0.6147
0.5333 0.6684
0.6000 1.3749
0.6667 1.8106
0.7333 2.1685
0.8000 3.8350
0.8667 5.5428
0.9333 6.1910
1.0000 6.9825

Plot the estimated cdf.

Compute and plot the hazard function of simulated right-censored survival data.

Generate failure times from a Birnbaum-Saunders distribution.

Assuming that the end of the study is at time 0.9, generate a logical array that indicates simulated failure times that are larger than 0.9 as censored data, and store this information in a vector.

Plot the empirical hazard function for the data.

Generate right-censored survival data and compare the empirical cumulative distribution function (cdf) with the known cdf.

Generate failure times from an exponential distribution with mean failure time of 15.

Generate drop-out times from an exponential distribution with mean failure time of 30.

Generate the observed failure times. They are the minimum of the generated failure times and the drop-out times.

Create a logical array that indicates generated failure times that are larger than the drop-out times. The data for which this is true are censored.

Compute the empirical cdf and confidence bounds.

Plot the cdf and confidence bounds.

Superimpose a plot of the known population cdf.

Generate survival data and plot the empirical survivor function with 99% confidence bounds.

Generate lifetime data from a Weibull distribution with parameters 100 and 2.

Plot the survivor function for the data with 99% confidence bounds.

Fit the Weibull survivor function.

The survivor function based on the actual distribution is within the confidence bounds.