roman_max ☆ Russia, 2019-04-23 18:01 (2054 d 20:09 ago) Posting: # 20210 Views: 16,260 |
|
Dear R-users, recently I received a request from Sponsor to represent mean PK profile in a box-and-whiskers fashion with application of a mean connection line in one graph. Guess, ggplot2 can do this job, but unfortunately I`m not so familiar with such sofisticated plot-making for PK profile. Can anyone share idea (R-code?) how to do it? How a data-set can be organized for this graph? |
Shuanghe ★★ Spain, 2019-04-23 20:31 (2054 d 17:40 ago) @ roman_max Posting: # 20213 Views: 15,115 |
|
Dear roman_max, ❝ Can anyone share idea (R-code?) how to do it? How a data-set can be organized for this graph? Assuming that your data file of individual concentration dat_ind contain at least the following variables: subj, treat, time, conc , you can get mean profile data withlibrary(dplyr) Obviously, time here should be the planned nominal time, not the actual sampling time. With ggplot you can have more or less what you asked for:library(ggplot2) The main idea is the group = interaction(treat, time) . Feel free to modify the rest to better suit your needs (size/shape of the points etc). position_jitter() helps to avoid point overlapping (you have to specify height = 0 otherwise the data points will not reflect the true concentration value since some randomness will be introduced along y-axis by default) and the last line will add mean profiles with slightly bold lines.— All the best, Shuanghe |
roman_max ☆ Russia, 2019-04-24 14:29 (2053 d 23:42 ago) @ Shuanghe Posting: # 20221 Views: 15,134 |
|
Dear Shuanghe, Today is a beautiful day Thank you very much for your help. I`ve reproduced the code and get what I wanted to see. Hope, Sponsor will be in the best feelings |
Helmut ★★★ Vienna, Austria, 2019-04-24 00:23 (2054 d 13:48 ago) @ roman_max Posting: # 20214 Views: 15,175 |
|
Hi roman_max, ❝ recently I received a request from Sponsor to represent mean PK profile in a box-and-whiskers fashion with application of a mean connection line in one graph. The sponsor should re-consider this idea. Box-plots are nonparametric. For log-normal distributed data (which we likely have) the median is an estimate of the geometric mean. If we want to go this way, the arithmetic mean is not a good idea. ❝ Can anyone share idea (R-code?) how to do it? How a data-set can be organized for this graph? An idea, yes. I borrowed mittyri’s simulation code. With real data work with the second data.frame .C <- function(F=1, D, Vd, ka, ke, t) { Which gave in one run: 0 0.25 0.5 0.75 1 2 3 4 5 6 8 10 12 16 24 The bad thing is that you have to use very narrow boxes in order to avoid overlaps ( boxwex=0.25 ).In my “bible” that’s called a high ink-to-information ratio* which is bad style. One option would be to draw a thick line instead of the box, a thin line for the whiskers, and smaller points for the outliers, e.g., plot(x=t, y=rep(0, length(t)), type="n", log="y", xlim=range(t), Add a line connecting the medians and you are doomed.
Edit: Hey, Shuanghe – you were much faster! — Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
nobody nothing 2019-04-24 13:23 (2054 d 00:47 ago) @ Helmut Posting: # 20215 Views: 14,945 |
|
...if you want to plot T and R in one graph I would suggest "stacked" or "pseudo-3D" view, by adding/subtracting a few minutes to the actual time for T/R... — Kindest regards, nobody |
Helmut ★★★ Vienna, Austria, 2019-04-24 13:49 (2054 d 00:21 ago) @ nobody Posting: # 20217 Views: 15,568 |
|
Hi nobody, ❝ ...if you want to plot T and R in one graph I would suggest "stacked" or "pseudo-3D" view, by adding/subtracting a few minutes to the actual time for T/R... I make it sometimes upon sponsor’s demand. Personally I think that such a plot is too “crowded”. — Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
nobody nothing 2019-04-24 13:53 (2054 d 00:17 ago) @ Helmut Posting: # 20218 Views: 14,984 |
|
..add some more minutes and keep the symbols smaller — Kindest regards, nobody |
Helmut ★★★ Vienna, Austria, 2019-04-24 14:32 (2053 d 23:38 ago) @ nobody Posting: # 20222 Views: 15,029 |
|
Hi nobody, ❝ ..add some more minutes and keep the symbols smaller Like this? ±10 instead of ±5 and symbols –40%: — Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
nobody nothing 2019-04-24 14:49 (2053 d 23:22 ago) @ Helmut Posting: # 20224 Views: 14,887 |
|
I would prefer the blue ones on the right side, but otherwise: Yepp... — Kindest regards, nobody |
roman_max ☆ Russia, 2019-04-24 14:36 (2053 d 23:35 ago) @ Helmut Posting: # 20223 Views: 14,946 |
|
Dear Helmut, thank you very much for the contribution to my knowledge Indeed, very useful. ❝ The sponsor should re-consider this idea. Box-plots are nonparametric. For log-normal distributed data (which we likely have) the median is an estimate of the geometric mean. If we want to go this way, the arithmetic mean is not a good idea. Agree, but if it is easier for Sponsor to view and "understand" data, no problem. |
Helmut ★★★ Vienna, Austria, 2019-04-24 15:50 (2053 d 22:21 ago) @ roman_max Posting: # 20225 Views: 15,035 |
|
Hi roman_max, ❝ ❝ The sponsor should re-consider this idea. Box-plots are nonparametric. For log-normal distributed data (which we likely have) the median is an estimate of the geometric mean. If we want to go this way, the arithmetic mean is not a good idea. ❝ ❝ Agree, but if it is easier for Sponsor to view and "understand" data, no problem. Any kind of plot is problematic. Given, some guidelines require them (e.g., the Canadian guidance). We should be aware that such a plot gives just an impression and is not related with the assessment of BE. I once received a deficiency letter asking for a clarification why in plots of geometric mean profiles the highest concentrations and their time points didn’t agree with the reported Cmax/tmax. Well, C at any given time point has nothing to do with the individual Cmax-values and their geometric mean. Oh, dear! There’s another obstacle. How to deal with BQLs? If you set them to NA (in R) or keep them as a character-code (Phoenix/WinNonlin) you open Pandora’s box. Let’s have a look at the 16 h time point of my example:loc.stat <- function(x, type, na.rm) { Some people set all BQLs to zero in order to calculate the arithmetic mean. Others set the first BQL after tmax to LLOQ/2, and, and, and… There will always be a bias. — Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
nobody nothing 2019-04-24 16:15 (2053 d 21:55 ago) @ Helmut Posting: # 20226 Views: 15,238 |
|
❝ Some people set all BQLs to zero in order to calculate the arithmetic mean. Others set the first BQL after tmax to LLOQ/2, and, and, and… There will always be a bias. How would you otherwise calculate the geo. mean profile? And AUCtlast is a mess with different tlast for T and R and and and. Statistics is always some kind of abstraction. Do a spaghetti plot for T and R and individual T+R for each subject and you might get completely different "ideas" / insights... — Kindest regards, nobody |
Helmut ★★★ Vienna, Austria, 2019-04-24 16:41 (2053 d 21:30 ago) @ nobody Posting: # 20227 Views: 15,618 |
|
Hi nobody, ❝ ❝ Some people set all BQLs to zero in order to calculate the arithmetic mean. Others set the first BQL after tmax to LLOQ/2, and, and, and… There will always be a bias. ❝ ❝ How would you otherwise calculate the geo. mean profile? Tons of rules. Mine: If at any given time point ≥⅔ of concentrations are ≥LLOQ I calculate the geometric mean of those (i.e., exclude the BQLs). If less, I don’t calculate the geometric mean at all. Luckily in my studies the LLOQ was always low enough. Had a look at the Canadian guidance and the example given in the appendix. HC calculates the arithmetic (!) mean whilst treating BQLs as zero (Table A1-B/C, p.23/24). If a mean is <LLOQ, it is not shown in the plot (Figure 1, p.31). Played a bit with the example (after correcting the typo 3723 → 37.23 which sits happily in the table for 25 years). R-code at the end. method 0 0.33 0.67 1 1.5 2 3 4 6 8 12 16 Added some jitter to separate the lines. Now what? I think everything (except arithmetic means) is OK. Coming up with sumfink which is <LLOQ? Hhm. As soon as we have a single value <LLOQ it might be that the estimate is <LLOQ as well (if all others are LLOQ). But how much? No idea. Will submit a study to HC soon. Will report back how they like my approach. ❝ And AUCtlast is a mess with different tlast for T and R and and and. Can’t agree more. ❝ Do a spaghetti plot for T and R and individual T+R for each subject and you might get completely different "ideas" / insights... Yes and yes. Henning Blume always apologized when presenting (arithmetic) mean plots. I’m pissed when I get a report without spaghetti plots. loc.stat <- function(x, type, na.rm) { — Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
Ohlbe ★★★ France, 2019-04-25 14:47 (2052 d 23:24 ago) @ Helmut Posting: # 20228 Views: 15,089 |
|
Dear Helmut, ❝ I’m pissed when I get a report without spaghetti plots. And you complain that overlaying two plots of means is too crowded I find spaghetti plots rather difficult to read with more than 30 subjects, or even less depending on what they look like... — Regards Ohlbe |
nobody nothing 2019-04-25 16:36 (2052 d 21:35 ago) @ Ohlbe Posting: # 20230 Views: 14,767 |
|
I don't read 'em, I have a quick look, "see" the variability/"outliers" and job done. Totally correct that more than 36 is hard to see anything, but if all profiles are pretty close that's in important info, too, imho. ' — Kindest regards, nobody |
Helmut ★★★ Vienna, Austria, 2019-04-25 16:39 (2052 d 21:32 ago) @ Ohlbe Posting: # 20231 Views: 15,179 |
|
Dear Ohlbe, ❝ ❝ I’m pissed when I get a report without spaghetti plots. ❝ ❝ And you complain that overlaying two plots of means is too crowded Nope. Overlaying two plots ±SD. I’m fine with one plot of both T and R plus two showing the treatments separately (geom. mean ±SD). ❝ I find spaghetti plots rather difficult to read with more than 30 subjects, or even less depending on what they look like... You get used to it. Our brains are great in pattern-recognition. Two examples (amoxicillin 1 g tablets, different tests but same reference in both studies) of Blume/Mutschler*
@ Mittyri: Good ol’ days! I would say:
— Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
nobody nothing 2019-04-25 17:08 (2052 d 21:03 ago) @ Helmut Posting: # 20232 Views: 14,794 |
|
❝
WOW, somebody bought that! — Kindest regards, nobody |
Helmut ★★★ Vienna, Austria, 2019-04-25 17:32 (2052 d 20:39 ago) @ nobody Posting: # 20233 Views: 14,822 |
|
Hi nobody, ❝ WOW, somebody bought that! Though I don’t use it any more I still like the idea behind. At a conference in Toronto 1992 I showed the first file to guys (no gals at that time) of the FDA and told the story that ⅓ of German pharmacists are already trained on BE. Jaws dropped. As an ol’ salt you know it but for the others: The ZL sent polite letters to manufacturers asking for information (the original evaluation which lead to the approval as well as study data allowing recalculation). Observations:
— Dif-tor heh smusma 🖖🏼 Довге життя Україна! Helmut Schütz The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
nobody nothing 2019-04-25 17:43 (2052 d 20:28 ago) @ Helmut Posting: # 20234 Views: 14,757 |
|
Yepp, I know the story around that in detail It was a move to couple science with politics (health care, pharmacists positioning as the "medicines expert"). Unfortunately this didn't work out, nowadays the health insurance buys the cheapest and decides which generic the patient gets. It's a shame... RE: Replies from manufacturers. Not that different from today. In EU you still have only patchy Ass Reps from EMA, compared to the data released by FDA on products after MA granted. Selling BE-studies+product was a fine business model for some time, some guys got rich and big with that. Quality of data has been an issue as long as there is any data around.... — Kindest regards, nobody |
d_labes ★★★ Berlin, Germany, 2019-04-25 21:59 (2052 d 16:12 ago) @ Helmut Posting: # 20236 Views: 14,786 |
|
Dear All, especially the contributors to this thread. I have a simple opinion about that mean PK profile graphs: Whatever sophisticated group statistics underlying such mean profile you choose, whatever sophistic rules regarding missings and / or values below LLOQ, whatever sophistic graphical effects you choose - you end with a statistical lie. A lie is a lie is a lie ... Thus my recommendation: Don't invest too many Gehirnschmalz (brain power). Try to go without them. And since that unfortunately doesn't function in many cases, as I know of course, choose a simple effortless solution and go with that. The Blume/Mutschler graphs shown in Helmuts post point in the correct direction. I only had some seldom requests from some smart alecs to change the graphs. If this happens it is early enough to invest some grey matter. — Regards, Detlew |