[R] Four parameter logistics.
Victor F Seabra
vseabra at uol.com.br
Tue Feb 8 21:40:38 CET 2011
try the code below,
if you use different upper and lower limits you might get different parameter estimates
HTH, Victor
standard.curve<-data.frame(conc=c(50, 25, 12.5, 6.25, 3.125, 1.563, 0.781,50, 25, 12.5, 6.25, 3.125, 1.563, 0.781),absorb=c(1.918, 1.251, 1.104, 0.719, 0.403, 0.177, 0.083,1.918, 1.251, 1.104, 0.719, 0.403, 0.177, 0.083))
test<-nls( absorb ~ ((a-d)/(1+(conc/c.)^b))+d,
data = standard.curve,
start = list( a=0, b=1, c.=30, d=4),
trace = TRUE,
algorithm="port",
lower = list( a=-0.45, b=-30, c.=0, d=0),
upper = list( a=20, b=30, c.=2000, d=20),
control=nls.control(maxiter = 5000, tol = 1e-05, minFactor = 1/10000))
x<-function(a, b, c., d, absorb){c.*((a-absorb)/(absorb-d))^(1/b)}
conc.fitted<-x(a=coef(test)[1],b=coef(test)[2],c.=coef(test)[3],d=coef(test)[4],seq(0,5,by=0.1))
xlim<-c(0,max(standard.curve$conc))
ylim<-c(0,max(standard.curve$absorb))
plot(standard.curve,xlim=xlim,ylim=ylim)
par(new=T)
plot(x=conc.fitted, y=seq(0,5,by=0.1), type="l", col="red",xlim=xlim,ylim=ylim, ylab="", xlab="")
text(20,0.5,expression(paste("abs = ",frac("a - d",1+(conc/c)^b))+d))
text(25,1,pos=4,paste(" a=",coef(test)[1],"\n b=",coef(test)[2],"\n c=",coef(test)[3],"\n d=",coef(test)[4]))
# calculate concentration for a measured absorbance of 1.918
measured.absorbance<-1.918
x(a=coef(test)[1],b=coef(test)[2],c.=coef(test)[3],d=coef(test)[4],measured.absorbance)
____________________________________________
Em 08/02/2011 00:53, Ramya < ramya.victory at gmail.com > escreveu:
Hi,
I decided to use the drm function for four point fitting and in the all the
examples that i see
spinach.m1 <- drm(SLOPE~DOSE, CURVE, data = spinach, fct = LL.4())
fit1 <- drm(wheeze~p(age>9)+smoking+cluster(id),data=wheeze,dep="B",
print=0)
what are these with '~' mean?
This is my data
conc il10
1 50.000 1.918
2 25.000 1.251
3 12.500 1.104
4 6.250 0.719
5 3.125 0.403
6 1.563 0.177
7 0.781 0.083
I am trying to find the co-efficients for it.
The co-eff that i am expecting is A = -0.457, B = 0.412, C = 915, D = 9.56
Any suggestions would be appreciated.
--
View this message in context: http://r.789695.n4.nabble.com/Four-paramete-logistics-tp3265251p3265598.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