# el.test: Empirical likelihood ratio test for the means, uncensored... In emplik: Empirical Likelihood Ratio for Censored/Truncated 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 ```

### Example output

```Loading required package: quantreg

Attaching package: 'SparseM'

The following object is masked from 'package:base':

backsolve

\$`-2LLR`
[1] 1.4959

\$Pval
[1] 0.4733359

\$lambda
[1] 0.16370747 0.05954525

[1]  3.814455e-08 -1.031469e-07

\$hess
[,1]      [,2]
[1,] 57.590072 -9.411123
[2,] -9.411123 54.854378

\$wts
[1] 1.0938250 1.2738451 1.0669185 0.9989470 0.8324758 1.4368976 1.0551255
[8] 1.1775916 0.9117519 0.8813374 0.8280284 1.0179621 1.0461412 0.7790994
[15] 1.0361341 1.0143722 0.8889165 0.8249367 0.7827030 1.0806904 0.9677678
[22] 1.1207849 1.4732085 1.1967321 1.1280005 1.0826161 0.7310015 0.8544029
[29] 0.9920329 0.8845332 1.1816435 0.9656110 0.8414424 0.7905337 1.0025622
[36] 0.9188318 0.9479182 0.7417220 1.2250821 0.9036137 0.8228518 0.7557114
[43] 1.3213910 0.9372755 1.2145213 1.1710812 1.1887490 0.8907115 0.9034953
[50] 0.8164714

\$nits
[1] 4

\$`-2LLR`
[1] 0.7072538

\$Pval
[1] 0.400357

\$lambda
[1] 0.04691874

[1] -1.294647e-15

\$hess
[,1]
[1,] 345.9248

\$wts
[1] 1.2630322 1.0986891 0.9748913 0.9726342 0.9957298 1.2072389 0.9961728
[8] 1.1188140 0.8840956 0.8866232 0.9400486 1.0657325 1.0455518 0.9844367
[15] 0.9495881 1.0109925 0.9163291 0.9021504 0.9801274 1.0506449 0.8724263
[22] 1.0147955 1.2591159 1.0868785 1.1261789 1.4632319 0.9203709 0.8064722
[29] 0.9323382 0.9278363 1.0529094 0.9620706 0.8645996 0.9186668 0.9859657
[36] 0.8618430 0.8024267 0.8839918 1.0825990 0.8802598 0.9121091 0.9283928
[43] 1.0945092 1.1226222 1.0026974 0.9993862 1.1051442 0.9690086 1.0475848
[50] 0.8700456

\$nits
[1] 5

\$`-2LLR`
[1] 1.805702

\$Pval
[1] 0.1790247

\$lambda
[1] 0.01078493

[1] 3.256062e-08

\$hess
[,1]
[1,] 28962.89

\$wts
[1] 0.8770359 2.7496028 0.8688180 0.8607526 0.8939472 0.8854108 0.9298048
[8] 0.9205734 0.8374306 0.9893301 0.9115235 0.8688180 0.9115235 0.7876352
[15] 0.9392232 0.8528356 0.8299349 1.2245056 0.9026498 0.9586443

\$nits
[1] 7
```

emplik documentation built on Aug. 18, 2018, 1:05 a.m.