example [🇷 for BE/BA]

posted by martin  – Austria, 2008-10-16 22:02 (6445 d 04:10 ago) – Posting: # 2547
Views: 26,233

dear ace !

here is a rather strange (artificial) example generated in a simulation study (R version 2.6.2 for windows XP)

best regards

martin

time <- c(0.08263463, 0.52824754, 1.17358567, 1.39767757, 2.47663194,  3.19031555, 3.97925368, 6.95466074, 7.42732263, 12.08734425, 12.35692940, 13.63305248, 21.64587886, 29.33632297)
conc <- c(1.175213, 8.748377, 12.650698, 12.741200, 12.965722, 13.648985, 13.633996, 11.110552, 16.232875, 6.747145, 7.156791, 7.776978, 3.241740, 1.528261)

dat <- data.frame(time=time, conc=conc)

# without fishing for NA's
n_TTT_ARS=0
r.adj2=0
for (i in
(nrow(dat)-2):(min(seq_along(dat$time)[dat$time>=dat$time[which.max(dat$conc)]*2])))
 {
   check <- summary(lm(log(conc)~time,dat[i:nrow(dat),]))$adj.r.squared #modification
   if ((r.adj2 - check <(0.0001))) {
      n_TTT_ARS = nrow(dat)-i+1
      r.adj2 = summary(lm(log(conc)~time,dat[i:nrow(dat),]))$adj.r.squared
   }
}

# fishing for NA's
n_TTT_ARS=0
r.adj2=0
for (i in
(nrow(dat)-2):(min(seq_along(dat$time)[dat$time>=dat$time[which.max(dat$conc)]*2])))
 {
   check <- summary(lm(log(conc)~time,dat[i:nrow(dat),]))$adj.r.squared #modification
   if (!is.na(check) && (r.adj2 - check < (0.0001))) {
      n_TTT_ARS = nrow(dat)-i+1
      r.adj2 = summary(lm(log(conc)~time,dat[i:nrow(dat),]))$adj.r.squared
   }
}

Complete thread:

UA Flag
Activity
 Admin contact
23,653 posts in 4,991 threads, 1,570 registered users;
121 visitors (0 registered, 121 guests [including 26 identified bots]).
Forum time: 02:13 CEST (Europe/Vienna)

In theory, there is no difference between theory and practice.
But, in practice, there is.    Jan L.A. van de Snepscheut

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