Time above MIC (R function) [🇷 for BE/BA]
Dear Helmut,
I changed the function radically, so here is version 2, with the data you provided (BLQ was changed to NA):
Best regards
Ace
I changed the function radically, so here is version 2, with the data you provided (BLQ was changed to NA):
dat <- structure(list(time = c(0, 0.5167, 1, 1.5, 2, 2.5, 3, 3.5, 4,
4.5, 5, 6, 9, 12.0333, 16.0167, 24.05),
conc = c(NA, NA, 1.144, 2.399, 3.226, 3.236, 2.943,
2.776, 3.393, 4.536, 3.934, 3.387, 1.643,
0.717, 0.231, NA)),
.Names = c("time", "conc"),
class = "data.frame", row.names = c(NA, -16L))
f2 <- function(dat,th,logarithmic=FALSE) {
above = 0
w <- dat$conc > th
w[w == FALSE] <- 0
w[w == TRUE] <- 1
w2 <- which(abs(diff(w)) == 1)
if (logarithmic == FALSE) {
for (i in w2) {
n1 <- diff(w)[i] * -1*(dat$time[i+1] + ((dat$time[i]-dat$time[i+1]) *
(th-dat$conc[i+1])/(dat$conc[i]-dat$conc[i+1])))
above <- above + n1
}
}
if (logarithmic == TRUE) {
for (i in w2) {
if (diff(w)[i] == 1) {
n1 <- (dat$time[i+1] + ((dat$time[i]-dat$time[i+1]) *
(th-dat$conc[i+1])/(dat$conc[i]-dat$conc[i+1])))
above <- above - n1
}
if (diff(w)[i] == -1) {
n1 <- (dat$time[i+1] + ((dat$time[i]-dat$time[i+1]) *
(log(th)-log(dat$conc[i+1]))/(log(dat$conc[i])-log(dat$conc[i+1]))))
above <- above + n1
}
}
}
return(above)
}
f2(dat, th = 2.268, logarithmic = TRUE)
Best regards
Ace
Complete thread:
- Calculation of time above MIC Aceto81 2008-06-26 16:31 [🇷 for BE/BA]
- Calculation of time above MIC Helmut 2008-06-26 18:58
- Calculation of time above MIC Aceto81 2008-06-26 21:50
- Calculation of time above MIC Helmut 2008-06-27 00:18
- Calculation of time above MIC Helmut 2008-06-29 02:24
- Calculation of time above MIC Aceto81 2008-06-30 15:50
- Therapeutic Occupancy Time / MEC Helmut 2008-06-30 16:45
- Calculation of time above MIC Aceto81 2008-06-30 15:50
- Time above MIC (WinNonlin 5.2.1) Helmut 2008-08-08 20:38
- Time above MIC (WinNonlin 5.2.1) Aceto81 2008-08-12 09:56
- Time above MIC (WinNonlin 5.2.1) Helmut 2008-08-12 12:32
- Time above MIC (R function)Aceto81 2008-08-13 11:19
- Time above MIC (R function) Helmut 2008-08-13 13:18
- Time above MIC (R function) Aceto81 2008-08-13 15:35
- Time above MIC (R function) Helmut 2008-08-13 13:18
- Phoenix-WinNonlin 6.0 released 29 May 2009 SDavis 2009-06-04 10:55
- Phoenix-WinNonlin 6.0 Helmut 2009-06-04 11:57
- Phoenix-WinNonlin 6.0 - introductory webinars SDavis 2009-06-04 18:50
- Phoenix-WinNonlin 6.0 - introductory webinars Helmut 2009-06-04 23:40
- Phoenix-WinNonlin 6.0 - introductory webinars SDavis 2009-06-04 18:50
- Phoenix-WinNonlin 6.0 Helmut 2009-06-04 11:57
- Time above MIC (R function)Aceto81 2008-08-13 11:19
- Time above MIC (WinNonlin 5.2.1) Helmut 2008-08-12 12:32
- TimeLow Astea 2017-10-28 22:15
- PHX/WNL 8.0 vs. previous releases Helmut 2017-10-28 23:20
- PHX/WNL 8.0 vs. previous releases Astea 2017-10-28 23:49
- Occupancy, Half Value Duration, Plateau Time in Phoenix/WinNonlin 8 Helmut 2017-10-30 13:18
- Occupancy, Half Value Duration, Plateau Time in Phoenix/WinNonlin 8 Astea 2017-10-31 01:12
- Intersections Helmut 2017-10-31 12:32
- nobody needs it... Astea 2017-10-31 18:24
- Intersections Helmut 2017-10-31 12:32
- Occupancy, Half Value Duration, Plateau Time in Phoenix/WinNonlin 8 Astea 2017-10-31 01:12
- PHX/WNL 8.0 vs. previous releases Helmut 2017-10-28 23:20
- Time above MIC (WinNonlin 5.2.1) Aceto81 2008-08-12 09:56
- Calculation of time above MIC Aceto81 2008-06-26 21:50
- Calculation of time above MIC Helmut 2008-06-26 18:58