nlmixr2est 4.1.1
CRAN release: 2025-10-09
Request nlmixr2est’s pre-processing hooks for
augPred(),vpcSim()and$simInfo, which fixes augPred in cases whereetas=0are used innlmixr2(#587)Fix scale.h so that
scaleType="none"does not also requirescaleTo=0Request Armadillo 15 with the special flag in the new
RcppArmadilloFix
foceiwithout etas (and without log-likelihood normal) to runELS(See #590).-
Change the IOV implementation (#596):
- Now shows estimates as
CV%orsdwithout shrinkage calculation. - Allow different forms of
iovestimation, controlled byiovXform. - Retains the
iovparameter(s) in the outputdata.frame. - With
iov, the$omegashows a list of variability by the conditioning variable(s). -
fit$iovwill show the IOV deviations by the conditioning variables(s) with the exception ofid - IOV models can be used in other estimation methods and inherits the ETA values.
- Now shows estimates as
Added
$etaMatmethod fornlmixr2fits to give the value that needs to be passed between each estimation method (related to iov #596)
nlmixr2est 4.1.0
CRAN release: 2025-08-29
Updated inferring the estimation method from the control object. Requires the control object to have a class of length one and match the estimation method. For example
foceiControl()would assume that the estimation method is related tofocei.Changed Rstudio completion to not evaluate (in case it gets turned on for data.frames) (See #568)
Turned on data completion for items like
$fitMergeInnerBreaking change: Changed the estimation method
posthocto add tables and calculate the covariance by default. It is now a method with it’s own control,posthocControl(). As previously the default is not to include the interaction term (but you can turn it on withposthocControl(interaction=TRUE)).Added
foceControl(),foControl()andfoiControl()for thefoce,foandfoimethods, respectively. They try to convert the related control structures to the correct control structure for the estimation method.Added iov support for
focei,foce, andsaem(#614)Added new estimation method
agqwhich uses adaptive Gauss-Hermite Quadrature to fit a nonlinear-mixed effect model. In this method, you can choose the number of quadrature points to estimate the likelihood, with higher numbers giving more accurate likelihoods. The AGQ implementation in nlmixr2est allows you to specify the number of quadrature points via theagqControl()function, and supports both single and multiple subject models. This method is particularly useful for models where accurate likelihood estimation is critical.Also added a
laplacemethod which is the same asagqwith 1 node (and is numerically the same asfocei,foceor log-likelihoodfocei/laplace, etc), but uses theagqroutine.Fixed saem mu-reference display by not compressing the internal item
saem0.
nlmixr2est 4.0.2
CRAN release: 2025-07-24
The loading and unloading of DLLs has been minimized in this version of nlmixr2est. This avoids loading/reloading the same DLLs and causing the CRAN mac m1 ASAN/USBAN false positive issue observed in CRAN.
Additionally a new function
nlmixr2fix(fit)has been added tonlmixr2est. It attempts to make the fit loaded from a different version of nlmixr2 compatible with nlmixr2 4.0. It also prints out the versions ofnlmixr2that were used when creating this fit. With this information you are more likely to find a way to use the fit in your current session (or in an old session). (Issue #562)
nlmixr2est 4.0.1
CRAN release: 2025-07-19
- Initialize lbfgsb3 error message to an empty string to address valgrind finding (as requested by CRAN).
nlmixr2est 4.0.0
CRAN release: 2025-07-15
When using a model to start a new focei model, the ETAs from the last fit are used as the starting point. Now you can use
foceiControl(etaMat=NA)to skip this and useeta=0for all items.When using
foceiControl(etaMat=fit), this will extract the ETAs from a fit for use in the next optimization.When using a
foceiControl(etaMat=)option nlmixr2 no longer only evaluates the inner problem with theetaMatvalue.-
Add
mcetaoption to"focei".-
mceta=-1is the default; the eta restarts at the best eta from the last step to start the inner optimization. -
mceta=0the eta starts at0to start the inner optimization. -
mceta=1the eta starts at either0or the besteta, which ever gives the lowest objective function to start the inner optimization. -
mceta=nunder the assumption ofomegasamplen-1etavalues and use the lowest objective function of eta sampled, last best eta and eta=0 to start the inner optimization.
-
Fix Rstudio print (issue #536)
Support rxode2’s new
+var()definition insaemSupport literal fixing of residuals (#524). All methods that support a literal fix of residuals have an option
literalFixReswhich defaults toTRUE. To get the behavior from older models you can useliteralFixRes=FALSE
nlmixr2est 3.0.4
CRAN release: 2025-02-18
More robust covariance calculation in
focei.Allow hook mechanism to handle piped arguments.
Fix for when output message from optimizing doesn’t print well (#325)
nlmixr2est 3.0.3
CRAN release: 2025-01-18
Moved data check for covariates and required data items to a pre-processing step. This fixes #499. Each method that needs to have a covariate check needs to have a property
covPresent. For example to apply the covariate data check to thefoceimethod you needattr(nlmixr2Est.focei, "covPresent") <- TRUE.Bug fix for non-mu referenced etas when combined with mu referenced covariate values. (See #498)
Changed option for
"saem"to haveliteralFix=FALSE. This makes mu-referencing work better when fixing a population value.
nlmixr2est 3.0.2
CRAN release: 2024-11-23
Fix bug where models where omega boundary warnings caused problems in estimation (#490)
Created a new api for pre-processing ui, allowing adding arbitrary hooks. As written now, this includes literal fix and zero omega as well as added the new rxode2 ui processing.
Fixed compilation to only use -I in most systems for maximum compatibility
nlmixr2est 3.0.1
CRAN release: 2024-10-22
New features
Now when optimizing only a single parameter with
focei-family, will change to usestats::optimize()for the outer problem (#481)When estimating with all fixed population parameters, do a posthoc estimation.
Internally removed
assignInMyNamespace()replacing withnlmixr2global, which fixes some edge case bugs where the nlmixr2 environment was not reset properly.Treated edge case where all initial parameters are zero and change scaling from scaled to unscaled (#486)
Added
mu4 referencing that will change string expressions torxode2numeric values. This allows derived strings to also be treated asmuexpressions (#484)
Bug Fixes
- Fix
foceicovariance step when manyomegavalues are fixed #482
nlmixr2est 3.0.0
CRAN release: 2024-09-18
No binary linking to
rxode2,lbfgsb3candn1q1, which means that updating these will not makenlmixr2estcrash without recompiling.New
mu3 referencing will take context from the model to see if the algebraic expression can be completed from defined model variables; These variable would have to be unique.
nlmixr2est 2.2.2
CRAN release: 2024-05-28
Breaking changes
Saem non-mu reference input parameters/covariates were fixed so they work correctly with fixed parameters (Issue #445)
Focei changed back to having a lower bound for standard deviations when not specified. This means that best model fits may change. You can revert to the old settings by using
foceiControl(sdLowerFact=0.0). You can also change the factors to other values than the default value, that isfoceiControl(sdLowerFact=0.000001)for instance which would multiply the initial value by0.000001when either the lower bound isn’t specified or the lower bound is specified as zero for the error estimates related to error-based standard deviations.-
In
nlmixr2, expressions are optimized. Because of that optimization, numerical rounding differences can cause different directions in optimization when fixing parameters in the model vs. fixing the parameters manually.This means that the fixed parameters in a model vs hard-coded fixed parameters could give different values in the final model.
A new option
literalFixwas introduced which change the fixed population parameters to constants in the model while running the optimization. This makes the output of fixing within the model and fixing manually the same (which is what is likely expected). The default is for this to be turned on (ie.literalFix=TRUE). You can get back the old behavior by using the optionliteralFix=FALSE. In
saem, the monte-carlo sampling occurs for all parameters including non-informative ETAs. A fix ensure that non-informative etas insaemare fixed to zero while sampling thephivalues. This may change results for models with uninformative etas. To ignore the uninformative etas withsaemyou ca use use the priorsaemhandling withsaemControl(handleUninformativeEtas=FALSE).
New features
Gracefully degrade when $cov is not in the right form (see #423)
Add support for PopED in place solving (used in babelmixr2)
If
est=foceiControl()or other nlmixr2 control with the classfoceiControlinfer the estimation method isfoceiAdd back the warnings when estimation methods ignore the boundaries
When using
rxSolve, now respects the values fromtableControl()(#465 and #297)
Bug fixes
- Will emit warnings when the return object is not a nlmixr2 fit (#453)
nlmixr2est 2.2.1
CRAN release: 2024-01-31
- Align with the possibility that linCmt sensitivities may not be present (like intel c++)
Bug fix
-
foceicache needs to be based on the parameter order as well as the model information (#415)
nlmixr2est 2.2.0
CRAN release: 2023-12-12
New Features
Algebraic mu referencing has been implemented in
nlmeandsaem.New estimation method “nlm” has been added to estimate population only likelihoods using
stats::nlmand possibly return a standardizednlmixr2fit.New estimation method “nls” has been added to estimate population only problems. This uses
minpack.lm::nlsNMby default if present, or thestats::nlsNew estimation method “optim” has been added to estimate population only likelihoods. This uses
stats::optimand returns a standardizednlmixr2fit.New estimation method “nlminb” has been added to estimate population only likelihoods. This uses
stats::nlminband returns a standardizednlmixr2fit.New estimation methods from the
minqapackage: “bobyqa”, “uobyqa” and “newuoa” have been added to estimate population only likelihoods. These methods returns a standardizednlmixr2fit.New estimation method “lbfgsb3c” to estimate population only likelihoods. This returns a standardized
nlmixr2fit.New estimation method “n1qn1” to estimate population only likelihoods. This returns a standardized
nlmixr2fit.Added new feature for
vpcSim()where a minimum number of subjects are simulated from the model when trying to fill in ODEs that were not solved successfully. By default this is10. This also works-around a bug when there is only one subject simulated and thedata.framehas a slightly different output.
Breaking changes
Removed
fit$saemTransformedDatasince it isn’t actually used insaemanymore (but will break anyone’s code who is using it)Now the internal function
.foceiPreProcessData()requires the rxode2 controlrxControl()because some of the new steady state lag features need to translate the data differently based onrxControl()options.
Bug fixes
Printing models with correlated omega values and omega values fixed to zero no longer fails (#359)
Add back values for $parHistData (#368)
This requires a new
rxode2which will fix multiple endpoint issues observed (#394)Manual back-transformed values in
$parFixedare now displaying correctly and are calculated based on the confidence interval in the control instead of 95% confidence no matter what (#397)
nlmixr2est 2.1.8
CRAN release: 2023-10-08
- Version bump and a minor documentation update (same as nlmixr2est 2.1.7). This version bump is to simply allow correct binary linkage to rxode2 2.0.14. Otherwise
nlmixr2models will crash R.
nlmixr2est 2.1.7
CRAN release: 2023-09-18
As requested by CRAN, remove
RvmminValues in
$parFixedfor BSV without exponential transformation are now correctly shown (#366)
nlmixr2est 2.1.6
CRAN release: 2023-05-25
Breaking changes
- Since
rxode2now allows simulation withomegahaving diagonal zero elements,$omegaand$omegaRnow reflects this information including the zero omega elements in the output. On the other hand, the other eta-information and standard error information for zero etas are still excluded in$phiR,$phiSE,$etaetc.
nlmixr2est 2.1.5
CRAN release: 2023-04-22
Add
$fitMergeFull,$fitMergInner,$fitMergeLeft,$fitMergeRightas a complement to$dataMergeFull,$dataMergInner,$dataMergeLeft,$dataMergeRight. The fit variants prefer columns in the fit dataset instead of the original dataset. This is useful for goodness of fit plots with censoring since theDVin the fit simulates values under the ipred/residual assumption and will give more appropriate goodness of fits, otherwise these values are the limit of whatever censoring is appliedMoved the mu reference fix for the split mu referenced model here (from babelmixr2)
nlmixr2est 2.1.4
CRAN release: 2023-04-02
Breaking change, now calculate condition number based on covariance and correlation, the names have changed to be more explicit.
conditionNumberchanged toconditionNumberCovand a new metricconditionNumberCorhas been added.A bug in boundary value detection prevented automatic covariance calculation with FOCEi estimation (#318)
Fix
vpcSimso that it will be a bit more robust when it is difficult to simulate.A bug in model piping which did not allow models to be appended to was fixed (rxode2#364)
An internal change was made in
nlmixr2.rxUi()to better support the babelmixr2 PKNCA estimation method (babelmixr2#75)Fixed bug where
$iniUidid not return the initial ui when running nonfoceirelated methods. Also added alias of$uiInito the same function.Dropped Stan headers for this package, also updated to C++17
nlmixr2est 2.1.3
CRAN release: 2022-11-10
Allows
$etaHand related family to be integrated into asaemfit ifcwresis calculated.Fixed a bug where
nlmixrLlikObsin the merged dataset is sometimes namedllikObs, now it is always namednlmixrLlikObsFixed a bug where
nlmixrLlikObsshows up in merged dataset whencwresis not calculated (it was always0), also allowcwrescalculation to pick upnlmixrLlikObsin merged dataset.Dropped
dparserdependency
nlmixr2est 2.1.2
CRAN release: 2022-11-02
Fixes
$etaHmemory corruption so the standard errors of etas are now correctRemoved the memory requirements for focei by
neta*neta*nsubFixed character based covariates so the work correctly (again) with focei. Added a test for this as well.
nlmixr2est 2.1.1
CRAN release: 2022-10-22
Fixes
$dataMergeInnerso that observation-based log-likelihoods work with infusions. Should fix tests withggPMXFixes
$etaSEand$etaRSEto work correctly when there is only 1 eta.Fixes npde valgrind observed on CRAN machines
nlmixr2est 2.1.0
CRAN release: 2022-10-19
Breaking changes
FOCEi
Gill forward differences will not repeat now (by default), You can change back to prior behavior with
foceiControl(repeatGillMax=3)Number of sticky recalculation is reduced to 4; to have the old behavior use
foceiControl(stickyRecalcN=5)n2llhas been changed tollto specify individual log-likelihoods. This was only used in simulation and was not well documented.Generalized log-likelihood is only supported with
rxode22.0.8or later.
FOCEi covariance calculation
The
Smatrix calculation was made a bit more robust to errors in individual gradients. When there are errors in the individual gradient calculation, assume the gradient is the same as the overall gradient. In the tests cases, were reasonable using this adjusted S matrix. This means if some individuals do not have very much data to support a specific parameter, aSmatrix calculation for the population will still be generated. When there is some patients/subject combinations that do not have sufficient data, we will add the following to the run information:S matrix had problems solving for some subject and parameters. TheSmatrix calculation will still fail if the percentage of parameters that are being reset is lower thanfoceiControl(smatPer=0.6)or whatever you specify.The
r,scovariance matrix will now also check for unreasonably small values (controlled byfoceiControl(covSmall=...)) and select a different covariance estimate method even when the “r” and “s” matrices are calculated “correctly”.
New features
What type(s) censoring (if any) is now stored in
fit$censInformationStandard errors of
$etascan now be obtained withfit$phiSE, also available arefit$phiRSE(relative standard error),fit$phiH, (individual hessian),fit$phiC(individual covariances),fit$phiR(individual correlation matrices)Can also use Shi 2021 differences in addition to Gill differences. In our tests (using the same datasets as CPT) these produced worse estimates than the Gill 1983, though it is unclear why since it should be a faster more accurate method. A modified version is used in calculating the individual Hessians of numerically for the generalized likelihood approach.
Generalized likelihood estimation is now present in
nlmixr2estforfocei,foceandposthocnmNearPD()is a function you may use for nearest positive definite matrix. This is derived fromMatrix::nearPD()but is implemented in C/C++ to be used in (possibly threaded) optimization.Individual Hessians can be accessed by
$phiH, covariance by$phiC, eta standard errors by$phiSEand eta RSEs can be accessed by$phiRSE. There areetaaliases for these as well ($etaH,$etaC,$etaSE, and$etaRSE).-
Can now access the individual point’s contribution to the overall likelihood when merging to the original dataset. These merges can be accessed with
$dataMergeFull,$dataMergeLeft,$dataMergeRight, and$dataMergeInner. The columns with the individual data column isnlmixrLlikObs.To calculate the total
focei/foceobjective function, the sum of the likelihoods still need to be adjusted by the omega/eta contribution, and the individual Hessians, and possibly the NONMEM objective function offset constant.
Censoring fixes
- Fixed bug where datasets with censoring that are not lower case
censandlimitdo not produce the correct table output (#180)
nlmixr2est 2.0.8
CRAN release: 2022-06-22
SAEM bug fix
- When loading a
nlmixr2“saem” fit from another R session,nlmixr2will no longer crash withfit$objf
NPDE/NPD fixes
-
NPDEwas identical toNPDeven with correlated models, this was fixed (prior output was actuallyNPDE).
nlmixr2est 2.0.7
CRAN release: 2022-05-23
Use
.zeros()for the matrices in armadillo in addition to relying oncallocto give zero matrices.Fixed one uninitialized object
Fix for
augPredso it works on population only modelsnlmeno longer sets options to treat all covariates as non mu-referenced covariates, but directly calls a function that can turn on or off the mu-reference covariate selection.vpcSimnow tries to simulate IDs that didn’t simulate correctly (with a warning)Export nmObjHandleControlObject
nlmixr2est 2.0.6 – new package
CRAN release: 2022-05-12
nlmixr2est contains the estimation functions within nlmixr2.
FOCEI family changes
Remove lower level
foceiFitfunction. Focei, foce, fo, foi, and posthoc now directly takes rxode2 ui objectsNew error types are supported in focei including mixing theta and etas in residual errors and different types of proportional errors
Different types of additive and proportional errors can be used for each endpoint using
+ combined1()or+ combined2()otherwise it takes the suppliedaddPropoption to figure out which type of combined model is run (by defaultcombined2())Focei model cache is now named
focei-md5Digest.qsand usesqscompression/saving/loading.foceiControl()aligned between other methods.foceiControl(adjLik=TRUE)uses the NONMEM-style objective function throughout.foceiControl(adjLik=FALSE)uses the adjusted objective function throughout, and adjusts it back to the NONMEM objective function.Lag time and other between subject variability differences no longer calculate an ideal relative step size, but an absolute step size when using Gill differences (default)
Objective function checks for infinite/NaN/NA values for the entire solving space and ensures no overflow occurs when calculating the inner hessian
SAEM changes
mu referencing is no longer required for
saem; Internally non mu-referenced values are converted to mu referenced values and the converted back when calculating the nlmixr2 object.-
nlmixr2forced the parameter ordering to (1) population effects,- non mu-referenced between subject effects (3) omega estimates and (4) residual effects. This changes the order that
nlmixr2sees the parameters. Since this is based on a random number generator, the optimization trajectory will be different and have different results thannlmixr
- non mu-referenced between subject effects (3) omega estimates and (4) residual effects. This changes the order that
Components of
omegacan now be fixed.Residual error components can also be fixed.
When optimizing only one residual value, nlmixr2’s saem uses
nlmfrom R, which is more efficient than the nealder-meade method.Lower level
saemfunctions (likeconfigsaem()) are not exported because they are increasingly difficult to use and convert to something standard; a few methods (likeprint,summaryetc) are maintained to view the lower level object and for debugging it.Parameter history and print-out no longer includes fixed parameters.
The model to calculate the residuals more closely matches the model used for estimation to remove small rounding differences that may occur in the models.
Different types of additive and proportional errors can be used for each endpoint using
+ combined1()or+ combined2()otherwise it takes the suppliedaddPropoption to figure out which type of combined model is run (by defaultcombined2())Parameter history and printout now uses standard deviation for additive only components, matching the estimation of the components.
rxode2solving options are now saved in therxControlpart of thesaemControl(). That issaemControl(rxControl=rxControl(...)); This fixes any conflicting option names as well as allowing alignment between the control structures infocei,nlmeandsaemsaemControl()aligned between other methods.
nlme changes
nlmehas been completely rewritten to directly run from therxode2UInlmealways tries to use mu-referencing (when available)Internally
nlmenow uses parallel processing for solving so it should be faster.nlmixr2NlmeControl()(which will overwritenlmeControl()) documents and adds more options tonlme. Also aligned with other methods.weights,fixed,randomcan be specified innlmixr2NlmeControl(). If so, then thenlmeobject will be returned.returnNlmeis a new option that will return thenlmeobject instead of the traditionalnlmeobject.nlme_odeandlme_lin_cmptare both removed.rxode2solving options are now saved in therxControlpart of thesaemControl(). That isnlmeControl(rxControl=rxControl(...)); This fixes any conflicting option names as well as allowing alignment between the control structures infocei,nlmeandsaem
nlmixr2 object change
With
saem, the nlmixr2 function now saves/compresses thephiMinformation. This means the gaussian and Laplacians likelihoods can be calculated when you save the nlmixr object and then restore it later.The nlmixr2 object compresses infrequently used and removes many unneeded objects. Even with compression, the
saemobjects are often a bit bigger since they include the largephiMobject.nlmixr2now supports non-mu referenced ETAs in thefit$parFixedandfit$parFixedDf
nlmixr2 interface change
nlmixr2interface changed to userxode2UIkeepanddropare added totableControlto influence the end data-frame$simInfouses a quoted expression for$rxinstead of a string$simInfo$sigmais a diagonal matrix since now the normal simulation is controlled by the variability modeled as a population value.nlmixr2now allows etas that have initial omega estimates of zero to be dropped from the model (instead of issuing an error about a non-positive definite$omegamatrix)
NPDE changes
- Fixed a bug where the number of simulations for a NPDE calculation are correctly passed by
addNpde(fit, table=tableControl(nsim=500))
VPC changes
vpcfunction rewritten and split out tovpcSim()andvpcPlot()(which is a replacement forvpc()).There were too many mismatches between
vpc::vpcandnlmixr::vpcwhich caused inconsistencies in code based on load order ofvpcandnlmixr. This way both coexist, and you can use thevpcsimulation for other packages more easily (likeggPMX) without creating or summarizing data sinceggPMXhas its own methods for summarizing and creating plots.VPC now directly uses
rxode2::rxSolve
augPred() changes
augPred()has been written to use the new fit object.nlmixr2AugPredwas changed tonlmixr2AugPredSolve()augPreduses the new interface and supports multiple endpoints. The endpoint name is now always on theplot(augPred(fit)).
getFitMethod() change
- Internally, fit estimation method is saved in
fit$est, and nowgetFitMethod(fit)simply returnsfit$est
Delete methods
Many methods lower level utility functions have been deleted.
nmDocx,nmLstandnmSavehave been removed.
Bug fixes
- Now will reset the cache when items cannot be loaded. In the past error messages like
function 'rx_0ba247452048de33b1ffb8af516714fc__calc_lhs' not provided by package 'rx_0ba247452048de33b1ffb8af516714fc_'would cause the estimation to stop. Nowrxode2::rxClean()is run when this occurs.
