# gLRT: Compute the generalized Likelihood Ratio Test In TOHM: Testing One Hypothesis Multiple Times

## Description

Compute the generalized Likelihood Ratio Test (LRT) for a specified value of the nuisance parameter.

## Usage

 `1` ```gLRT(theta, mll, x, init, lowlim, uplim, null0) ```

## Arguments

 `theta` A vector or scalar of the value of the nuisance parameter with respect to which the LRT is computed. `mll` A function specifying the negative (profile) log-likelihood. See details. `x` A vector or matrix collecting the data. `init` A vector or scalar of initial values for the MLE. `lowlim` A vector or scalar of lower bounds for the MLE. `uplim` A vector or scalar of upper bounds for the MLE. `null0` A vector or scalar of the free parameters under the null hypothesis. See details.

## Details

`mll` takes as first argument the vector of the parameters for which the MLE is generated. Other arguments of `mll` are the data vector or matrix (`x`) and a scalar or vector corresponding to the fixed value for the nuisance parameter with respect to which the profilying is computed (`theta`, see `gLRT`). If the latter is a vector it must be of same length of the rows in `THETA`. If the null model has nuisance parameters, `null0` takes as arguments the values of the parameters being tested under the null hypothesis, followed by the estimates of the nuisance parameters obtained assuming that the null hypothesis is true.

## Value

The value of the generalized LRT for a specified value of `theta`.

Sara Algeri

## References

S. Algeri and D.A. van Dyk. Testing one hypothesis multiple times: The multidimensional case. arXiv:1803.03858, submitted to the Journal of Computational and Graphical Statistics, 2018.

A.C. Davison. Statistical models, volume 11. Cambridge University Press, 2003.

`find_max`, `TOHM_LRT`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19``` ```#generating data of interest N<-100 x<-as.matrix(cbind(runif(N*2,172.5,217.5),runif(N*2,-2,58))) x2<-x[(x[,1]<=217.5)&(x[,1]>=172.5),] x_sel<-x2[(x2[,2]<=(28+sqrt(30^2-(x2[,1]-195)^2)))&(x2[,2]>=(28- sqrt(30^2-(x2[,1]-195)^2))),] data<-x_sel[sample(seq(1:(dim(x_sel)[1])),N),] #Specifying minus-log-likelihood kg<-function(theta){integrate(Vectorize(function(x) { exp(-0.5*((x-theta[1])/0.5)^2)*integrate(function(y) { exp(-0.5*((y-theta[2])/0.5)^2) }, 28-sqrt(30^2-(x-195)^2), 28+sqrt(30^2-(x-195)^2))\$value}) , 172.5, 217.5)\$value} mll<-function(eta,x,theta){ -sum(log((1-eta)/(pi*(30)^2)+eta*exp(-0.5*((x[,1]- theta[1])/0.5)^2- 0.5*((x[,2]-theta[2])/0.5)^2)/kg(theta)))} gLRT(theta=c(200,30),mll=mll,init=0.1,lowlim=0,uplim=1,null0=0,x=data) ```

### Example output

```[1] 0
```

TOHM documentation built on March 10, 2021, 1:05 a.m.