lambda_z estimation [🇷 for BE/BA]

posted by Aceto81 – Belgium, 2008-09-26 12:25 (5690 d 01:37 ago) – Posting: # 2421
Views: 55,846

Dear Yung-jin,

Thanks for trying my codes with different examples, I learn a lot too.
So here we go:
It looks like the round was not a good idea, this was the reason for the failure of example 2.
For example 3: nrow(dat)-3:nrow(dat) gives 4 rows, instead of 3, so the code wasn't able to pick less than 4 points.

So here is the new code, I wraped it up to a function and run your samples through the function:
f<- function(dat) {
n_lambda=0
r.adj=0
for (i in (nrow(dat)-2):(which.max(dat$conc+1))) {
if (r.adj - summary(lm(log(conc)~time,dat[i:nrow(dat),]))$adj.r.squared <
   (0.0001)) {
   n_lambda <- nrow(dat)-i+1
   r.adj <- summary(lm(log(conc)~time,dat[i:nrow(dat),]))$adj.r.squared
 }
}
return(n_lambda)
}


So for your examples:
ex1:
b<-c(0,0.25,0.5,0.75,1,1.5,2,3,4,8,12,24)
c<-c(0,36.1,125,567,963,1343,1739,1604,1460,797,383,72)
dat <- data.frame(time=b,conc=c)
f(dat)
[1] 5


ex2:
b<-c(0,0.25,0.5,0.75,1,1.5,2,3,4,8,12,24)
d<-c(0,84.5,192,629,873,1246,1633,1375,1006,616,379,84.4)
dat <- data.frame(time=b,conc=d)
f(dat)
[1] 4


ex3:
b<-c(0,0.5,0.75,1,1.5,2,3,4,8,12,24)
c<-c(0,69.7,167,602,1023,1388,1481,1346,658,336,84)
dat <- data.frame(time=b,conc=c)
f(dat)
[1] 3


This equals to the WinNonlin results (finally....)

Ace
Thread locked

Complete thread:

UA Flag
Activity
 Admin contact
22,993 posts in 4,828 threads, 1,655 registered users;
125 visitors (0 registered, 125 guests [including 5 identified bots]).
Forum time: 14:03 CEST (Europe/Vienna)

Never never never never use Excel.
Not even for calculation of arithmetic means.    Martin Wolfsegger

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5