Use empirical likelihood ratio and Wilks theorem to test the null hypothesis that

*\int f(t) dH(t) = θ *

with right censored, left truncated data.
Where *H(t)* is the unknown
cumulative hazard
function; *f(t)* can be any given
function and
*θ* a given constant. In fact, *f(t)* can even be data
dependent, just have to be ‘predictable’.

1 | ```
emplikH1.test(x, d, y= -Inf, theta, fun, tola=.Machine$double.eps^.5)
``` |

`x` |
a vector of the censored survival times. |

`d` |
a vector of the censoring indicators, 1-uncensor; 0-censor. |

`y` |
a vector of the observed left truncation times. |

`theta` |
a real number used in the |

`fun` |
a left continuous (weight) function used to calculate
the weighted hazard in |

`tola` |
an optional positive real number specifying the tolerance of iteration error in solve the non-linear equation needed in constrained maximization. |

This function is designed for the case where the true distributions are all continuous. So there should be no tie in the data.

The log empirical likelihood used here is the ‘Poisson’ version empirical likelihood:

*
∑_{i=1}^n δ_i \log (dH(x_i)) - [ H(x_i) - H(y_i) ] ~.
*

If there are ties in the data that are resulted from rounding,
you may break the tie by adding a different tiny number to the tied
observation(s). If those are true ties
(thus the true distribution is discrete)
we recommend use `emplikdisc.test()`

.

The constant `theta`

must be inside the so called
feasible region for the computation to continue. This is similar to the
requirement that in testing the value of the mean, the value must be
inside the convex hull of the observations.
It is always true that the NPMLE values are feasible. So when the
computation complains that there is no hazard function satisfy
the constraint, you should try to move the `theta`

value closer
to the NPMLE. When the computation stops prematurely,
the -2LLR should have value infinite.

A list with the following components:

`times` |
the location of the hazard jumps. |

`wts` |
the jump size of hazard function at those locations. |

`lambda` |
the Lagrange multiplier. |

`"-2LLR"` |
the -2Log Likelihood ratio. |

`Pval` |
P-value |

`niters` |
number of iterations used |

Mai Zhou

Pan, X. and Zhou, M. (2002),
“Empirical likelihood in terms of hazard for censored data”.
*Journal of Multivariate Analysis* **80**, 166-188.

1 2 3 4 | ```
fun <- function(x) { as.numeric(x <= 6.5) }
emplikH1.test( x=c(1,2,3,4,5), d=c(1,1,0,1,1), theta=2, fun=fun)
fun2 <- function(x) {exp(-x)}
emplikH1.test( x=c(1,2,3,4,5), d=c(1,1,0,1,1), theta=0.2, fun=fun2)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.