Hello, I am trying to solve a function that is relevant to utility theory and cannot for the life of me figure out how to do it in R. Essentially i am trying to write code that solves this equation:
where UTIL is a function that is represented by UTIL(X,r) = -EXP(-X/r)
I am eventually trying to write a function that takes 3 parameters H,L and C and solves for r. This is an attempt to reverse code a function that is available in the simtools excel add-in called RISKTOL.
The function in R will look something like this risktol(H,L,C) and accept the H,L and C parameters from the above function. I have looked into options using uniroot() and optim() but cannot figure out how to put together a solution that can be generalized. Any tips or pointers to documentation would be greatly appreciated!
Thank you RStudio Community