An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110612/a88e301b/attachment.pl>
Error in NLS example in the documentation
2 messages · Diviya Smith, Peter Dalgaard
On Jun 12, 2011, at 20:25 , Diviya Smith wrote:
Hello there, I am trying to use R function NLS to analyze my data and one of the examples in the documentation is - ## the nls() internal cheap guess for starting values can be sufficient: x <- -(1:100)/10 y <- 100 + 10 * exp(x / 2) + rnorm(x)/10 nlmod <- nls(y ~ Const + A * exp(B * x), trace=TRUE) plot(x,y, main = "nls(*), data, true function and fit, n=100") curve(100 + 10 * exp(x / 2), col=4, add = TRUE) lines(x, predict(nlmod), col=2) However, when I try to execute this - I get the following error- Error in nls(y ~ Const + A * exp(B * x), trace = TRUE) : step factor 0.000488281 reduced below 'minFactor' of 0.000976562 In addition: Warning message: In nls(y ~ Const + A * exp(B * x), trace = TRUE) : No starting values specified for some parameters Can someone propose how I can fix this error? Thanks.
Works for me. However, if you predefine some of the parameters, all bets are off, e.g. B <- 1000 example(nls) Try again with a clean workspace.
Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com