Skip to content

Understanding Nonlinear Mixed Effects Modeling for Population Pharmacokinetics

0packages depend
4.4Kdownloads / year
–test coverage
13/13flavors OK

Overview

About

This shows how 'NONMEM' (Beal SL, Sheiner LB, Boeckmann AJ, Bauer RJ. NONMEM 7.5 Users Guides. Icon plc, 2020) software works. 'NONMEM' classical estimation methods such as 'First Order (FO) approximation', 'First Order Conditional Estimation (FOCE)', and 'Laplacian approximation' are explained. Functions are also provided for post-run processing of NONMEM output files, generating PDF or Markdown diagnostic reports including objective function value analysis, parameter estimates, prediction and residual diagnostics, empirical Bayes estimate (EBE) analysis, input data summary, and individual pharmacokinetic parameter distributions. Helper utilities for building NONMEM-ready datasets from SDTM-style source tables are also included.

Changes in 0.6.0
  • Requires simPDF 0.1.2. Report generation could stop with "attempt to apply non-function" when a block's height equalled the space left on the page to within floating-point error; that was a defect in simPDF 0.1.1, fixed in 0.1.2, and the report writer now relies on the fix instead of working around it.
  • The eight diagnostic report functions and nmw_run() gain a format argument: "pdf" (default), "md", or c("pdf", "md"). With "md" the report is written as a Markdown file (the file name with its extension replaced by .md): headings, text, preformatted dumps and tables become GitHub-flavoured Markdown, and every figure page or inline plot is saved as an SVG file (or PNG with fig_format = "png") in a sibling <name>_files directory and linked from the Markdown. The directory is emptied before each run.
  • Outline() gains Target = "md": the model development flow diagram is written as a Markdown file (file, default <MDLName>-Model-Flow.md) with the diagram as an SVG (or PNG, fig_format) figure followed by the table of runs from SumOut(). The figure is sized to the tree (about 1.6 in per leaf column), so folders with dozens of sibling runs stay legible. The default Target = "PDF" still draws on the graphics device opened by the caller, as before; when no device is open (e.g. under Rscript) it now writes a PDF sized to the tree instead of failing. SumOut() no longer aborts on a run folder it cannot summarise (e.g. the empty .ext of a simulation run, or a corrupt output file): the run is listed with Reason = "NOESTIMATION" or "UNREADABLE" and a warning names it, and GetEstMethod() returns NA for an empty .ext.
  • The report functions now describe their content with a small internal block layer (R/report_writer.R) that is rendered to simPDF for the PDF and to Markdown for the .md. The statistics and the PDF layout are unchanged.
  • Fixed: headings of blocks that nmw_report_resid() and nmw_report_ebe() build in loops showed the last loop value in the PDF, because simPDF::block_para() evaluates its text lazily. In 0.5.x all three residual-count sections of S4-Residuals.PDF were titled "IWRES" and all extreme-value tables "Extreme IWRES values", and in S5-EBE.PDF every matrix in "Estimation vs EBE" was titled "Ratios of Cor(EBE)/(Cor from OM)" and every ETA section "ETA <last>". The new block layer evaluates text when the block is built.
  • Fixed: nmw_report_indipk() drew its "Individual PK Parameters" heading and the first rows of the table onto the last figure page, where they were invisible, and only the overflow rows reached a fresh page. Flowing text that follows figure pages now always starts on a new page. The report also gained a title page ("Summary C - Individual PK Parameters"), like S3-Predictions.PDF.
  • nmw_report_ebe() drops continuous covariates whose per-subject values are all equal (for example nominal time, day or occasion counters that start at the same value for every subject) from the covariate/EBE correlation matrix, the regressions and the ETA-vs-covariate panels. They produced all-NA rows and columns and flat panels.
  • nmw_report_param() recognises runs without a successful $COV step (no <nm:thetase> in the XML): SE, LL, UL, ZERO and ONE are reported as NA with an explanatory note, fixed thetas are identified from the .ext fixed-parameter row, and the Omega SE/RSE matrices are replaced by a note. Previously such runs showed SE = 0 for every theta and RSE of about 1e+12 for every omega. With a $COV step, fixed or structurally zero Omega elements are now shown as NA in the SE and RSE matrices instead of 1e+10 and Inf.
  • nmw_report_ebe() shows NA instead of +/-Inf in the "Ratios of Cov(EBE)/OM" and "Ratios of Cor(EBE)/(Cor from OM)" matrices where the Omega element is zero, and in the individual RSE column where an ETA is exactly zero (e.g. an inter-occasion ETA of an absent occasion).
  • Robustness fixes found by regenerating the reports for several hundred real runs: the ETA distribution panels no longer fail when an ETA has fewer than two non-zero values (e.g. an inter-occasion ETA in a single-occasion sensitivity run) or is constant; the pairs-plot panels restore par("usr") correctly (they emitted "argument 1 does not name a graphical parameter" on every S5 report); TAB characters in preformatted text (e.g. the summary.lm R-squared line) are expanded to spaces instead of triggering "font width unknown" warnings; and large matrices or tables are no longer forced onto one page with their heading, which overflowed the page for models with many ETAs and covariates.
  • Data sets of $PRED models that lack MDV and/or AMT (for example the bundled theophylline examples) no longer make S1, S3, S4, S5 and SA fail with "undefined columns selected" or "subscript out of bounds": the missing items are added with NONMEM's implicit values (AMT = 0; MDV = 1 for dosing records, otherwise 0), an sdtab without MDV or CMT takes them from the record-aligned data set, and SA-Input notes which items were assumed and skips the "Individuals with no dosing" check when the data set has no AMT. ETAs that are zero for every subject are omitted from the covariate/EBE correlation matrix with a note instead of producing all-NA rows. The EBE regression no longer fails when there is exactly one covariate (RemoveNA() now keeps a one-column input as a data frame and accepts plain vectors).
  • nmw_report_ebe() writes a short report stating that no empirical Bayes estimates are available when all ETAs in the .phi file are zero (First Order estimation) and patab is missing or also all zero, instead of failing.
Show all changes in 0.6.0Hide the rest of the changes in 0.6.0
  • Text that is not valid UTF-8, such as control-stream comments in a legacy code page that NONMEM echoes into PRINT.OUT, no longer crashes R when drawn on the PDF device: it is converted from the code page in getOption("nmw.codepage") (default "CP949") when that yields valid text, otherwise the offending bytes are shown as <xx>.
  • IPRE is optional in sdtab (e.g. a PD model without IPRED in $TABLE): S3-Predictions omits the IPRE panels and curves with a note, and S4-Residuals plots CWRES and IWRES against PRED. IPRED, IWRES and CWRESI are accepted for IPRE, IWRE and CWRES. The influence-diagnostic panels of S5-EBE skip non-finite values instead of failing on ylim. A malformed table file (e.g. one containing merge-conflict markers) is reported by name.
  • Worked around a simPDF (<= 0.1.1) edge case in which a block whose height equals the remaining page space up to floating-point error made the flow fail with "attempt to apply non-function" after the block had been drawn; the report writer now places blocks one at a time and continues.
  • Missing run files now give a clear error naming the file, the run directory and the report that needs it (e.g. patab for SC-IndiPK, sdtab for S3/S4/S5, FDATA.CSV for the data-based reports) instead of "cannot open the connection". FDATA.csv is accepted as well as FDATA.CSV on case-sensitive file systems.
  • nmw_report_pred() and nmw_report_indipk() no longer open a graphics device (Rplots.pdf under Rscript) when none is open: the caller's par() state is saved and restored only if a device exists.
  • Tables of individuals always carry an explicit ID column: the "Individual Statistics", "Individuals with no dosing" and "Individuals with no DV" tables of SA-Input (previously the ID was the row name, which was dropped when the IDs were 1..n), the "Variable Statistics" table gains a Variable column, and SC-IndiPK takes the subject IDs from the record-aligned data set when patab was written without ID.
  • The invisible return value of every report function now also contains md_file and figures; file and pages are NA when no PDF was requested.

From inst/NEWS.Rd in the release

Install

Health

CRAN checks
13OK
Slowest check: 2.0 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-06-09
  • NOTE12 OK, 1 NOTE2026-06-08
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 0.6.0
READMENoVignettesNoNEWSYes · mentions 0.6.0Citation fileNoWebsitenot declared in DESCRIPTION
Help pages
109 (52 internal)includes a package overview page
Examples that run
43%3 run in a plain check · 1 never run · 3 hold no code
Exported functions with examples
10%
Documented parameters
100%
Return-value docs
90%
Help pages citing references
6%

Downloads

4.4K
CRAN downloads in the past year
Rank #8,066 · ~12/day · ~367/mo
Daily download trend is not available in this view yet.
51230 days
1.1K90 days
4.4K1 year
Compare downloads with other packages →
Also on110 r2u2 autocran128 c2d4u

Dependencies

Declared dependencies
3 external dependencies (excludes base and recommended)

Installing nmw adds 2 packages (0 with compiled code, 121 KB of source tarballs). Heaviest: numDeriv 74 KB, simPDF 47 KB.

Depends (2)
R >= 3.6.0numDeriv
Imports (6)
simPDFMASSgrDevicesgraphicsstatsutils
LinkingTo (0)
none
Suggests (1)
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (1)
Author, Maintainer since 0.1.1 (2017)
Releases (10)

Pick two releases to compare their code metrics.

  • 0.6.0Latest
    record
    2026-09-20 · current release · diff ↗
  • 0.5.1
    record
    2026-06-09 · diff ↗ ·
    removed 5 exports
    AddPage, ClosePDF, PrepPDF, PrinMTxt, PrinTxt
    added 2 exports
    ctl2nmw, e
  • 0.3.1
    record
    2026-06-09 · diff ↗
  • 0.3.0
    record
    2026-05-08 · diff ↗ ·
    added 12 exports
    add_crcl_cg, build_dose_records, build_nm_dataset, build_obs_records, code_race, code_sex, crcl_cg, dat2_time_to_posix, locf_value, merge_cov_locf, nm_to_molar, parse_dtc
  • R
    R 4.6.0 released · 2026-04-24
  • 0.2.0
    record
    2026-04-07 · diff ↗ ·
    removed 1 export
    pattern:^[[:alpha:]]+
    added 65 exports
    AddCox, CalcSmat, CombDmExPc, CovStep, DECN, DesclVar, EstStep, InitStep, Mx, Obj, ObjEta, Oi, Oi0, Oi1, OiS0, OiS1, PostHocEta, ScaleVar, SqrtInvCov, TabStep, TrimOut, ltv2mat, mat2ltv, mat2utv, utv2mat, AddDoNoTaLD, AddPage, BtwTagMat, BtwTagVals, ClosePDF and 35 more
  • 0.1.6
    record
    2026-03-08 · diff ↗
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • 0.1.5
    record
    2023-05-10 · diff ↗
  • R
    R 4.3.0 released · 2023-04-21
  • R
    R 4.2.0 released · 2022-04-22
  • R
    R 4.1.0 released · 2021-05-18
  • R
    R 4.0.0 released · 2020-04-24
  • R
    R 3.6.0 released · 2019-04-26
  • R
    R 3.5.0 released · 2018-04-23
Show 5 earlier eventsHide 5 earlier events
  • 0.1.4
    record
    2018-04-10 · diff ↗
  • 0.1.2
    record
    2017-10-20 · diff ↗
  • R
    R 3.4.0 released · 2017-04-21
  • 0.1.1
    record
    2017-03-14
  • R
    R 3.3.0 released · 2016-05-03

Package metadata

First published
2017-03-14
Total releases
10 / 9 yrs
License
GPL-3 OSI
Copyright
2017-, Kyun-Seop Bae
Minimum R
≥ 3.6.0
Download size
227 KB
Appears in task views

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("nmw")
Bae, K. (2026). nmw: Understanding Nonlinear Mixed Effects Modeling for Population Pharmacokinetics (Version 0.6.0) [Computer software]. https://doi.org/10.32614/CRAN.package.nmw

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for nmw version 0.6.0 [Data set]. HJJB, LLC. Data release v2026-10-21. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy