[R] Odp: An error in fitting a non linear regression
petr.pikal at precheza.cz
Fri Feb 20 14:50:32 CET 2009
r-help-bounces at r-project.org napsal dne 20.02.2009 11:21:26:
> I have a data set with two variables "q" and "depth" as follows:
> q<-c(tapply(weight[Soil=="Jy"], Depth[Soil=="Jy"], mean)). This commns
> returns 7 "q" values:
> 0.687900000 0.845550000 0.405416667 0.152766667 0.033100000 0.031400000
> The "depth" values are produced using this command whish "depth" shows
> soil depth:
> depth <--c(5,15,25,35,45,55,65). This return these values for "depth":
>  -5 -15 -25 -35 -45 -55 -65
> I have uploaded the plot file in below:
> http://www.nabble.com/file/p22118160/plot.doc plot.doc
> Now I want to fit the following decaying exponential model to our data
> presented in the plot file such that depth is X and q is Y.
> nreg<-nls(q~a*exp(-b*depth), start=list(a=1, b=0.5)). This command
> the following error:
> Error in nls(q ~ a * exp(-b * depth), start = list(a = 1, b = 0.5)) :
> singular gradient
With b=0.05 it will converge, however the model seems to be wrong.
y<-c(0.687900000, 0.845550000, 0.405416667, 0.152766667, 0.033100000,
nreg<-nls(y~a*exp(-b*depth), start=list(a=1, b=0.05))
> However, if I use positive values of depth i.e.
>  5 15 25 35 45 55 65
> then I recieve the following error:
> Error in numericDeriv(form[], names(ind), env) :
> Missing value or an infinity produced when evaluating the model
> Notice that though in the plot depth is drawn on Y axis but in the
> regression model "depth" in independent. Plot shows the real world of
> happne to the crop root growth.
> Thank you.
> Saeed Ahmadi
> View this message in context:
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help