mapbayr 0.10.2
CRAN release: 2026-01-31
- Internal
are_comparable()now better checks attributes between the objects. This avoids a conflict with the upload of dplyr 1.2.0 to CRAN.
mapbayr 0.10.1
CRAN release: 2025-08-21
Fixes tests to allow new versions of mrgsolve to CRAN (#223):
- Do not use
est001from data/ in tests, since the latter always contains a deprecated stale mrgsolve model in it. - Stop creating an
ORIGIDcolumn in the code ofmapbayr_vpc()to prevent unnecessarymrgsolve::update()warnings. - Fix a test where “lambda” was not expected in “arg.ofv.fix”
-
est001was regenerated using mrgsolve 1.6.1.
mapbayr 0.10.0
CRAN release: 2023-07-17
New features
Model averaging
- New
model_averaging()to make averaged predictions over estimations performed from several models. Also exportsdo_model_averaging()andcompute_weights()for low-level implementations.
Prediction-corrected Visual Predictive Checks
- New
mapbayr_vpc()to make prediction-corrected visual predictive checks (pcvpc) from a given model and dataset. Control the independent variable (idv), and the stratification on a numeric variable in the dataset (stratify_on).
Minor changes and Bug Fixes
-
hist()method (hist.mapbayests()) now shows the values of eta-shrinkage in multiple subjects setting. New argumentshkto control the definition of shrinkage, either based on the standard deviation ("sd") or on the variance ("var") (@LauraMvn, #192). - New
mapbayr_plot()in order to plot results from tables (data.frame). This is the function now called byplot.mapbayests()internally. Can plot the results of multiple estimation object (informed in the column “MODEL”), useful when model averaging is performed. ArgumentMODEL_colorto force the color of a model on the plot. - New
do_mapbayr_sims()as an engine to simulate from estimation results. Experimental. Now mostly useful for internal or programmatic uses, but might be extended in the future. - Refactor
augment.mapbayests(). Now easier to debug and much more faster, especially when uncertainty on predictions is required. - Refactor OFV computation: parameters (“ETA”) are now passed through the data set and not through
$PARAM, however the definition on “ETA” in$PARAMremains mandatory. - Now postprocesses datasets with >=2 missing covariates (#185).
- “ETA” parameters cannot be longer declared as “@covariates” in
$PARAMto avoid hazardous behaviours (@jbwoillard, #187). - By default,
augment()now simulates at least 200 points per individual. Fix a bug where delta was miscalculated and strange-looking plots were sometimes generated (@LauraMvn, #191). - The
mapbay_tabnow has the same number of rows as original data especially if it did not have observation rows (@LauraMvn, #193). - With data helpers, the
.datehourcolumn is updated afterrealize_addlis being called (@LauraMvn, #194). - Dependencies: mrgsolve (>= 1.0.8) to benefit from the
etasrcspecification. - Suggestions: scales.
- Add Laura Morvan @LauraMvn as contributor.
mapbayr 0.9.0
CRAN release: 2023-02-02
New features
Data Helpers
New
adm_rows()andobs_rows()replace and improveadm_lines()andobs_lines(), respectively. See?data_helpersfor a comprehensive documentation (#175).-
In
adm_rows(),obs_rows(), andadd_covariates(), the first argumentx:can be missing, which enables the creation of a new dataset from scratch.
-
accepts a data.frame, which enables the modification of a pre-existing dataset (#155). For example:
still accepts an ‘mrgsolve’ model, which enables the modification of a dataset stored in the model arguments.
-
In
adm_rows()andobs_rows(), new argument.datehourin order to computetimeas function of date and hours provided as character. The value passed to.datehouris parsed withparse_datehour()into a date-time value (“POSIXct”). For example: Data helpers now always rearrange data to fulfill the NM-TRAN compatibility and readability: filling missing covariate values with the last observation carried forward rule, relocation of NM-TRAN variables in the first positions etc…
Below Limit of Quantification
- Data below the limit of quantification can now be handled with the so-called “M3 method” which consists in computing the likelihood of being below the limit of quantification. This is achieved when the variables
LLOQ(lower limit of quantification, e.g. 0.22 mg/L) andBLQ(below limit of quantification, e.g. 1 or 0) are in the data (@pchelle, #182). - This can be achieved by:
- adding the variables
LLOQandBLQto the data by yourself. - adding the variable
LLOQto the data by yourself:BLQwill automatically be inferred fromLLOQandDV. - using
mapbayest(lloq = )to automatically add theLLOQandBLQvariables in the data.
- adding the variables
- In
mapbayest(), new argumentlloqin order to add a variableLLOQto the data. For example:mapbayest(model, data, lloq = 0.22).
Estimation features
In
mapbayest(), new argumentselect_etain order to select the numbers of the ETAs to estimate. Default are ETAs related to an OMEGA not equal to zero. Non-selected ETAs will not be estimated and returned equal to zero. This can be useful in order to ignore the estimation of ETAs not of interest, e.g. in case of inter-occasion variability or non-identifiability. For example:mapbayest(model, data, select_eta = c(1,3))(#170).In
mapbayest(), new argumentlambdain order to modify the weight of the priors in the Bayesian estimation. This could be useful in order to flatten the priors with the objective to favor observed data instead of a priori information. For example:mapbayest(model, data, lambda = 0.1)to decrease the weight of priors of a ten-fold (#174).
Minor changes and bug fixes
- Export
adm_rows.data.frame(),adm_rows.missing(),adm_rows.mrgmod(),obs_rows.data.frame(),obs_rows.missing(),obs_rows.mrgmod(), andadd_covariates.data.frame(), as new methods for data helpers. - Export
parse_datehour(), used to parse arguments passed to.datehourinadm_rows()andobs_rows(). - Export
filter.mrgmod(), a method, wrapper arounddplyr::filter()for dataset stored in mrgsolve model object (‘mrgmod’). - Deprecate
adm_lines()andobs_lines(). Stop exportingadm_lines.mrgmod()andobs_lines.mrgmod(). - Stop exporting
see_data(). Was deprecated since 0.4. Useget_data()instead. - Suggests
lubridate. - In the final estimation object, new
arg.optim$select_etaelement,arg.ofv.fix$omega_invnow has the dimensions of the number of ETAs selected. - OMEGA values equal to zero are allowed in the model and will be ignored during the estimations steps thanks to the new
select_etaargument. This condition is not tested anymore withcheck_mapbayr_model(). -
print.mapbayests(), now only shows the estimated ETAs. - In
hist(), new argumentselect_etain order to select the ETAs to plot. Default are ETAs estimated withmapbayest()(#167). -
eta()properly sorts vectors of length superior to 9 (#159). -
use_posterior()works if covariates had not been defined in data (#160). - In
hist(),get_phi()andplot_phi(), ETAs are now properly re-ordered if they are more than 9 (#165). - Classification of absolute difference equal to zero now works (#166).
- Observations at time = 0 are now allowed (#168).
- Fix deprecations related to
tidyversepackages (#171). - Depends on
ggplot2 >= 3.4.0. -
add_covariates()accepts empty arguments. - In
mapbayest(), new argument...in order to fix compatibility issues, not used yet.
mapbayr 0.8.0
CRAN release: 2022-09-29
New features
- New
summarise_phi()andbar_phi()summarizes the comparison of estimation of ‘mapbayr’ and ‘NONMEM’ (i.e. classifies it as Excellent/Acceptable/Discordant) and graphically represents it as a bar plot. - New
eta()generates numerical values namedETA1, ETA2, ETA3..., either from scratch, from a pre-existing vector or from a ‘mrgsolve’ model object. - In
plot(),PREDICTION = c("IPRED", "PRED")controls to plot either “PRED”, “IPRED” or both (#113). - In
add_covariates(),covariatesis relocated in last position, in the favor of...which now accepts covariate values. Callingadd_covariates(list(BW = 90))will still works (with a warning) for the sake of compatibility but will be deprecated. Instead, just useadd_covariates(BW = 90)or explicitly calladd_covariates(covariates = list(BW = 90))if you want to pass covariate values as a list (#156). - In
get_eta(),output = "num"returns a matrix if multiple IDs are available instead of an error message (#145).
Minor changes
- Stop exporting
postprocess.optim()andpostprocess.output(). Removed due to refactoring of internal post-processing. - Stop exporting
adm_0_cmt(). - In
mapbayest(),resetis now a numeric and drives the maximum allowed reset during optimization. - The progress bar is now forced to appear, especially in the RStudio job launcher.
-
check_mapbayr_model()now returns an error if a check fails instead of a table that summarized the errors. -
check_mapbayr_model()now only checks critical points and not suggested features. -
check_mapbayr_model()now explicitly forbidsIPRED,PREDandETA1, ETA2...(#148).
Internal
- Data splitting is simpler (#127).
- Post-processing is faster and its content depends on
mapbayest(output = )(#134). - Optimization is faster thanks to
stats::optim()if method is ‘L-BFGS-B’ andminqa::newuoa()if method is ‘newuoa’. These replaceoptimx::optimx()(#136). - Remove dependency to
optimxpackage. - Downgrade
tibblepackage from dependency to suggestion. - Test refactor and more tests for internal *_cmt functions.
- Remove unexported functions from documentation.
Bug fixes
-
vs_nonmem()andget_phi()works even if covariance was missing/failing in mapbayests object (#126). -
pred()does not generateNaNif small negative concentrations were predicted after log-transformation (#140). -
pred()does not propagate ‘mrgsolve’ error when lag time is longer than inter-dose interval at steady-state (#142). - Non-loaded shared object are now explicitly detected (#130).
- The absence of
NAvalues inDVifmdv == 0is checked (#131). - The compartment numbers in the data is compared to compartments defined in the model (#132).
-
check_mapbayr_model()is now called before any use the model insidemapbayest()(#149). - A better error message is rendered if covariates are not properly tagged in the model (#92).
- It is possible to use sigma labels to define
DVif error is exponential (#150). - In
obs_lines(),mdvwill be 1 ifDVis set toNA(#147).
mapbayr 0.7.0
CRAN release: 2022-05-20
Breaking changes
- Change the outputs of pre-processing functions. For fixed elements,
qmod,omega_invandall_cmtnow replacemrgsolve_model,omega.invandobs_cmt. For individual-related elements,idDVreplacesDVobs,datais removed,idvaliddataandidcmtare added. This can have an impact for the user since these elements are reported in the standard output. However, it does not change the behaviour ofget_data(). - Change argument behaviour:
mapbayest(verbose = TRUE)now only displays the messages related to optimization reset, and not the progression of ID being optimized which is now controlled bymapbayest(progress = TRUE). - Stop exporting
derivatives(), now replaced bymapbayr:::h(). - Stop exporting
mbrlib()and associated models. See the “Model examples” section below.
Model examples
The example models system was totally re-thought around a new function: exmodel(). It now embeds several models that were used in the validation study, with a small corresponding dataset that can be loaded automatically (the default). They are used in multiple places inside the package, especially in tests and examples. More models could be added in the future.
Miscellaneous
- New argument:
mapbayest(progress = TRUE)displays a progress bar with the number of the ID being optimized. #118 #28 - New argument value:
mapbayest(output = "eta")returns only estimated ETA in order to skip most of post-processing steps. #106 -
eta_descr()now always returns a non-NA value even if description is missing. #87 - New function:
do_compute_ofv(), a wrapper arounddo.call(compute_ofv, ...). - Add Dependency: progress.
- Add Suggestion: testthat, minqa. #120
- Improve the performance of objective function value calculation. Now use a faster parameter update, pre-validate data and refactor the computation of the H matrix. Thanks @kylebaron for the useful suggestions. #104 #111
- Improve tests. Now work with example models which is overall lighter, faster, more consistent, more unitary. Also, they are run during
R CMD check. - Improve documentation: some monographs were merged, and some gained an example section thanks to the new example models system.
mapbayr 0.6.0
CRAN release: 2022-02-18
This version of mapbayr introduces several features that aim to express uncertainty around the point estimate. Please note that the results of these functions were not validated vs a gold-standard software such as NONMEM. This is why they are referred as “experimental features” in the following subsections. They are exported with the objective to ease their future validation, and to provide a very rough idea of the estimation uncertainty.
Breaking changes
- Remove
dataslot in estimation object. Useget_data()instead. #64 - The
$model@args$datais now alwaysNULLin the estimation object. It was carried out if the data was initially passed withdata_set()or built withadm_lines()/obs_lines(). #64 - The time grid used to plot the results is now adapted as function of data, and not fixed (refactor of
augment). Also userecsort=3to deal with steady-state administrations. #85 - Argument passed to
plot()are now directly passed toaugment(). - Depends on mrgsolve >= 1.0.0 to use the newly exported
collapse_omega()function. (thanks @kylebaron)
Experimental features
- Compute and use a normal approximation of conditional distribution. The function called in
mapbayest(hessian = )is used to compute the hessian withstats::optimHess()by default. The variance-covariance matrix is returned in acovarianceslot in the estimation object, and can be accessed withget_cov(). - Simulate with uncertainty.
use_posterior(update_omega = TRUE)update the OMEGA matrix with the covariance matrix, in order to simulate with uncertainty and derive confidence intervals. - Plot confidence interval.
plot(ci = TRUE)displays approximate confidence intervals on predicted concentrations. Parameter uncertainty is approximated with the covariance matrix. Confidence interval computation relies on the delta approximation (ci_method = "delta"), but can also be computed thanks to simulations (seeaugment()documentation).
New exports
-
get_cov(): function to get the covariance matrix of estimation. #43 -
get_phi(),read_nmphi(),merge_phi()andplot_phi(): functions to compare the estimations vs NONMEM. #55 -
est001: an examplemapbayestsestimation object. #94
use_posterior()
- add
update_omega,update_cov, andupdate_etaarguments to control what to update. -
.zero_redefault behavior now depends onupdate_arguments values. - no longer warns if time-varying covariates are used. The first value will be used by default.
- now works on multiple individuals: a list of mrgsolve models will be returned if multiple individuals found.
Miscellaneous
- Print a message indicating a difficulty when there is a reset during optimization, instead of a warning indicating an error. #96
-
mapbayest(verbose = )now mutes the message that indicates a reset during optimization. #96 - Remove the attributes of
opt.valueinherited fromoptimx. #95 - Detect non-numeric column(s). Stop and inform the user if any. #86 #88 (thanks @jkamp91)
-
get_data()can now return a list of individual data sets withoutput = "list". #64 - Check for undesirable zero in OMEGA/SIGMA matrices instead of crashing. #44
- Remove stats from dependencies.
- Add Kyle Baron as contributor.
- Update README since article publication.
- Update documentation.
mapbayr 0.5.0
CRAN release: 2021-07-27
Important
- Add new reset conditions: with new initial values if same absolute value for every etas, with larger bounds if estimation at bound. Additional refactoring about reset as well. see #75
- Add an “information” slot to the output, with time records and package version #69
- Remove dependency to the
@annotatedtag in model code, especially for$PARAMand$CMTblocks. #73 - As a consequence,
adm_lines()andobs_lines()don’t need the [ADM] and [OBS] tags in model code anymore (yet strongly recommended, otherwise it errors cleanly).
Others
- Update README since first CRAN release
- Check where sigma is equal to zero if error is exponential #45
- Use log_transformation() instead of log.transformation() #24
- Use unnamed data.frame instead of tibble in get_param() #77
- Remove the message when a mapbayests object was passed to plot() without augment() before. #80
- Don’t stop if no observation in data (no fix, just a test actually) #23
- Fix minor
testthatbugs due to upgrade of R and French translation of warnings. - Fix bug in
plot()legend, due to new version ofggplot23.3.4 #82
mapbayr 0.4.1
CRAN release: 2021-04-30
- Fix bugs (dependency, backward compatibility, checks)
- Remove random initial value for method “NEWUOA”. Default to 0.1 for each parameter.
mapbayr 0.4
- More features to hist() function
- Use mapbayest() instead of mbrest()
- Use get_data() instead of see_data()
- Use get_param() to access a posteriori captured parameters
- Use get_eta() to access eta values
- Use use_posterior() to update model with posterior parameters, and perform simulations from mapbayests object.
mapbayr 0.3
Users :
- Remove arg.ofv from output.
- Add arg.ofv.fix and arg.ofv.id into output. Avoid redundancy and decrease the weight of the mbrests object.
- mapbay_tab output improved: return a posteriori captured items and covariates (among other)
- Variables passed in dataset cannot be defined in model, except if defined with @covariates.
mapbayr 0.2.2
- mbraugment(), mbrplot() and mbrhist() are deleted, and replaced by augment(), plot() and hist() S3 methods.
- Re-organize internal .R files.
- Rename post process functions.
- Re-write documentation and arguments of mbrest() and its internal process. #32
mapbayr 0.2.1
- Features:
- Refactor adm_lines() and obs_lines() function. adm_lines() is now based on mrgsolve::ev, and can accept “ss” specification. Covered by tests.
- Check for mandatory columns in data set. MDV automatically supplied. #31
- Check the model to see if it fills mapbayr specification. Covered with tests
- [OBS] is not mandatory in $CMT if there is only one compartment with observations in the dataset.
- Fix bugs:
- Miscellaneous:
- Update README
- Remove some useless functions
- ofv computation now uses mrgsim_q() faster than basic mrgsim_df (theoretically because I did not benchmarked)
- Added a
NEWS.mdfile to track changes to the package.
