The basic problem is that holling() is not a (negative) loglikelihood function.
nll() _is_ a negative loglikelihood, but it is not clear for what. You appear
to be very confused as to what a likelihood even is (what is k? apparently your
response variable? Then how can it be a scalar if X is a
Addendum:
the optimization actually got a worse outcome than the original
eyeball estimation:
```
actual <- c(8, 24, 39, 63, 89, 115, 153, 196, 242, 287,
344, 408, 473,
546, 619, 705, 794, 891, 999, 1096, 1242, 1363,
1506, 1648, 1753,
1851,
No, I got the same. I reckon the problem is with X: this was I scalar,
I was providing a vector with the actual values.
Ho can mle2 optimize without knowing what are the actual data? and
what values should I give for X?
Thank you
On Tue, Jun 30, 2020 at 2:06 PM Eric Berger wrote:
>
> I have no
I have no problem with the following code:
library(bbmle)
holling <- function( a, b, x ) {
a*x^2 / (b^2 + x^2)
}
A=3261
B=10
X=30
foo <- mle2( minuslogl=holling, start=list(a=A,b=B,x=X) )
foo
# Call:
# mle2(minuslogl = holling, start = list(a = A, b = B, x = X))
# Coefficients:
#a
Sorry for the typo, but I have the same error if using b instead of h:
```
> O = mle2(minuslogl = holling, start = list(a = A, b = B))
> Error in minuslogl(a = 3261, b = 10) :
argument "x" is missing, with no default
# let's add x
X = c(8, 24, 39, 63, 89, 115, 153, 196, 242, 287,
Hi Luigi,
I took a quick look.
First error:
You wrote
O = mle2(minuslogl = holling, start = list(a = A, h = B, x = X))
it should be b=B (h is not an argument of holling())
The error message gave very precise information!
Second error:
You wrote
O = mle2(minuslogl = nll, start = list(a = A, h =
Hello,
I would like to optimize the function:
```
holling = function(a, b, x) {
y = (a * x^2) / (b^2 + x^2)
return(y)
}
```
I am trying to use the function mle2 from bbmle, but how do I need to
feed the data?
If I give `holling` as function to be optimized, passing the starting
values for `a`,
7 matches
Mail list logo