[R] NLS-Weibull-ERROR

Gabor Grothendieck ggrothendieck at gmail.com
Fri Dec 18 18:58:00 CET 2009


This only uses 2 parameters instead of 3 and gives quite a good fit:

> DF <- structure(list(conc = c(0.077, 0.328, 0.882, 1.195, 1.884, 3.577,
+ 6.549, 13, 33.69, 52.22, 90.14, 166.05, 233.62, 346.89), vel =
1:14), .Names = c("conc",
+ "vel"), class = "data.frame", row.names = c(NA, -14L))
>
> DF.nls <- nls(conc ~ a * exp(b/vel), DF, start = c(a=1, b=1))
> DF.nls
Nonlinear regression model
  model:  conc ~ a * exp(b/vel)
   data:  DF
       a        b
35773.97   -65.02
 residual sum-of-squares: 249.6

Number of iterations to convergence: 12
Achieved convergence tolerance: 1.410e-06
> plot(conc ~ vel, DF)
> lines(DF$vel, fitted(DF.nls))


On Fri, Dec 18, 2009 at 7:53 AM, ruchita gupta <ruchitarg123 at gmail.com> wrote:
> Hello
>
> I was trying to estimate the weibull model using nls after putting OLS
> values as the initial inputs to NLS.
> I tried multiple times but still i m getting the same error of Error in
> nlsModel(formula, mf, start, wts) :
>  singular gradient matrix at initial parameter estimates.
>
> The Program is as below
>
>> vel <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
>> df <- data.frame(conc, vel)
>> df
>      conc vel
> 1    0.077   1
> 2    0.328   2
> 3    0.882   3
> 4    1.195   4
> 5    1.884   5
> 6    3.577   6
> 7    6.549   7
> 8   13.000   8
> 9   33.690   9
> 10  52.220  10
> 11  90.140  11
> 12 166.050  12
> 13 233.620  13
> 14 346.890  14
>> plot(df$vel, df$conc)
>> para0.st <- c(K=450,
> +       alpha=0.054,beta=3.398 )
>>  fit0 <- nls(
> +      conc~ K-(K*exp(-(vel/alpha)^beta)), df, start= para0.st,trace=T)
> Error in nlsModel(formula, mf, start, wts) :
>  singular gradient matrix at initial parameter estimates
>
>
> I will be highly thankful if some one can please let me know where is the
> mistake as i m unable to trace it.
>
> Thanks
> Ruchita
>
> On Wed, Dec 16, 2009 at 3:18 PM, ruchita gupta <ruchitarg123 at gmail.com>wrote:
>
>> Hello
>>
>> After performing NLS estimates for some sigmoid model(like logistic growth
>> model  and Gompertz growth models), how can we get the RMSE(root mean square
>> error) and MAPE(mean absolute percentage error) in  R statistical tool for
>> comparison between two models
>>
>> Thanks
>> Ruchita
>>
>
>        [[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