[R] invalid type (list) for variable 'y' in library minpack.lm

Rasmus Liland jr@| @end|ng |rom po@teo@no
Thu Jun 25 13:24:23 CEST 2020


Dear Luigi,

On 2020-06-25 12:18 +0200, Luigi Marongiu wrote:
> Hello,
> I am trying to find the best fit to a 
> function for epidemic analysis.
> I am trying with the package minpack.lm but 
> I don't really know how to use it.

Me neither ...

> So I have some questions:
> - how to solve the list problem? (what is 
>   the input for nlsLM? I have a vector with 
>   the actual values, shall I convert in a 
>   dataframe?)

I got past the error by give 
minpack.lm::nlsLM X and Y in a data.frame

	minpack.lm::nlsLM(
	  formula = y~(a*x^2)/(b^2 + x^2),
	  start=c(a=A, b=B),
	  data=data.frame(x=X, y=Y))

as per ?minpack.lm::nlsLM:

	data: an optional data frame in which to evaluate the variables
	      in‘formula’ and ‘weights’.  Can also be a list or an
	      environment, but not a matrix.

> - how to avoid infinitives?
> - is there another function other than 
>   nlsLM that I should use?
> - is there another function that could fit 
>   a sigmoid profile other than Holling type 
>   III?

These other questions seem good and 
interesting, I hope someone else can answer 
them.

Best,
Rasmus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200625/0684db7f/attachment.sig>


More information about the R-help mailing list