https://github.com/cran/emplik
Tip revision: e0c87611101332336f61f0dcb7062c3a309fa130 authored by Mai Zhou on 11 October 2013, 00:00:00 UTC
version 0.9-9
version 0.9-9
Tip revision: e0c8761
findUL.R
findUL <- function (step = 0.01, initStep = 0, fun, MLE, level = 3.84,
...)
{
value <- 0
step1 <- step
Lbeta <- MLE - initStep
for (i in 1:8) {
while (value < level) {
Lbeta <- Lbeta - step1
value <- fun(theta = Lbeta, ...)$"-2LLR"
}
Lbeta <- Lbeta + step1
step1 <- step1/10
value <- fun(theta = Lbeta, ...)$"-2LLR"
}
value1 <- value
value <- 0
Ubeta <- MLE + initStep
for (i in 1:8) {
while (value < level) {
Ubeta <- Ubeta + step
value <- fun(theta = Ubeta, ...)$"-2LLR"
}
Ubeta <- Ubeta - step
step <- step/10
value <- fun(theta = Ubeta, ...)$"-2LLR"
}
if ( (value1>level)|(value>level) ) warning("Something wrong. Check the MLE and step inputs.")
return(list(Low = Lbeta, Up = Ubeta, FstepL = step1, FstepU = step,
Lvalue = value1, Uvalue = value))
}