[R] please help me

Gabor Grothendieck ggrothendieck at gmail.com
Wed Oct 10 09:50:37 CEST 2007


You need better starting values:

f <- function(x) { c0 <- x[1]; ce <- x[2]; ae <- x[3]
   sum((v - c0+(ce*(1-exp((-u)/ae))))^2)
}
g <- 4^(0:8)
g <- c(-g, g)
g <- expand.grid(c0 = g, ce = g, ae = g)
start <- g[which.min(apply(g, 1, f)), ]
nls(v ~ c0+(ce*(1-exp((-u)/ae))), data = data1, start = start)


On 10/10/07, azadeh sadeghian <a.sadeghian1386 at yahoo.com> wrote:
> dear list
>  I am student M.S. statistics in department statistics . I am working in  the function "nls" in the [R 2.3.1] with 246 data and want to fit the "exp" model to vectors( v and u ) but I have
> a problem to use it
>  u
>  5.000000e-13 2.179057e+03 6.537171e+03 1.089529e+04 1.525340e+04
>  1.961151e+04 2.396963e+04 2.832774e+04 3.268586e+04 3.704397e+04
>  4.140209e+04 4.576020e+04 5.011831e+04 5.447643e+04
>  v
>  8.382562e-01 4.090868e+02 1.311053e+03 2.124143e+03 3.365494e+03
>  2.138903e+03 7.687774e+03 1.028396e+04 1.004186e+04 2.059798e+04
>  1.438464e+04 2.861373e+04 2.294919e+04 2.807701e+04
> data1<-data.frame(u=u ,v=v)
>    nls(v~c0+(ce*(1-exp((-u)/ae))),data=data1,start=list(c0=0,ce=1000,ae=3000))
> Error in nls(v ~ c0 + (ce * (1 - exp((-u)/ae))), data = data1, start = list(c0 = 0,  :
>        step factor 0.000488281 reduced below 'minFactor' of 0.000976563
>  i dont know how to solve it, please help me .
>  best regards
> Sadeghian
>
>
>
>
> ---------------------------------
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list