example [🇷 for BE/BA]

posted by martin  – Austria, 2008-10-16 22:02 (6088 d 10:24 ago) – Posting: # 2547
Views: 21,889

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,424 posts in 4,927 threads, 1,672 registered users;
26 visitors (0 registered, 26 guests [including 23 identified bots]).
Forum time: 08:27 CEST (Europe/Vienna)

Truth and clarity are complementary.    Niels Bohr

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