Likelihood Ratio Test

20 views
Skip to first unread message

Felipe Barletta

unread,
Aug 8, 2016, 8:52:38 PM8/8/16
to Cambridge R user group
Hi dear R users!

I have a dubt about how to calculate the Likelihood Ratio Test:

I have below a density function:


##### Density Gompertz
dG <- function(x,a,b, log=FALSE){
    d2 <- numeric(length(x))
    d2 <- b*exp(a*x)*exp(-b/a*(exp(a*x) - 1))
    dens <- if(log) log(d2) else d2
    return (dens)
}

#### log-likelihood
ldG <- function(par, x)
{
  sum( dG(x, a = par[1], b = par[2], log = TRUE))
}

emv.dG   <- optim(par = c(.15, .01), fn = ldG, x = d1, hessian=TRUE
                 ,control=list("fnscale"=-1))

emv.dG$value # likelihood

How do I calculate the Likelihood Ratio Test without a any package.
LRT = -2*(emv.dG$value - ?????)
Reply all
Reply to author
Forward
0 new messages