lambda_z estimation [🇷 for BE/BA]

posted by yjlee168 Homepage – Kaohsiung, Taiwan, 2008-09-28 02:08 (6057 d 15:46 ago) – Posting: # 2428
Views: 60,987

Dear Ace,

Thanks for your assistance. I look through your codes and find that your codes pick the correct numbers of data points this time. So I change one line of your codes from return(n_lambda) to summary(lm(log(conc)~time,dat[(nrow(dat)-n_lambda+1):nrow(dat),])) because I want to see if the final results are the same with those obtained from WinNonlin. Our original code for this line is summary(lm(log(conc)~time,dat[i:nrow(dat),])) which apparently does not include n_lambda in there. So the final results are the following (dumping from R console):

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
  }
  }
  summary(lm(log(conc)~time,dat[(nrow(dat)-n_lambda+1):nrow(dat),]))
  }
b<-c(0,0.25,0.5,0.75,1,1.5,2,3,4,8,12,24)
<-c(0,36.1,125,567,963,1343,1739,1604,1460,797,383,72)
at <- data.frame(time=b,conc=c)
f(dat)

Call:
lm(formula = log(conc) ~ time, data = dat[(nrow(dat) - n_lambda +
    1):nrow(dat), ])

Residuals:
       8        9       10       11       12
-0.01329  0.04253  0.03672 -0.09658  0.03062

Coefficients:
             Estimate Std. Error t value Pr(>|t|)   
(Intercept)  7.843188   0.050394  155.64 5.85e-07 ***
time        -0.149881   0.003962  -37.83 4.06e-05 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.06733 on 3 degrees of freedom
Multiple R-squared: 0.9979,     Adjusted R-squared: 0.9972
F-statistic:  1431 on 1 and 3 DF,  p-value: 4.063e-05

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)

Call:
lm(formula = log(conc) ~ time, data = dat[(nrow(dat) - n_lambda +
    1):nrow(dat), ])

Residuals:
         9         10         11         12
-0.0057874 -0.0002764  0.0100142 -0.0039504

Coefficients:
              Estimate Std. Error t value Pr(>|t|)   
(Intercept)  7.4155262  0.0081685   907.8 1.21e-06 ***
time        -0.1240003  0.0005776  -214.7 2.17e-05 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.008645 on 2 degrees of freedom
Multiple R-squared:     1,      Adjusted R-squared: 0.9999
F-statistic: 4.609e+04 on 1 and 2 DF,  p-value: 2.170e-05

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)

Call:
lm(formula = log(conc) ~ time, data = dat[(nrow(dat) - n_lambda +
    1):nrow(dat), ])

Residuals:
       9       10       11
 0.07269 -0.09692  0.02423

Coefficients:
            Estimate Std. Error t value Pr(>|t|) 
(Intercept)  7.42148    0.16961   43.76   0.0145 *
time        -0.12562    0.01049  -11.97   0.0530 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.1236 on 1 degrees of freedom
Multiple R-squared: 0.9931,     Adjusted R-squared: 0.9861
F-statistic: 143.4 on 1 and 1 DF,  p-value: 0.05305

Bingo! The final results are exactly the same as those obtained from WinNonlin with these three examples. We will test more examples to confirm this.

All the best,
-- Yung-jin Lee
bear v2.9.2:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
Thread locked

Complete thread:

UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,668 registered users;
28 visitors (0 registered, 28 guests [including 6 identified bots]).
Forum time: 17:55 CEST (Europe/Vienna)

The whole purpose of education is
to turn mirrors into windows.    Sydney J. Harris

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