Stepwise Covariate Modeling for 'nlmixr2' Models
Overview
Stepwise covariate modeling (SCM) for nonlinear mixed-effects models fitted with 'nlmixr2'. Forward inclusion and backward elimination are driven by likelihood-ratio tests, and the covariate terms are generated inside the model body, so continuous covariates are centered and categorical covariates expanded into indicator columns without editing the model by hand. Candidate fits can be cached and resumed, fitted in parallel, and reviewed through per-step and all-candidate summary tables. The approach follows Jonsson and Karlsson (1998) doi:10.1023/A:1011970125687, and the implementation in 'Perl-speaks-NONMEM' described by Lindbom, Ribbing and Jonsson (2004) doi:10.1016/j.cmpb.2003.11.003.
runSCM()results now have class"nlmixr2scm", with newsummary()andprint()methods.summary()reports the options used for the search, a comparison of the base, final forward and final backward models (OFV, dOFV, AIC, BIC, parameter count and SCM covariates), the step and all-candidate tables, and the location of saved models and report files on disk.print()gives a short overview. The result gainsbaseFit,optionsandoutputDirelements; the existingsummaryTable,resFwdandresBckelements are unchanged.runSCM()gained aretryOnUnderflowargument (defaultTRUE, appended as the last parameter to preserve positional calls). The retry mechanism treats a forward candidate whose p-value underflows to zero as an unrealistic OFV; fordf = 1that is any OFV drop above about 70, so genuinely strong covariate effects were always retried. SetretryOnUnderflow = FALSEto skip that criterion and the extra fits; the OFV-increase andmaxDeltaOFVcriteria are unaffected.
Show all changes in 0.4.1Hide the rest of the changes in 0.4.1
- Fixed a bug in the forward search mixing two
dOFVsign conventions. Since 0.3,dOFViscandidate OFV - reference OFV(negative = improvement), but the profile-on-stall rescue, retry best-attempt tracking and p-value tie-break still assumed the pre-0.3 "positive = improvement" sign. As a result: - every improving forward candidate was treated as stalled and refitted (roughly tripling forward-search run time), and the rescue refit was accepted even when it reached a worse OFV than the original fit;
- rescued candidates were reported with a flipped
deltObjfsign, sosummaryTableand the printed "Ref OFV" column were inconsistent; - when all retries were exhausted, the attempt with the highest OFV was kept instead of the lowest;
- p-value underflow ties were broken in favour of the smallest OFV drop instead of the largest.
From NEWS.md in the release
Install
Health
- OK13 OK2026-10-03
- ERROR5 OK, 1 ERROR2026-09-25
Documentation
- Help pages
- 3 (1 internal)includes a package overview page
- Examples that run
- 0%2 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 100%
- Documented parameters
- 94%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 92%
- Median days to close, 50 most recently updated closed issues
- 28
- Median days to close, 50 most recently updated closed PRs
- 4
PRs over time
Commits over time
4 development-tooling and community-health practices detected across 3 families in the upstream repository
Checks run against github.com/nlmixr2/nlmixr2scm on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
This repository shows signs of AI coding tools.
- Claude Codefirst seen on or before 2026-04-26Named in .Rbuildignore: .claudeNamed in .gitignore: .claudeCommits: at least 18 crediting it in the message
- Claude CodePull requests: 1 from outside contributors, first on 2026-07-24, 1 from forks
- Claude Sonnet 4.611 commits · May to Jun 2026
- Claude Sonnet 56 commits · Aug 2026
- Claude Fable 51 commit · Jul 2026
Dependencies
Installing nlmixr2scm adds 73 packages (44 with compiled code, 73 MB of source tarballs). Heaviest: BH 14 MB, stringi 11 MB, ggplot2 6.0 MB.
CRAN will archive these unless their check problems are fixed by the date shown. This package needs each one to install.
- nlmixr2estfix by Oct 23
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.4.1Latest
- 0.42026-09-24
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-09-24
- Total releases
- 2 / 1 yrs
- License
- GPL (>= 3) OSI
- Minimum R
- ≥ 4.1
- Download size
- 115 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("nlmixr2scm")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.
From data release v2026-10-19, which the citation names so these numbers can be found later. More on citing and the projects behind them.