Dear List

I would like to ask for some input on the following (here is a simplified 
version of the code):

t <-t(seq(0,120,by=120/48))
d <-500
k <-0.1
x <-matrix((d/20)*exp(-k*0.9*t))
y <-matrix((d/15)*exp(-k*0.7*t))
z<-matrix((d/22)*exp(-k*1.1*t))
w<-matrix((d/17)*exp(-k*0.2*t))
t <-matrix(seq(0,120,by=120/48))
plot(t,x,type="l",ylab="Response",xlab="Time (h)")
lines(t,y,col="green")
lines(t,z,col="blue")
lines(t,w,col="yellow")
sim <-t(cbind(x,y,z,w))
true <-t((d/19)*exp(-k*0.35*t))
lines(t,true,col="red")

#find closest line
M <- rbind(sim, true) 
D <- as.matrix(dist(M)) 
diag(D) <- NA 
which.min(tail(D, 1))

In reality sim will consist of 5000 rows. My goal here is to use a sound method 
to find the row in sim that is most identical or closest to true (represented 
by the red line in the plot) taking into consideration the whole time interval 
evaluated. 

as always, thanks for the input...

Andras

______________________________________________
R-help@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.

Reply via email to