Hi,

I would like to write a function that finds parameters of a log-normal
distribution with a 1-alpha CI of (x_lcl, x_ucl):

However, I don't know how to optimize for the two unknown parameters.

Here is my unsuccessful attempt to find a lognormal distribution with
a 90%CI of 1,20:

prior <- function(x_lcl, x_ucl, alpha, mean, var) {
  a <- (plnorm(x_lcl, mean, var) - (alpha/2))^2
  b <- (plnorm(x_ucl, mean, var) - (1-alpha/2))^2
  return(a+b)
  }

optimize(fn=prior, interval = c(-5, 100), 1, 20)

I understand that this problem has a closed form solution, but I would
like to make this a general function.

Thanks,

David

-- 
David LeBauer, PhD
Energy Biosciences Institute
University of Illinois Urbana-Champaign
1206 W. Gregory Drive
Urbana, ILĀ  61801, U.S.A.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to