Never use Excel [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2017-05-22 15:19 (2523 d 16:55 ago) – Posting: # 17386
Views: 7,582

Dear Astea,

❝ Please check the data you've posted in the column "lin/log".


THX, I stand corrected! I should have observed Martin’s advice:

never never never never use excel for any statistical calculations


Plain R

time    <- c(0.00, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00, 4.33,
             4.67, 5.00, 5.33, 5.67, 6.00, 6.33, 6.67, 7.00, 7.50,
             8.00, 10.00, 12.00, 16.00, 24.00, 36.00, 48.00, 72.00, 96.00)
conc    <- c(0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 1.518, 5.027,
             12.700, 22.210, 18.013, 22.332, 30.500, 24.290, 31.676, 32.647,
             45.512, 95.827, 120.261, 89.598, 41.572, 24.576, 9.237, 4.897,
             1.976, 1.287)
data    <- data.frame(time, conc, lin=0, linlog=0)
delta.t <- diff(data$time)
delta.c <- diff(data$conc)
for (j in seq_along(delta.t)) {
  # linear trapezoidal method
  data$lin[j] <- 0.5*delta.t[j]*sum(data$conc[j+1], data$conc[j])
  # lin-up/log-down trapezoidal method
  if (delta.c[j] < 0) { # decreasing         : log trapezoidal method
    data$linlog[j] <- delta.t[j]*delta.c[j]/log(data$conc[j+1]/data$conc[j])
  } else {              # increasing or equal: linear trapezoidal method
    data$linlog[j] <- data$lin[j]
  }
}
data$lin    <- cumsum(data$lin)
data$linlog <- cumsum(data$linlog)
print(round(data, 4), row.names=FALSE)

gives

  time    conc       lin    linlog
  0.00   0.000    0.0000    0.0000
  1.00   0.000    0.0000    0.0000
  1.50   0.000    0.0000    0.0000
  2.00   0.000    0.0000    0.0000
  2.50   0.000    0.0000    0.0000
  3.00   0.000    0.0000    0.0000
  3.50   0.000    0.0000    0.0000
  4.00   1.518    0.3795    0.3795
  4.33   5.027    1.4594    1.4594
  4.67  12.700    4.4730    4.4730
  5.00  22.210   10.2332   10.2332
  5.33  18.013   16.8700   16.8458
  5.67  22.332   23.7286   23.7045
  6.00  30.500   32.4459   32.4217
  6.33  24.290   41.4862   41.4232
  6.67  31.676   51.0005   50.9375
  7.00  32.647   61.6138   61.5508
  7.50  45.512   81.1535   81.0905
  8.00  95.827  116.4883  116.4253
 10.00 120.261  332.5763  332.5133
 12.00  89.598  542.4353  540.8702
 16.00  41.572  804.7753  791.0362
 24.00  24.576 1069.3673 1049.6994
 36.00   9.237 1272.2453 1237.8016
 48.00   4.897 1357.0493 1319.8698
 72.00   1.976 1439.5253 1397.1153
 96.00   1.287 1478.6813 1435.6823
                   [image]        [image]

Sorry for the confusion caused.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes

Complete thread:

UA Flag
Activity
 Admin contact
22,987 posts in 4,824 threads, 1,664 registered users;
86 visitors (0 registered, 86 guests [including 4 identified bots]).
Forum time: 08:14 CEST (Europe/Vienna)

The only way to comprehend what mathematicians mean by Infinity
is to contemplate the extent of human stupidity.    Voltaire

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