Is there any package that automatically fits a curve using many simple models?
By simple models I mean:
- ax+b
- ax^2+bx+c
- a*log(x) + b
- a*x^n+b
- ax/(1+bx)
- ax^n/(1+bx^n)
- …
The best would be to have a function that takes two vector parameters X and Y and returns a list of fitted simple models with their SSE.
Try this.
rhsis a character vector of right sides andxandyare the data. It constructs the formulafofor each and then extracts the parameters and sets each to 1 for the starting value. Finally it runsnlsand returns the SSEs sorted so that the result is a vector of SSE’s named via the right hand sides. Ifverbose=TRUE(which it is by default) then it also displays the output from each fit.