[R] exponential model in R

Ben Bolker bbolker at gmail.com
Sun Feb 10 16:10:25 CET 2013


catalin roibu <catalinroibu <at> gmail.com> writes:

> 
> Dear R users,
> I don't know how to compute an exponential model like this:
> proc=a*exp(b*cls), or proc=a*exp(b*cls)+c*exp(d*cls). Please help me to
> solve this problem!
> 
> Thank you!
> 
> My data is:

  This still doesn't make much sense/have much context,
but I'll make some guesses.

dat <- read.table(textConnection("
proc cls
0.5 452.616206 0.5
1 255.864021 1.0
1.5 150.885316 1.5
2 86.289600 2.0
2.5 56.321559 2.5
3 39.504444 3.0
3.5 25.570308 3.5
4 5.382726 4.0
"),header=TRUE)

with(dat,plot(cls~proc))

I suspect that what you want to *fit* these models.

n1 <- nls(cls~a*exp(b*proc),start=list(a=4,b=-0.01),data=dat)
n2 <- nls(cls~SSbiexp(proc,a,logb,c,logd),data=dat)

lines(dat$proc,predict(n1))
lines(dat$proc,predict(n2),col=2)



More information about the R-help mailing list