I am attempting to use optim() in R to solve for lambda in the following equation:
lambda/sigma^2 - ln(lambda/sigma^2) = 1 + 1/Q
subject to constraint :
lambda > sigma^2.
I am not sure how one goes about setting up this in R.
I am open to alternative optimization routines as well although the equation seems convex and therefore optim should be a fine choice.
Thank you!
?optimfor one-dimensional problemsoptimize()is recommended instead. And when you say "solve for lambda", is there an equality (or inequality) missing from your equation? Or do you want to minimize or maximize your expression? - Gregor Thomas