From c46ae88c46f383aa9e130ec86b36eb240d10c651 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Thu, 28 Dec 2017 14:26:03 +0100 Subject: [PATCH 1/6] git: resolve conflict with master --- README.md | 152 ------------------------------------------------------ 1 file changed, 152 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index f63dff96..00000000 --- a/README.md +++ /dev/null @@ -1,152 +0,0 @@ - - -xpose -=============================================================================================================== - -[![travis\_status](https://travis-ci.org/UUPharmacometrics/xpose.svg?branch=master)](https://travis-ci.org/UUPharmacometrics/xpose) [![appveyor status](https://ci.appveyor.com/api/projects/status/f6k09rf2cfi3vcs2?svg=true)](https://ci.appveyor.com/project/guiastrennec/xpose)[![cran\_version](http://www.r-pkg.org/badges/version/xpose)]() [![codecov](https://codecov.io/gh/UUPharmacometrics/xpose/branch/master/graph/badge.svg)](https://codecov.io/gh/UUPharmacometrics/xpose) [![downloads](https://cranlogs.r-pkg.org/badges/grand-total/xpose)](http://cran.rstudio.com/web/packages/xpose/index.html) - -### Overview - -[xpose](https://UUPharmacometrics.github.io/xpose/) was designed as a [ggplot2](https://github.com/tidyverse/ggplot2)-based alternative to [xpose4](http://xpose.sourceforge.net). xpose aims to reduce the post processing burden and improve diagnostics commonly associated the development of non-linear mixed effect models. - -### Installation - -``` r -# Install the lastest release from the CRAN -install.packages('xpose') - -# Or install the development version from GitHub -# install.packages('devtools') -devtools::install_github('UUPharmacometrics/xpose') -``` - -### Getting started - -#### Load xpose - -``` r -library(xpose) -``` - -#### Import run output - -``` r -xpdb <- xpose_data(runno = '001') -``` - -#### Glance at the data object - -``` r -xpdb -``` - - run001.lst overview: - - Software: nonmem 7.3.0 - - Attached files (memory usage 1.3 Mb): - + obs tabs: $prob no.1: catab001.csv, cotab001, patab001, sdtab001 - + sim tabs: $prob no.2: simtab001.zip - + output files: run001.cor, run001.cov, run001.ext, run001.grd, run001.phi, run001.shk - + special: - - gg_theme: theme_readable - - xp_theme: theme_xp_default - - Options: dir = analysis/models/pk/, quiet = TRUE, manual_import = NULL - -##### Model summary - -``` r -summary(xpdb, problem = 1) -``` - - - Summary for problem no. 0 [Global information] - - Software @software : nonmem - - Software version @version : 7.3.0 - - Run directory @dir : analysis/models/pk/ - - Run file @file : run001.lst - - Run number @run : run001 - - Reference model @ref : 000 - - Run description @descr : NONMEM PK example for xpose - - Run start time @timestart : Mon Oct 16 13:34:28 CEST 2017 - - Run stop time @timestop : Mon Oct 16 13:34:35 CEST 2017 - - Summary for problem no. 1 [Parameter estimation] - - Input data @data : ../../mx19_2.csv - - Number of individuals @nind : 74 - - Number of observations @nobs : 476 - - ADVAN @subroutine : 2 - - Estimation method @method : foce-i - - Termination message @term : MINIMIZATION SUCCESSFUL - - Estimation runtime @runtime : 00:00:02 - - Objective function value @ofv : -1403.905 - - Number of significant digits @nsig : 3.3 - - Covariance step runtime @covtime : 00:00:03 - - Condition number @condn : 21.5 - - Eta shrinkage @etashk : 9.3 [1], 28.7 [2], 23.7 [3] - - Epsilon shrinkage @epsshk : 14.9 [1] - - Run warnings @warnings : (WARNING 2) NM-TRAN INFERS THAT THE DATA ARE POPULATION. - - Summary for problem no. 2 [Model simulations] - - Input data @data : ../../mx19_2.csv - - Number of individuals @nind : 74 - - Number of observations @nobs : 476 - - Estimation method @method : sim - - Number of simulations @nsim : 20 - - Simulation seed @simseed : 221287 - - Run warnings @warnings : (WARNING 2) NM-TRAN INFERS THAT THE DATA ARE POPULATION. - (WARNING 22) WITH $MSFI AND "SUBPROBS", "TRUE=FINAL" ... - -#### Generate diagnostics - -##### Standard goodness-of-fit plots - -``` r -dv_vs_ipred(xpdb) -``` - - - -##### Individual plots - -``` r -ind_plots(xpdb, page = 1) -``` - - - -##### Visual predictive checks - -``` r -xpdb %>% - vpc_data(stratify = 'SEX', opt = vpc_opt(n_bins = 7, lloq = 0.1)) %>% - vpc() -``` - - - -##### Distribution plots - -``` r -eta_distrib(xpdb, labeller = 'label_value') -``` - - - -##### Minimization diagnostics - -``` r -prm_vs_iteration(xpdb, labeller = 'label_value') -``` - - - -##### And many other features! - -### Recommended reading - -The [xpose website](https://UUPharmacometrics.github.io/xpose/) contains several useful articles to make full use of xpose - -When working with xpose, a working knowledge of ggplot2 is recommended. Help for ggplot2 can be found in: - -- The ggplot2 [documentation](http://docs.ggplot2.org/current/) -- The ggplot2 [mailing list](https://groups.google.com/forum/?fromgroups#!forum/ggplot2) -- Internet resources (stack overflow, etc.) From e5e407d16c4fc8249b0f4fd6fc6e3a31663c7bc5 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Thu, 28 Dec 2017 14:27:13 +0100 Subject: [PATCH 2/6] README: resolved conflict with master --- README.md | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..f63dff96 --- /dev/null +++ b/README.md @@ -0,0 +1,152 @@ + + +xpose +=============================================================================================================== + +[![travis\_status](https://travis-ci.org/UUPharmacometrics/xpose.svg?branch=master)](https://travis-ci.org/UUPharmacometrics/xpose) [![appveyor status](https://ci.appveyor.com/api/projects/status/f6k09rf2cfi3vcs2?svg=true)](https://ci.appveyor.com/project/guiastrennec/xpose)[![cran\_version](http://www.r-pkg.org/badges/version/xpose)]() [![codecov](https://codecov.io/gh/UUPharmacometrics/xpose/branch/master/graph/badge.svg)](https://codecov.io/gh/UUPharmacometrics/xpose) [![downloads](https://cranlogs.r-pkg.org/badges/grand-total/xpose)](http://cran.rstudio.com/web/packages/xpose/index.html) + +### Overview + +[xpose](https://UUPharmacometrics.github.io/xpose/) was designed as a [ggplot2](https://github.com/tidyverse/ggplot2)-based alternative to [xpose4](http://xpose.sourceforge.net). xpose aims to reduce the post processing burden and improve diagnostics commonly associated the development of non-linear mixed effect models. + +### Installation + +``` r +# Install the lastest release from the CRAN +install.packages('xpose') + +# Or install the development version from GitHub +# install.packages('devtools') +devtools::install_github('UUPharmacometrics/xpose') +``` + +### Getting started + +#### Load xpose + +``` r +library(xpose) +``` + +#### Import run output + +``` r +xpdb <- xpose_data(runno = '001') +``` + +#### Glance at the data object + +``` r +xpdb +``` + + run001.lst overview: + - Software: nonmem 7.3.0 + - Attached files (memory usage 1.3 Mb): + + obs tabs: $prob no.1: catab001.csv, cotab001, patab001, sdtab001 + + sim tabs: $prob no.2: simtab001.zip + + output files: run001.cor, run001.cov, run001.ext, run001.grd, run001.phi, run001.shk + + special: + - gg_theme: theme_readable + - xp_theme: theme_xp_default + - Options: dir = analysis/models/pk/, quiet = TRUE, manual_import = NULL + +##### Model summary + +``` r +summary(xpdb, problem = 1) +``` + + + Summary for problem no. 0 [Global information] + - Software @software : nonmem + - Software version @version : 7.3.0 + - Run directory @dir : analysis/models/pk/ + - Run file @file : run001.lst + - Run number @run : run001 + - Reference model @ref : 000 + - Run description @descr : NONMEM PK example for xpose + - Run start time @timestart : Mon Oct 16 13:34:28 CEST 2017 + - Run stop time @timestop : Mon Oct 16 13:34:35 CEST 2017 + + Summary for problem no. 1 [Parameter estimation] + - Input data @data : ../../mx19_2.csv + - Number of individuals @nind : 74 + - Number of observations @nobs : 476 + - ADVAN @subroutine : 2 + - Estimation method @method : foce-i + - Termination message @term : MINIMIZATION SUCCESSFUL + - Estimation runtime @runtime : 00:00:02 + - Objective function value @ofv : -1403.905 + - Number of significant digits @nsig : 3.3 + - Covariance step runtime @covtime : 00:00:03 + - Condition number @condn : 21.5 + - Eta shrinkage @etashk : 9.3 [1], 28.7 [2], 23.7 [3] + - Epsilon shrinkage @epsshk : 14.9 [1] + - Run warnings @warnings : (WARNING 2) NM-TRAN INFERS THAT THE DATA ARE POPULATION. + + Summary for problem no. 2 [Model simulations] + - Input data @data : ../../mx19_2.csv + - Number of individuals @nind : 74 + - Number of observations @nobs : 476 + - Estimation method @method : sim + - Number of simulations @nsim : 20 + - Simulation seed @simseed : 221287 + - Run warnings @warnings : (WARNING 2) NM-TRAN INFERS THAT THE DATA ARE POPULATION. + (WARNING 22) WITH $MSFI AND "SUBPROBS", "TRUE=FINAL" ... + +#### Generate diagnostics + +##### Standard goodness-of-fit plots + +``` r +dv_vs_ipred(xpdb) +``` + + + +##### Individual plots + +``` r +ind_plots(xpdb, page = 1) +``` + + + +##### Visual predictive checks + +``` r +xpdb %>% + vpc_data(stratify = 'SEX', opt = vpc_opt(n_bins = 7, lloq = 0.1)) %>% + vpc() +``` + + + +##### Distribution plots + +``` r +eta_distrib(xpdb, labeller = 'label_value') +``` + + + +##### Minimization diagnostics + +``` r +prm_vs_iteration(xpdb, labeller = 'label_value') +``` + + + +##### And many other features! + +### Recommended reading + +The [xpose website](https://UUPharmacometrics.github.io/xpose/) contains several useful articles to make full use of xpose + +When working with xpose, a working knowledge of ggplot2 is recommended. Help for ggplot2 can be found in: + +- The ggplot2 [documentation](http://docs.ggplot2.org/current/) +- The ggplot2 [mailing list](https://groups.google.com/forum/?fromgroups#!forum/ggplot2) +- Internet resources (stack overflow, etc.) From c95346ee3554304c00d13f71af61e12615679ead Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 3 Jan 2018 10:11:34 +0100 Subject: [PATCH 3/6] summarise_nm_model: fixed bug with non numeric covariance time and improved compatibility with NM7.4 --- R/summarise_nm_model.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/summarise_nm_model.R b/R/summarise_nm_model.R index 3eccb159..bf810372 100644 --- a/R/summarise_nm_model.R +++ b/R/summarise_nm_model.R @@ -317,7 +317,7 @@ sum_runtime <- function(model, software) { if (software == 'nonmem') { x <- model %>% dplyr::filter(.$subroutine == 'lst') %>% - dplyr::filter(stringr::str_detect(.$code, stringr::fixed('Elapsed estimation time'))) + dplyr::filter(stringr::str_detect(.$code, 'Elapsed estimation\\s+time')) if (nrow(x) == 0) return(sum_tpl('runtime', 'na')) @@ -336,7 +336,7 @@ sum_covtime <- function(model, software) { if (software == 'nonmem') { x <- model %>% dplyr::filter(.$subroutine == 'lst') %>% - dplyr::filter(stringr::str_detect(.$code, stringr::fixed('Elapsed covariance time'))) + dplyr::filter(stringr::str_detect(.$code, 'Elapsed covariance\\s+time in seconds:\\s+\\d')) if (nrow(x) == 0) return(sum_tpl('covtime', 'na')) From 994be6668ddc46cba433b8e3d0ab34a94eab66eb Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 3 Jan 2018 10:20:39 +0100 Subject: [PATCH 4/6] tests: added test for non numeric covtime --- tests/testthat/test-model-summary.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/testthat/test-model-summary.R b/tests/testthat/test-model-summary.R index b8c76f77..525c03cb 100644 --- a/tests/testthat/test-model-summary.R +++ b/tests/testthat/test-model-summary.R @@ -71,6 +71,9 @@ test_that('summary default summary is returned for missing information', { expect_equal(sum_out(sum_subroutine(model2, software)), c('subroutine', 'na')) expect_equal(sum_out(sum_runtime(model2, software)), c('runtime', 'na')) expect_equal(sum_out(sum_covtime(model2, software)), c('covtime', 'na')) + expect_equal(sum_out(sum_covtime(model = dplyr::data_frame(problem = 1L, level = 1L, subroutine = 'lst', + code = 'Elapsed covariance time in seconds: ********', + comment = ''), software), 1), c('covtime', 'na')) expect_equal(sum_out(sum_term(model2, software)), c('term', 'na')) expect_equal(sum_out(sum_warnings(model2, software)), c('warnings', 'na')) expect_equal(sum_out(sum_errors(model2, software)), c('errors', 'na')) From 1f3f0365cedd0c15a121cf01a297ad0f442d654f Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 3 Jan 2018 21:18:35 +0100 Subject: [PATCH 5/6] get_prm: force RSE to be positive --- R/xpdb_access.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/xpdb_access.R b/R/xpdb_access.R index e907a28f..5f1b334f 100644 --- a/R/xpdb_access.R +++ b/R/xpdb_access.R @@ -396,7 +396,7 @@ get_prm <- function(xpdb, stringr::str_detect(.$name, 'SIGMA') ~ 'sig'), number = stringr::str_replace_all(.$name, '[^\\d,]+', ''), se = ifelse(.$fixed, NA_real_, as.numeric(.$se)), - rse = ifelse(.$fixed, NA_real_, as.numeric(.$rse))) %>% + rse = ifelse(.$fixed, NA_real_, abs(as.numeric(.$rse)))) %>% tidyr::separate(col = 'number', into = c('m', 'n'), sep = ',', fill = 'right') %>% dplyr::mutate(diagonal = dplyr::if_else(.$m == .$n, TRUE, FALSE)) %>% dplyr::rename_(.dots = list(value = 'mean')) %>% From 3df3da3f35b374c26a2b8a5c6f53d01d5e98c1ea Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 3 Jan 2018 21:22:35 +0100 Subject: [PATCH 6/6] News: updated --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 44e36890..5e58a272 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,7 +5,9 @@ * Fixed bug in `summary()` where missing estimation method was reported if NM code written as METH=... instead of METHOD=... * Fixed bug where labels in `prm_table()`, `get_prm()` were missing with a commented row in $THETA, $OMEGA or $SIGMA * Fixed bug in `prm_table()`, `get_prm()` where only `NA` would be reported when missing the -1000000006 record in the .ext file (i.e. NM <7.3) +* Prevented negative RSE in `prm_table()` and `get_prm()` * Improved description of the `prm_table()` output +* Fixed bug in `summary()` with non numeric covariance step time * Fixed bug in `ind_plots()` where the aesthetics would get mixed up if the variable names were changed * Small fixes to vignettes, documentations and website