LAPKB / Pmetrics

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

makeValid error in Pmetrics 1.9.7: Error in { : task 11 failed - "scan() expected 'a real', got 'THE'" #51

Closed njrhodes closed 2 years ago

njrhodes commented 2 years ago

Using a one compartment model fit to sparse PK data and the makevalid() function, I get the following simulation error:

makeValid(7, limits=c(0,1), binCov=c('crcl'),tadC=F)

Error in { : task 11 failed - "scan() expected 'a real', got 'THE'" In addition: Warning messages: 1: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 2: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 3: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 4: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 5: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 6: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 7: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 8: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 9: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 10: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2

Tried specifying limits as "NA" and c(0,1) c(0,2, c(0,3) and c(1)

SIMrun works just fine.

What could it be?

sessionInfo() R version 4.0.0 (2020-04-24) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] Pmetrics_1.9.7 epitools_0.5-10.1 ggplot2_3.3.5 tidyr_1.1.4 dplyr_1.0.7
[6] ODA_1.0.1.3

loaded via a namespace (and not attached): [1] cubelyr_1.0.1 pillar_1.6.4 compiler_4.0.0 iterators_1.0.13 base64enc_0.1-3
[6] tools_4.0.0 mclust_5.4.8 digest_0.6.25 statmod_1.4.34 jsonlite_1.7.2
[11] lifecycle_1.0.1 tibble_3.0.1 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.12
[16] foreach_1.5.1 cli_3.1.0 DBI_1.1.1 rstudioapi_0.13 parallel_4.0.0
[21] curl_4.3.2 yaml_2.2.1 gridExtra_2.3 httr_1.4.2 withr_2.4.3
[26] stringr_1.4.0 generics_0.1.1 vctrs_0.3.8 fastDummies_1.6.3 grid_4.0.0
[31] tidyselect_1.1.1 glue_1.4.0 R6_2.4.1 fansi_0.4.1 purrr_0.3.4
[36] farver_2.0.3 magrittr_2.0.1 codetools_0.2-16 scales_1.1.1 ellipsis_0.3.2
[41] assertthat_0.2.1 colorspace_1.4-1 labeling_0.3 utf8_1.1.4 stringi_1.4.6
[46] doParallel_1.0.16 munsell_0.5.0 crayon_1.4.2

mnneely commented 2 years ago

Your model is leading to bad simulated values, either when simulating the mean for each bin, or for each subject. Try limits=NA to see if that helps, or try another model! The makeValid function does use SIMrun, but the conditions makeValid uses might not have been the same as you used in SIMrun.


Michael Neely, MD, MSc, FCP Chief, Infectious Diseases Director, Laboratory of Applied Pharmacokinetics and Bioinformatics Children’s Hospital Los Angeles

Professor of Pediatrics and Clinical Scholar Keck School of Medicine University of Southern California

On Jan 5, 2022, at 10:49 AM, njrhodes @.***> wrote:



Using a one compartment model fit to sparse PK data and the makevalid() function, I get the following simulation error:

makeValid(7, limits=c(0,1), binCov=c('crcl'),tadC=F)

Error in { : task 11 failed - "scan() expected 'a real', got 'THE'" In addition: Warning messages: 1: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 2: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 3: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 4: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 5: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 6: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 7: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 8: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 9: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2 10: In shell("montbig.exe DOS < simControl.txt", invisible = T) : 'montbig.exe DOS < simControl.txt' execution failed with error code 2

Tried specifying limits as "NA" and c(0,1) c(0,2, c(0,3) and c(1)

SIMrun works just fine.

What could it be?

sessionInfo() R version 4.0.0 (2020-04-24) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] Pmetrics_1.9.7 epitools_0.5-10.1 ggplot2_3.3.5 tidyr_1.1.4 dplyr_1.0.7 [6] ODA_1.0.1.3

loaded via a namespace (and not attached): [1] cubelyr_1.0.1 pillar_1.6.4 compiler_4.0.0 iterators_1.0.13 base64enc_0.1-3 [6] tools_4.0.0 mclust_5.4.8 digest_0.6.25 statmod_1.4.34 jsonlite_1.7.2 [11] lifecycle_1.0.1 tibble_3.0.1 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.12 [16] foreach_1.5.1 cli_3.1.0 DBI_1.1.1 rstudioapi_0.13 parallel_4.0.0 [21] curl_4.3.2 yaml_2.2.1 gridExtra_2.3 httr_1.4.2 withr_2.4.3 [26] stringr_1.4.0 generics_0.1.1 vctrs_0.3.8 fastDummies_1.6.3 grid_4.0.0 [31] tidyselect_1.1.1 glue_1.4.0 R6_2.4.1 fansi_0.4.1 purrr_0.3.4 [36] farver_2.0.3 magrittr_2.0.1 codetools_0.2-16 scales_1.1.1 ellipsis_0.3.2 [41] assertthat_0.2.1 colorspace_1.4-1 labeling_0.3 utf8_1.1.4 stringi_1.4.6 [46] doParallel_1.0.16 munsell_0.5.0 crayon_1.4.2

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/LAPKB/Pmetrics/issues/51__;!!LIr3w8kk_Xxm!4JY5BzZlw206zM0FtIFMkZGevCK1Cv1oVRpnI6uDsq6GDb1Lre4qkSZP8Oc1Pw$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AB6CLTWCQED4O46WAVL5T7TUUSHDNANCNFSM5LKS545A__;!!LIr3w8kk_Xxm!4JY5BzZlw206zM0FtIFMkZGevCK1Cv1oVRpnI6uDsq6GDb1Lre4qkSbLo6R-WA$. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!LIr3w8kk_Xxm!4JY5BzZlw206zM0FtIFMkZGevCK1Cv1oVRpnI6uDsq6GDb1Lre4qkSaBLe7BOw$ or Androidhttps://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!LIr3w8kk_Xxm!4JY5BzZlw206zM0FtIFMkZGevCK1Cv1oVRpnI6uDsq6GDb1Lre4qkSbSd4nfjw$. You are receiving this because you are subscribed to this thread.Message ID: @.***>

njrhodes commented 2 years ago

Thanks Michael!

Unfortunately, using a different model or setting limits=NA does not help. I also tried changing up the number of clusters.

Do I need to re-download the npde package as per a previous thread or is that a part of the current version from Github?

njrhodes commented 2 years ago

I just looked at the m_data file and the covariate crcl has been updated to be a fixed value for each subject. The values are very different from the actual data file values. I wonder if this is contributing to the un-realistic simulated values....

mnneely commented 2 years ago

makeValid simulates twice - once based on the mean values for binned covariates, and doses for each bin, and again using the original values. This is to be able to do the prediction corrected VPC, which is the standard now. That’s why you’re seeing the CRCL value fixed.

Have you looked at the reference paper for pcVPC? Bergstrand M, Hooker AC, Wallin JE, Karlsson MO. 2011. Prediction-corrected visual predictive checks for diagnosing nonlinear mixed-effects models. The AAPS Journal 13:143–151. I attached it. It might help you understand what makeValid is doing.

Now why it’s crashing in this particular case is puzzling. Usually I find that the mean sims work fine, but the individual sims fail. Is there some weird distribution to CRCL so that the mean of a bin is an extreme value, or a very small bin? Can you tell which subject is causing the fail? Look at the simulated files written to the folder, and see where it crashed.


Michael Neely, MD, MSc, FCP | Chief, Division of Infectious Diseases Director, Laboratory of Applied Pharmacokinetics and Bioinformatics (www.lapk.orghttp://www.lapk.org), The Saban Research Institute, Children's Hospital Los Angeles 4650 Sunset. Blvd, #MS 176 | Los Angeles, CA 90027 Ph: 323.361.5047 | Fax: 323.361.1183 | @.**@.> www.chla.orghttp://www.chla.org

Professor and Clinical Scholar | Department of Pediatrics, Keck School of Medicine | University of Southern California www.usc.eduhttp://www.usc.edu

PubMed Bibliographyhttps://www.ncbi.nlm.nih.gov/sites/myncbi/michael.neely.1/bibliography/41159786/public/?sort=date&direction=descending

On Jan 7, 2022, at 7:23 AM, njrhodes @.**@.>> wrote:

I just looked at the m_data file and the covariate crcl has been updated to be a fixed value for each subject. The values are very different from the actual data file values. I wonder if this is contributing to the un-realistic simulated values....

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/LAPKB/Pmetrics/issues/51*issuecomment-1007492618__;Iw!!LIr3w8kk_Xxm!9DzSIymtSMdG-oP5ZQ2X0OKyY-51ceGqQciyT1GP4avX64HhwxrMvxIvKeJ8JA$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AB6CLTSEVLJCRA7NUKAAFSTUU4AO3ANCNFSM5LKS545A__;!!LIr3w8kk_Xxm!9DzSIymtSMdG-oP5ZQ2X0OKyY-51ceGqQciyT1GP4avX64HhwxrMvxJ8ypuSBA$. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!LIr3w8kk_Xxm!9DzSIymtSMdG-oP5ZQ2X0OKyY-51ceGqQciyT1GP4avX64HhwxrMvxJ8YeQ9gg$ or Androidhttps://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!LIr3w8kk_Xxm!9DzSIymtSMdG-oP5ZQ2X0OKyY-51ceGqQciyT1GP4avX64HhwxrMvxI9rjgtAQ$. You are receiving this because you commented.Message ID: @.***>

njrhodes commented 2 years ago

Looks like the simulation completes for all subjects but the values are problematic.

Perhaps makeValid() just should not be used on sparse data at all. Is that a fair conclusion?

mnneely commented 2 years ago

It definitely struggles with sparse data. Sounds like the simulation completes but as you say results in very extreme values that aren’t written correctly to the file, so the read chokes. Is this happening in the first step where each subject is simulated using the mean bin values for CRCL and dose for whatever bin that subject is in?

Can you find out where the “THE” is that is causing the problem in the output file?

How are such weird CRCL values arising? In the clustering, are some bins very extreme?


Michael Neely, MD, MSc, FCP | Chief, Division of Infectious Diseases Director, Laboratory of Applied Pharmacokinetics and Bioinformatics (www.lapk.orghttp://www.lapk.org), The Saban Research Institute, Children's Hospital Los Angeles 4650 Sunset. Blvd, #MS 176 | Los Angeles, CA 90027 Ph: 323.361.5047 | Fax: 323.361.1183 | @.**@.> www.chla.orghttp://www.chla.org

Professor and Clinical Scholar | Department of Pediatrics, Keck School of Medicine | University of Southern California www.usc.eduhttp://www.usc.edu

PubMed Bibliographyhttps://www.ncbi.nlm.nih.gov/sites/myncbi/michael.neely.1/bibliography/41159786/public/?sort=date&direction=descending

On Jan 7, 2022, at 8:19 AM, njrhodes @.**@.>> wrote:

Looks like the simulation completes for all subjects but the values are problematic.

Perhaps makeValid() just should not be used on sparse data at all. Is that a fair conclusion?

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/LAPKB/Pmetrics/issues/51*issuecomment-1007539166__;Iw!!LIr3w8kk_Xxm!5NPTiEksgPW4UXl2Gb5NgHwQerOMpD3htZ2pXxeIfN6T9eXyd_St4gb-uH6I5A$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AB6CLTTLDHZAHPE3VBAEKVLUU4HAPANCNFSM5LKS545A__;!!LIr3w8kk_Xxm!5NPTiEksgPW4UXl2Gb5NgHwQerOMpD3htZ2pXxeIfN6T9eXyd_St4ga4gf_APA$. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!LIr3w8kk_Xxm!5NPTiEksgPW4UXl2Gb5NgHwQerOMpD3htZ2pXxeIfN6T9eXyd_St4gY8hwvtrA$ or Androidhttps://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!LIr3w8kk_Xxm!5NPTiEksgPW4UXl2Gb5NgHwQerOMpD3htZ2pXxeIfN6T9eXyd_St4gYZwDRJYQ$. You are receiving this because you commented.Message ID: @.***>

njrhodes commented 2 years ago

Looks like maybe some subjects were very sparse indeed. We are analyzing outputs in batches and some don't have some of the data yet. So, I conclude that -99 values seem to not work well with the simulator. I removed subjects with missing values (-99) and it seems to be progressing in a more predictable manner.