F<-c(84.6,83.9,148.2,147.8,463.9,463.8,964.1,967.6,1926.0,1900.0) B<-c(12.1,12.5,17.2,16.7,28.3,26.9,37.6,35.8,38.5,39.9) hormone.dat<-data.frame(F=F,B=B) hormone.dat hormone.fit<-nls(B~Bmax*F/(KD+F),hormone.dat,start=list(Bmax=40,KD=250)) summary(hormone.fit) hormone.fit2<-nls(B~Bmax*F/(KD+F),hormone.dat,start=list(Bmax=30,KD=300)) summary(hormone.fit2) Bmax.hat<-coef(hormone.fit)[1] KD.hat<-coef(hormone.fit)[2] F.seq<-seq(range(F)[1],range(F)[2],length=100) B.seq<-Bmax.hat*F.seq/(KD.hat+F.seq) plot(F,B,ylim=c(10,50)) lines(F.seq,B.seq) title(main="Observed values and fitted curve") Bmax.val<-seq(20,60,length=30) KD.val<-seq(50,1000,length=30) S<-matrix(0,30,30) for(i in 1:30) { for(j in 1:30) { S[i,j]<-sum((B-Bmax.val[i]*F/(KD.val[j]+F))^2) } } persp(Bmax.val,KD.val,S/100,xlab="Bmax",ylab="KD",zlab="Objective Function/100",theta=-45,phi=30,expand=0.5)