[R] Peoblem with nls and try

jarod_v6 jarod_v6 at libero.it
Mon Aug 11 20:06:34 CEST 2008


Hello,

I can`t figure out how can increase the velocity of the fitting data by nls.
I have a long data .csv
I want to read evry time the first colunm to the other colunm and analisy with thata tools

setwd("C:/dati")
a<-read.table("Normalizzazione.csv", sep=",", dec=".", header=F)

for (i in 1:dim(a[[2]]]) {

#preparazione dati da analizzare singolarmente

P1<-data.frame(Time=a[,2],RFU=a[,i+2])
P1<-data.frame(Time=a[,1],RFU=a[,2])
 nlmod2 <- nls(RFU ~ A + (B+c*Time)/(1+exp(k*(e-Time))),
 P1, start = list(A = 100, c = 1, B = 10, k =2, e = 10),control = nls.control(maxiter = 100000),trace = TRUE)


print (summary(nlmod2))
				  
coeff<-coefficients(nlmod2)
c<-coeff["c"]
A<-coeff["A"]
B<-coeff["B"]
e<-coeff["e"]
k<-coeff["k"]

 summary(nlmod2)

plot(P1)
lines(P1[,1],nlmod2,lwd=2,col=2)
lag1 <- e-(2/k)

print(lag1)
abline(v=lag1,col=4)
print("nlmod2")


{
pdf(file= "Lag_estimation.pdf" )

 plot(P1[,1],predict(nlmod2),xlab='Time',ylab='ThT normalizate',main="Lag estimetion",type='l', col=1)
 lines(P1, col=8)
  abline(v=lag1,col=4)
 lines(P1[,1],nlmod2,lwd=2,col=2)
 
 }

The loops don't` function. the program stop after the first cycle...gradienrt is not good...
what I want is to skyp these set of data and give me in the end one table with all data with lag1 value..
I appreciate any kind of help
Have nice day
M



More information about the R-help mailing list