[R] Fitting a negative Gompertz model to data
amon
akimeli at vub.ac.be
Wed Jun 26 19:48:06 CEST 2013
Hi,
First: i have looked through previous posts but could get one related to my
problem!
I am trying to fit a negative gompertz curve in my data seems alright but
the curve doesn't bend at the left (max asymptote)...see graph attached.
Here is my code;
EProb=read.table("ProbF.txt",header=TRUE)
attach(EProb)
EProb
plot(mHWLrelMSL,Prob, ylab="Exceedance probability, P (%)",xlab="mHWL (m rel
Sea level)", xlim=c(-1.0,1.5), cex=1, pch=1, col="blue")
##################### ## Modified Negative Gompertz ....: Y = a*
exp(b*(1-exp(c*X)))
gm <- nls(Prob~ a*exp(b*(1-exp(c*mHWLrelMSL))), start=list(a=117.6234567153,
b=-60.3, c=-0.2))
summary(gm)
xfit= seq(min(mHWLrelMSL),max(mHWLrelMSL), by=0.01)
param= coef(summary(gm))[,1]
A=param [1]
B=param [2]
C=param [3]
yfit = A*exp(B*(1-exp(C*xfit)))
lines(spline(xfit,yfit),col="red",lwd=3)
####parent text file
Prob.txt <http://r.789695.n4.nabble.com/file/n4670394/Prob.txt>
###output graph
<http://r.789695.n4.nabble.com/file/n4670394/regression2606.png>
Thanks in advance.
Amon
akimeli at vub.ac.be
--
View this message in context: http://r.789695.n4.nabble.com/Fitting-a-negative-Gompertz-model-to-data-tp4670394.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list