# el.test: Empirical likelihood ratio test for the means, uncensored data

### Description

Compute the empirical likelihood ratio with the mean vector fixed at mu.

The log empirical likelihood been maximized is

∑_{i=1}^n \log Δ F(x_i).

### Usage

 ```1 2``` ```el.test(x, mu, lam, maxit=25, gradtol=1e-7, svdtol = 1e-9, itertrace=FALSE) ```

### Arguments

 `x` a matrix or vector containing the data, one row per observation. `mu` a numeric vector (of length ` = ncol(x)`) to be tested as the mean vector of `x` above, as H_0. `lam` an optional vector of length ` = length(mu)`, the starting value of Lagrange multipliers, will use 0 if missing. `maxit` an optional integer to control iteration when solve constrained maximization. `gradtol` an optional real value for convergence test. `svdtol` an optional real value to detect singularity while solve equations. `itertrace` a logical value. If the iteration history needs to be printed out.

### Details

If `mu` is in the interior of the convex hull of the observations `x`, then `wts` should sum to `n`. If `mu` is outside the convex hull then `wts` should sum to nearly zero, and `-2LLR` will be a large positive number. It should be infinity, but for inferential purposes a very large number is essentially equivalent. If mu is on the boundary of the convex hull then `wts` should sum to nearly k where k is the number of observations within that face of the convex hull which contains mu.

When `mu` is interior to the convex hull, it is typical for the algorithm to converge quadratically to the solution, perhaps after a few iterations of searching to get near the solution. When `mu` is outside or near the boundary of the convex hull, then the solution involves a `lambda` of infinite norm. The algorithm tends to nearly double `lambda` at each iteration and the gradient size then decreases roughly by half at each iteration.

The goal in writing the algorithm was to have it “fail gracefully" when `mu` is not inside the convex hull. The user can either leave `-2LLR` “large and positive" or can replace it by infinity when the weights do not sum to nearly n.

### Value

A list with the following components:

 `-2LLR` the -2 loglikelihood ratio; approximate chisq distribution under H_o. `Pval` the observed P-value by chi-square approximation. `lambda` the final value of Lagrange multiplier. `grad` the gradient at the maximum. `hess` the Hessian matrix. `wts` weights on the observations `nits` number of iteration performed

### Author(s)

Original Splus code by Art Owen. Adapted to R by Mai Zhou.

### References

Owen, A. (1990). Empirical likelihood ratio confidence regions. Ann. Statist. 18, 90-120.

### Examples

 ```1 2 3 4 5 6 7``` ```x <- matrix(c(rnorm(50,mean=1), rnorm(50,mean=2)), ncol=2,nrow=50) el.test(x, mu=c(1,2)) ## Suppose now we wish to test Ho: 2mu(1)-mu(2)=0, then y <- 2*x[,1]-x[,2] el.test(y, mu=0) xx <- c(28,-44,29,30,26,27,22,23,33,16,24,29,24,40,21,31,34,-2,25,19) el.test(xx, mu=15) #### -2LLR = 1.805702 ```

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

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