Hi Everyone, I'm trying to write selfStart non-linear models for use with nls. In these models some combinations of parameter values are illegal; the function value is undefined.
That's OK when calling the function directly [e.g. SSmodel(x, pars...)]; I return an appropriate non-value such as NA or Inf. However, when called from nls [e.g. nls(y~SSmodel(x, pars...), ...)] those non-values lead to errors such as (but not limited to): Error in numericDeriv(form[[3L]], names(ind), env) : Missing value or an infinity produced when evaluating the model or (if I provide a gradient attribute) Error in qr.default(.swts * attr(rhs, "gradient")) : NA/NaN/Inf in foreign function call (arg 1) I can't see a way of making nls either stick to legal parameter values, or accept NA/NaN/Inf as indicating "bad" parameter values. I really do want to use nls rather than a bounded optimisation tool (such as optim) because this fits into a much bigger picture predicated on nls. I'd appreciate any suggestions. Keith Jewell ---------------- > sessionInfo() R version 2.9.1 (2009-06-26) i386-pc-mingw32 locale: LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] xlsReadWrite_1.3.3 svSocket_0.9-43 svMisc_0.9-48 TinnR_1.0.3 R2HTML_1.59-1 Hmisc_3.6-1 loaded via a namespace (and not attached): [1] cluster_1.12.0 grid_2.9.1 lattice_0.17-25 stats4_2.9.1 VGAM_0.7-9 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.