These functions were made to easily compare the results of mapbayr to NONMEM. For instance, it could be useful in the case of the transposition of a pre-existing NONMEM model into mapbayr. For this, you need to code your model in both mapbayr and NONMEM, and perform the MAP-Bayesian estimation on the same dataset. Ideally, the latter contains a substantial number of patients. NONMEM returns the estimations results into a .phi file.
Use read_nmphi() to parse the NONMEM .phi file into a convenient tibble data.frame with the columns:
SUBJECT_NO, ID: Subject identification.
ETA1, ETA2, ..., ETAn: Point estimates of eta.
ETC1_1, ETC2_1, ETC2_2, ..., ETCn_n: Variance-covariance matrix of estimation.
OBJ: objective function value
Use get_phi() to access to the estimations of mapbayr with the same "phi" format.
Use merge_phi() to combine mapbayr and NONMEM "phi files" into a single long-form data.frame with the columns:
SUBJECT_NO, ID: Subject identification.
variable name and its type: ETA (point estimate), VARIANCE (on-diagonal element of the matrix), COVARIANCE (off-diagonal), and OBJ.
mapbayr and nonmem: corresponding values
adiff: absolute difference between mapbayr and nonmem values.
Use plot_phi() to graphically represent adiff vs variable. Alternatively, the table returned by merge_phi() is easy to play with in order to derive performance statistics or the graphical plot of your choice.
Use summarise_phi() to classify the estimation as "Excellent", "Acceptable" or "Discordant", over the whole dataset or by group.
Use bar_phi() to graphically represent the proportion of the aforementioned classification as bar plot.