\(\(\(<< Statistics`ContinuousDistributions`\)\(
\)
    \) (*
edist[a_] = \(ExponentialDistribution[
          a]

        n = \(100

          X = \(RandomArray[edist[1], \ n]

            Y = \(RandomArray[edist[1], n]

              T = \({X, Y}

                TT = \(Transpose[T]

                  Z = \(Map[Min, TT]

                    Diff = \(Y - X

                      
                      Delta = \(Map[UnitStep, \ 
                          Diff]


                        
                        Data = \(Transpose[{Delta, 
                              Z}]


                          
                          Data1 = 
                            ReadList["time-to-decision-data-2002", 
                              Number, 
                              RecordLists -> 
                                True]\)\)\)\)\)\)\)\)\)\)
*) \)
\(Data1 = {{1, 143}, {1, 164}, \ \ {1, \ 188}, \ {1, 188}, \ {1, 
          190}, {1, \ 192}, \ {1, 206}, \ {1, \ 209}, \ {1, \ 213}, \ {1, \ 
          216}, 
{1, 220}, \ {1, \ 227}, \ {1, 230}, {1, \ 234}, \ {1, \ 
          246}, \ {1, \ 265}, {1, 304}, \ {0, \ 216}, \ {0, \ 
          244}}\)
n = Length[Data1]
Z = Transpose[Data1][[2]]
Delta = Transpose[Data1][[1]]

    
OrderedDat = 
      Transpose[{Delta[[Ordering[Z]]], Sort[Z]}]

    
OZ = Transpose[OrderedDat][[2]]
OZZ = Prepend[OZ, 0]
OD = Transpose[OrderedDat][[1]]
HUC = 
      Table[
Sum[
          OD[[i]]*UnitStep[OZ[[j]] - OZ[[i]]], {i, 1, n}], {j, 1, 
          n}]
HUCC = Prepend[HUC, 0]
JHUC = 
      Table[HUCC[[i]] - HUCC[[i - 1]], {i, 2, 
          n + 1}]
R = 
      Table[Sum[UnitStep[OZ[[i]] - OZ[[j]]], {i, 1, n}], {j, 1, 
          n}]
KM = 
      Table[Product[1 - JHUC[[i]]/R[[i]], {i, 1, j}], {j, 1, 
          n}]
CumH = 
      Table[Sum[JHUC[[i]]/R[[i]], {i, 1, j}], {j, 1, 
          n}]
Cest = 
      Table[Sum[JHUC[[i]]/R[[i]]^2, {i, 1, j}], {j, 1, 
          n}]
Cest2 = 
      Table[Sum[
          JHUC[[i]]/(R[[i]]*(R[[i]] - 
                    JHUC[[i]])), {i, 1, j}], {j, 1, 
          n}]
Print["First variance estimate"]
VarHat = 
      Table[KM[[j]]^2*Cest[[j]], {j, 1, 
          n}]
Print["Second variance estimate"]
VarHat2 = 
      Table[KM[[j]]^2*Cest2[[j]], {j, 1, 
          n}]
Print["Kaplan-Meier survival estimator"]
KMM = Prepend[KM, 1]
Print["Numerical evaluation of Kaplan-Meier estimator"]
N[KMM]
Print["Numerical evaluation of 1st C estimator"]
N[Cest]
Print["Numerical evaluation of 2nd C estimator"]
N[Cest2]
Print["Numerical evaluation of 1st variance estimator"]
N[VarHat]
Print["Numerical evaluation of 2nd variance estimator"]
N[VarHat2]

S[t_] := 
      Sum[KMM[[i]]*UnitStep[t - OZZ[[i]]]*
          UnitStep[OZZ[[i + 1]] - t], {i, 1, 
          n}]
P1 = 
      Plot[S[t], {t, 0, 375}]
 (*
P2 = 
        Plot[1 - CDF[edist[1], t], {t, 0, 4}]
Show[P1, 
            P2]
*)

{0.0026242892549934393`, 0.0049569908149876074`, 0.00874763084997813`, 
      0.00874763084997813`, 0.010205569324974486`, 0.01137192010497157`, 
      0.012246683189969384`, 0.012829858579967926`, 0.013121446274967197`, 
      0.013121446274967197`, 0.013121446274967197`, 0.013113757927540458`, 
      0.012639643169558245`, 0.011699102001020556`, 0.010292134421927395`, 
      0.010292134421927395`, 0.008729406619040677`, 0.0052986951450648785`, 
      Indeterminate}

<< Statistics`ContinuousDistributions`
edist[a_] = ExponentialDistribution[a]
n = 
      8
  
X = {1, 2, 2, 3, 4, 5, 5, 6}
Y = {2, 3, 3, 2, 5, 6, 7, 8}
T = {X, Y}
TT = Transpose[T]
Z = Map[Min, TT]
Diff = Y - X
Delta = Map[UnitStep,  Diff]
Data = Transpose[{Z, Delta}]
OrderedDat = 
      Transpose[{Sort[Z], 
          Delta[[Ordering[Z]]]}]
OZ = Transpose[OrderedDat][[1]]
OZZ = Prepend[OZ, 0]
OD = Transpose[OrderedDat][[2]]
HUC = 
      Table[
Sum[
          OD[[i]]*UnitStep[OZ[[j]] - OZ[[i]]], {i, 1, n}], {j, 1, 
          n}]
HUCC = Prepend[HUC, 0]
JHUC = 
      Table[HUCC[[i]] - HUCC[[i - 1]], {i, 2, 
          n + 1}]
R = 
      Table[Sum[UnitStep[OZ[[i]] - OZ[[j]]], {i, 1, n}], {j, 1, 
          n}]
KM = 
      Table[Product[1 - JHUC[[i]]/R[[i]], {i, 1, j}], {j, 1, 
          n}]
KMM = Prepend[KM, 1]

S[t_] := 
      Sum[KMM[[i]]*UnitStep[t - OZZ[[i]]]*
          UnitStep[OZZ[[i + 1]] - t], {i, 1, 
          n}]
Plot[S[t], {t, 0, 9}]