[R] nls help

chuck.01 CharlieTheBrown77 at gmail.com
Wed Nov 30 18:14:56 CET 2011


Hello, 
I have data like the following:

datum <- structure(list(Y = c(415.5, 3847.83333325, 1942.833333325,
1215.22222233333, 
950.142857325, 2399.5833335, 804.75, 579.5, 841.708333325, 494.053571425
), X = c(1.081818182, 0.492727273, 0.756363636, 0.896363636, 
1.518181818, 0.499166667, 1.354545455, 1.61, 1.706363636, 1.063636364
)), .Names = c("Y", "X"), row.names = c(NA, -10L), class = "data.frame")


with(datum, plot(Y~X))

As you can see there is a non-linear association between X and Y, and I
would like to fit an appropriate model.  I was thinking an exponential decay
model might work well. 

I tried the following (a and k starting values are based off of a lm() fit),
but get an error. 

fit <- nls(Y ~ a*exp(-k * X), datum, start=c(a=3400, k=1867))

Error in nlsModel(formula, mf, start, wts) : 
  singular gradient matrix at initial parameter estimates

I have never attempted to fit a non-linear model before, and thus the model
may be inappropriately specified, or it is also possible that I have no idea
what I am doing. 

Would someone please offer some advice.

Thanks.
Chuck


--
View this message in context: http://r.789695.n4.nabble.com/nls-help-tp4123876p4123876.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list