I optimization ()
, or something similar, at least the maximum value / function , I'm unsure about the exact range on which the function should be optimized, which is the required parameter for the function 'opplease' (such as optimize (f = fun, interval = c (lowerbound, upperbound))
).
In the problem of this optimization, I am able to estimate a value a
, which is "close" of the optimal solution, but depends on the "proximity" situation.
Is there a function in R which can use the initial value a
, which is not required to specify the function that the function is optimized?
When you say that you are not sure about the lower limit, I suspect that its This means that the parameters that you are trying to guess are not bound down
If this is the case, then a move is to change the function so that the lower bound on the parameter
This trivial function is minimal on x = 4:
have fun
Through which we can find:
optimization ( F = funny, interval = c (0,8)) # & gt; $ Min # & gt; [1] 4
But for a moment, do not argue that we are not sure whether there is a lower limit or not, and we know that the upper limit is 8. If we try, then an error:
optimization (f = funny, interval = c (-Inf, 8))
Because the boundaries are finite In this situation, we can use the exponential changes ( exp ()
), which, like the map with the positive numbers, the positive numbers like:
optimization (F = function (x) fun (log (x)), interval = exp (c (-inf, 8))) # & gt; $ Min # & gt; [1] 54.59815
And to get root, you just need to change the solution via the following:
log (54.59815) ) # & Gt; 4
If you do not know the upper or lower bound on the underlying parameters, then you can use the log-axis conversion instead of log ():
:
function (x) log (x / (1-x))
and it is inverted in place of Note that log-os conversion unit interval Modes the actual numbers, so the interval parameter becomes There are some numerical limitations in these solutions (for example, if we had defined exp () Code>:
function (y) exp (y) / (1 + exp (y))
0: 1
. interval = exp (c (-inf, 16)) in the first code, then we had an error Must have met). Tip, you can scale these changes again in the center of a given point, which can reduce the numerical limitations.
No comments:
Post a Comment