# KMest: Kaplan-Meier Estimate In NPHazardRate: Nonparametric Hazard Rate Estimation

## Description

Custom implementation of the Kaplan Meier estimate. The major difference with existing implementations is that the user can specify exactly the grid points where the estimate is calculated. The implementation corresponds to 1-\hat H(x) of Hua, Patil and Bagkavos (2018), and is used mainly for estimation of the censoring distribution.

## Usage

 1 KMest(xin, cens, xout) 

## Arguments

 xin A vector of data points xout The point at which the estimates should be calculated. cens Censoring Indicators.

## Details

Calculates the well known Kaplan-Meier estimate

1-\hat H(x) = 1, 0 ≤q x ≤q X_{(1)}

or

1-\hat H(x) = ∏_{i=1}^{k-1} ≤ft ( \frac{n-i+1}{n-i+2} \right )^{1-δ_{(i)}}, X_{(k-1)} <x ≤q X_{(k)}, k=2,…,n

or

1-\hat H(x) = ∏_{i=1}^{n} ≤ft ( \frac{n-i+1}{n-i+2} \right )^{1-δ_{(i)}}, X_{(n)}<x.

The implementation is mainly for estimating the censoring distribution of the available sample.

## Value

A vector with the Kaplan-Meier estimate at xout.

## Examples

  1 2 3 4 5 6 7 8 9 10 11 x<-seq(0, 5,length=100) #design points where the estimate will be calculated SampleSize<-100 #amount of data to be generated ti<- rweibull(SampleSize, .6, 1) # draw a random sample ui<-rexp(SampleSize, .2) # censoring sample cat("\n AMOUNT OF CENSORING: ", length(which(ti>ui))/length(ti)*100, "\n") x1<-pmin(ti,ui) # observed data cen<-rep.int(1, SampleSize) # initialize censoring indicators cen[which(ti>ui)]<-0 # 0's correspond to censored indicators arg1<- KMest(x1, cen, x) plot(x, arg1, type="l") 

NPHazardRate documentation built on May 2, 2019, 10:24 a.m.