R/loglikelihood_local_admkr.R

loglikelihood_local_admkr <- function(h, resid)
{
    b = h[2]
    badj = h[3]
    epsilon = scale(resid)
    std = sd(resid)
    cont = (2.0*pi)^(-0.5)
    logf = vector(,length(resid))
    for(i in 1:length(resid))
    {
        temp = epsilon[i] - epsilon[-i]
        res = sum(cont*exp(-0.5*((temp/(b*(1+badj*abs(epsilon[-i]))))^2))/(b*(1+badj*abs(epsilon[-i]))))
        logf[i] = log(res/length(temp)/std)
    }
    return(sum(logf))			
}

Try the bbefkr package in your browser

Any scripts or data that you put into this service are public.

bbefkr documentation built on May 2, 2019, 3:04 a.m.