[R] [R-pkgs] ForecastTB package on CRAN

2020-06-30 Thread Neeraj Dhanraj
Hi All, I am glad to share a new R package, named 'ForecastTB'. It is an automated testbench to compare the performance of forecasting methods for univariate time series. The details are as follows: CRAN: https://CRAN.R-project.org/package=ForecastTB

Re: [R] argument "x" is missing in minpack.lm

2020-06-30 Thread Stephen Ellison
Ivan Krylov [krylov.r...@gmail.com] said: > Instead you can either close over X: > > X <- c(...) > holly <- function(p) (p$a * X^2) / (p:b^2 + X^2) > # function holly now "contains" the vector X That would not be an accurate statement as written. The function only contains an unevaluated call

Re: [R] argument "x" is missing in minpack.lm

2020-06-30 Thread Ivan Krylov
(Adding R-help back to Cc:) On Tue, 30 Jun 2020 14:44:29 +0200 Luigi Marongiu wrote: > Ok, I tried with: > ``` > holly <- function(p) { > y = (p$a * p$x^2) / (p$b^2 + p$x^2) > return(y) > } > X = 1:60 > A = 3261 > B = 10 > X = c(8, 24, 39, 63, 89, 115, 153, 196, 242, 287,

Re: [R] How to use mle2 function?

2020-06-30 Thread Luigi Marongiu
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,

Re: [R] How to use mle2 function?

2020-06-30 Thread Luigi Marongiu
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

Re: [R] How to use mle2 function?

2020-06-30 Thread Eric Berger
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

Re: [R] argument "x" is missing in minpack.lm

2020-06-30 Thread Ivan Krylov
On Tue, 30 Jun 2020 13:53:10 +0200 Luigi Marongiu wrote: > function(a, b, x) { > y = (a * x^2) / (b^2 + x^2) > return(y) > } Take a look at the examples in ?nls.lm. The first argument of the function must be the parameter list/vector; the rest of the arguments are passed from ... in nls.lm

Re: [R] How to use mle2 function?

2020-06-30 Thread Luigi Marongiu
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,

Re: [R] argument "x" is missing in minpack.lm

2020-06-30 Thread Luigi Marongiu
But I get the same error even if I run: ``` parms = list(a=3261, b=10, x=CH$Cum_Dead[1:60]) O = nls.lm(parms, holling, lower=NULL, upper=NULL, jac = NULL) > Error in fn(par, ...) : argument "x" is missing, with no default ``` the function to be optimized is: ``` function(a, b, x) { y

Re: [R] argument "x" is missing in minpack.lm

2020-06-30 Thread Sarah Goslee
You create objects A, B, and K, but then use A, B, and X in the call to nls.lm(). I have no idea if nls.lm is the right tool for your job, but I do know that you need to use the same names. Sarah On Tue, Jun 30, 2020 at 6:01 AM Luigi Marongiu wrote: > Hello, > I am trying to optimize a

Re: [R] How to use mle2 function?

2020-06-30 Thread Eric Berger
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 =

[R] argument "x" is missing in minpack.lm

2020-06-30 Thread Luigi Marongiu
Hello, I am trying to optimize a function with the function nls.lm from the package minpack.lm. But I can't get it right: ``` A = 3261 B = 10 K = 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,

[R] How to use mle2 function?

2020-06-30 Thread Luigi Marongiu
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`,

Re: [R] version plot problem

2020-06-30 Thread Martin Maechler
> PIKAL Petr > on Thu, 25 Jun 2020 14:45:09 + writes: > Thanks. > I try to spread R to some other people and I use 4.0.0 - version.string R > Under development (unstable) (2020-03-08 r77917) nickname Unsuffered > Consequences whereas they use R 3.6.3 >