I apologize if this question is dumb as all get out.
I want to leverage R's mle2() function to find optimum parameters to a particular statistical function; I presume it does so using gradient descent? So I've got my call like this:
r = mle2(minuslogl = likelihood,
start = list(a1=0.1,b1=0.1,x01=0.1,d2=0.1,b2=0.1,x02=0.1,c=1),
data = list(values=v,data=d))
Where my likelihood function specifically needs a1, b1, d2 and b2 to be within the range [0,1] (the real numbers between 0 and 1). If mle2() uses gradient descent, I'm assuming it starts moving the mentioned parameters into the negative range during its optimization phase - but I want it to specifically not do that, I want it to search the parameters between 0 and 1.
Is there a way? Am I being really ignorant here?
Thanks in advance.
I found the answer. There is documentation for what I want; though I wasn't able to find what I wanted immediately in the pages I was viewing.
There are literally lower and upper parameters to the mle2() function.
Examples can be found here:
http://www.inside-r.org/packages/cran/bbmle/docs/mle2
Here is a functioning example of what to do:
r = mle2(minuslogl = likelihood,
start = list(x01=0.1,x02=0.1, c=1, a1=.1, b1=.1, d2=.1, b2=.1),
data = list(values=v,data=d),
lower = c(a1=0,b1=0,d2=0,b2=0),
upper = c(a1=1,b1=1,d2=1,b2=1),
method="L-BFGS-B")
This bounds the a1, b1, d2, and b2 variables and also gives them starting values for the gradient descent method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With