[R] nls problem with R

Mike Marchywka marchywka at hotmail.com
Thu May 5 13:37:04 CEST 2011










----------------------------------------
> Date: Thu, 5 May 2011 01:20:33 -0700
> From: sterlesser at hotmail.com
> To: r-help at r-project.org
> Subject: Re: [R] nls problem with R
>
> ID1 ID2 t V(t)
> 1 1 0 6.053078443
> 2 1 0.3403 5.56937391
> 3 1 0.4181 5.45484486
> 4 1 0.4986 5.193124598
> 5 1 0.7451 4.31386722
> 6 1 1.0069 3.645422269
> 7 1 1.5535 3.587710965
> 8 1 1.8049 3.740362689
> 9 1 2.4979 3.699837726
> 10 1 6.4903 2.908485019
> 11 1 13.5049 1.888179494
> 12 1 27.5049 1.176091259
> 13 1 41.5049 1.176091259
>
> The model
> (1) V(t)=V0[1-epi+ epi*exp(-c(t-t0))]

A=Vo, B-Vo*epi, C=exp(-c*t0)
V(t)=A-B+B*C*exp(-ct)

or further, D=A-B, F=B*C,

V(t)=D+F*exp(-ct)

this model only really has 3 attriubtes: initial value, final value,
and decay constant yet you ask for 4 parameters. There is no
way to get a unique answer. For some reason this same form comes up
a lot here, I think this is about third time I've sene this in last few weeks.

I guess when fishing or shopping for forms to fit, it is tempting to
throw a bunch of parameteres into your model but this can create intractable
ambiguities. 

Indeed, if I just remove t0 and use your first 8 points I get this
( random starting values, but convewrged easily you still need to plot etc)


[1] "1   v= 8.77181162126362  epi= 0.672516376478598  cl= 1.90973175223917 t0= 0
.643481321167201"
> summary(nls2)

Formula: V2 ~ v0 * (1 - epi + epi * exp(-cl * (T2)))

Parameters:
    Estimate Std. Error t value Pr(>|t|)
v0    6.2901     0.3384  18.585  8.3e-06 ***
epi   0.5430     0.1373   3.955   0.0108 *
cl    0.9684     0.5491   1.763   0.1381
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.3579 on 5 degrees of freedom

Number of iterations to convergence: 11
Achieved convergence tolerance: 4.057e-06



> (2) V(t)=V0{A*exp[-lambda1(t-t0)]+(1-A)*exp[-lambda2(t-t0)]}
>
> in formula (2) lambda1=0.5*{(c+delta)+[(c-delta)^2+4*(1-epi)*c*delta]^0.5}
>
> lambda2=0.5*{(c+delta)-[(c-delta)^2+4*(1-epi)*c*delta]^0.5}
> A=(epi*c-lambda2)/(lambda1-lambda2)
>
> The regression rule :
> for formula (1):(t<=2,that is) first 8 rows are used for non-linear
> regression
> epi,c,t0,V0 parameters are obtained
> for formula (2):all 13 rows of results are used for non-linear regression
> lambda1,lambda2,A (with these parameters, delta can be calculated from them)
>
> Thanks for help
> Ster Lesser
>
> --
> View this message in context: http://r.789695.n4.nabble.com/nls-problem-with-R-tp3494454p3497825.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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