LAPKB / Pmetrics

https://lapkb.github.io/Pmetrics/
21 stars 8 forks source link

PMpost object incorrectly generated #11

Closed jjliupharmd closed 4 years ago

jjliupharmd commented 4 years ago

I have experienced some issues with plotting mdata (predicted conc.) in the new Pmetrics 1.9.3.

Essentially, I noticed that the post.xx lists generated were different despite using the same data and model file across 2 versions of Pmetrics (1.5.2 vs. 1.9.3),

As you can see in the attached screen capture, the post object generated in 1.9.3 has mean and median predicted levels specifically at observed time points + predicted levels at icen=NA with defined increments from hour 0, while the 1.5.3 output has, for the most part, mean/median/mode.

Capture

The other question is on the PMpost object in the 1.9.3 version - is that mean or median? Or mode? Since the values don't exactly match the output from 1.5.3.

Thanks!

mnneely commented 4 years ago

This probably has to do with conversion from deprecated functions to tidyverse. Will look into it.

mnneely commented 4 years ago

@jjliupharmd Can you upload the NPAGout.Rdata file so I can test the code on your output?

jjliupharmd commented 4 years ago

Oops... sorry closed your comment by accident. I am new to this GUI still.

I have attached the .rdata file here. I saw that this prob persists in 1.9.4.

Self note: this is my run 999 in temp folder. NPAGout.zip

mnneely commented 4 years ago

Thanks. I forgot to ask for the PRTB0001 file as well. It will also be in the output folder.

jjliupharmd commented 4 years ago

Thanks. I forgot to ask for the PRTB0001 file as well. It will also be in the output folder.

outputs.zip I am attaching both in the .zip file now. Thx!

mnneely commented 4 years ago

Hmm, I think I fixed a bug, but I'm not even getting any of the same numbers as in your screen shot for 1.5.3. In the files you sent me, there is no prediction equal to 51.979 (the second row on 1.5.3 version) or even rounded to 52. Same for 85.729. Can you verify that you are using the exact same output files?

In contrast, in the files you sent, I can find the predictions you show in 1.9.3, which are mis-sorted in your screen shot due to the bug which I think I've now fixed. See my screenshot below.

image
jjliupharmd commented 4 years ago

I noticed that too early on... and I am repeating the same run I did on 5/22 two more times now with the same files.. Will follow up.

jjliupharmd commented 4 years ago

Unfortunately, I might have had the files mixed up in the testing folder. But it looks like all 3 runs (1 from 5/22 and 2 from today) check out! @mnneely Capture

mnneely commented 4 years ago

So is your problem resolved? I also get the same values at 48 hours from the files you sent. The bug I found was related to data with >1 output, so not relevant to your problem. If it is resolved, I'll close the issue. Thanks!

jjliupharmd commented 4 years ago

Yup! Resolved. I think can close now.

p.s. no hurry, but will there be an incremental update/fix for the PMpost object?

mnneely commented 4 years ago

Ummm, I'm not sure how to understand your comment. We were working on PMpost in this issue and you just said it was resolved.

jjliupharmd commented 4 years ago

Sorry for not being clear. When I said it was resolved because I was finally able to generate the same posterior-predicted concentration values across runs (since I may have used different data files in my original post, thus different numbers in the PMpost object in my original screenshot and orginally attached files). But this was secondary to my post.

My question is that if there will be a new version for the bug fix re: conversion from deprecated functions to tidyverse/sorting in PMpost object (attached screenshot). The posterior predicted values still carry NA for the "icen" column.

Capture2

mnneely commented 4 years ago

OK, can you reinstall Pmetrics and try again? It seems to be working ok on my end. In Rstudio, use the following:

devtools::install_github("LAPKB/Pmetrics")

jjliupharmd commented 4 years ago

I think I have encountered a windows specific problem. I have manually removed the package folder (dplyr) multiple times and reinstalling and kept having the same Rd warning. Even re-installed the devtools along with rlang to make sure they are not at fault.

Just a snapshot of the example error message:

_Rd warning: C:/Users/Jiajun Liu/AppData/Local/Temp/RtmpUzMXVM/R.INSTALL497c2662749a/dplyr/man/tidyeval-compat.Rd:25: file link 'expr' in package 'rlang' does not exist and so has been treated as a topic Rd warning: C:/Users/Jiajun Liu/AppData/Local/Temp/RtmpUzMXVM/R.INSTALL497c2662749a/dplyr/man/tidyeval-compat.Rd:26: file link 'enquo' in package 'rlang' does not exist and so has been treated as a topic Rd warning: C:/Users/Jiajun Liu/AppData/Local/Temp/RtmpUzMXVM/R.INSTALL497c2662749a/dplyr/man/tidyeval-compat.Rd:27: file link 'enquos' in package 'rlang' does not exist and so has been treated as a topic Rd warning: C:/Users/Jiajun Liu/AppData/Local/Temp/RtmpUzMXVM/R.INSTALL497c2662749a/dplyr/man/tidyeval-compat.Rd:29: file link 'syms' in package 'rlang' does not exist and so has been treated as a topic Rd warning: C:/Users/Jiajun Liu/AppData/Local/Temp/RtmpUzMXVM/R.INSTALL497c2662749a/dplyr/man/tidyeval-compat.Rd:31: file link 'quo' in package 'rlang' does not exist and so has been treated as a topic Rd warning: C:/Users/Jiajun Liu/AppData/Local/Temp/RtmpUzMXVM/R.INSTALL497c2662749a/dplyr/man/tidyeval-compat.Rd:32: file link 'quos' in package 'rlang' does not exist and so has been treated as a topic Rd warning: C:/Users/Jiajun Liu/AppData/Local/Temp/RtmpUzMXVM/R.INSTALL497c2662749a/dplyr/man/tidyeval-compat.Rd:33: file link 'quoname' in package 'rlang' does not exist and so has been treated as a topic Rd warning: C:/Users/Jiajun Liu/AppData/Local/Temp/RtmpUzMXVM/R.INSTALL497c2662749a/dplyr/man/tidyeval-compat.Rd:34: file link 'ensym' in package 'rlang' does not exist and so has been treated as a topic

Discussion here: https://github.com/r-lib/roxygen2/issues/707

Still trying to see how to solve this on windows platform. Not sure if I need to go back to older version of dplyr

jjliupharmd commented 4 years ago

After multiple iterations of testing dplyr packages... I finally reinstalled the dplyr ver. 0.8.2 (oldest version supported by Pmetrics) and then re-installed devtools. After that, used the code you provided to install 1.9.4 branch. The output of PMpost is now correct! I attached the posterior output for reference.

At this point, I am really unclear if it's the newest dplyr package that's causing the issue. I am inclined to stay put with 0.8.2 since that's working on my end.

Thanks!

05292020.zip

mnneely commented 4 years ago

Sorry for all the trouble. I'm running dplyr 0.8.5 if that helps. I'll mark this as closed, but we can always reopen if needed. The current release is 1.9.5 now.

jjliupharmd commented 4 years ago

No prob. Thx Michael!