$$\hat S(t) = \prod_{t_i \le t}(1 - d_i / n_i)$$ with Greenwood's variance $$\widehat{Var}[\hat S(t)] = \hat S(t)^2 \sum d_i / (n_i (n_i - d_i)).$$
Usage
morie_km_native(time, event, alpha = 0.05, conf_type = c("log-log", "plain"))Value
A list with times, survival, se, ci_lower, ci_upper,
at_risk, events, median, rmst, tail_reliable.
Details
Censored observations leave the risk set without producing a drop, which is how partial information is used rather than discarded. The assumption that buys it is INDEPENDENT censoring: those censored at \(t\) must carry the same future risk as those still observed. Informative censoring biases the curve and leaves no trace in the data.
Intervals are on the log-log scale by default. A linear interval can leave [0, 1], and does so exactly in the tails, where the estimate is least precise.
References
Kaplan EL, Meier P (1958) JASA 53:457-481. Greenwood M (1926). Kalbfleisch & Prentice (2002), Sec 1.4.
Examples
morie_km_native(time = c(1, 2, 3, 4, 5, 6, 7, 8), event = c(0, 1, 0, 1, 1, 0, 1, 0))
#> $times
#> [1] 2 4 5 7
#>
#> $survival
#> [1] 0.8571429 0.6857143 0.5142857 0.2571429
#>
#> $se
#> [1] 0.1322600 0.1862942 0.2038693 0.2084512
#>
#> $ci_lower
#> [1] 0.33405388 0.21279741 0.11775958 0.01258426
#>
#> $ci_upper
#> [1] 0.9785611 0.9121118 0.8132486 0.6560160
#>
#> $at_risk
#> [1] 7 5 4 2
#>
#> $events
#> [1] 1 1 1 1
#>
#> $median
#> [1] 7
#>
#> $rmst
#> [1] 5.428571
#>
#> $tail_reliable
#> [1] FALSE FALSE FALSE FALSE
#>
#> $conf_type
#> [1] "log-log"
#>
#> $n_events
#> [1] 4
#>
#> $n_censored
#> [1] 4
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Kaplan-Meier product-limit estimator (native)"
#>
