diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2022-09-19 12:55:00 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2022-09-19 12:55:00 +0200 |
commit | 7a3f2ee22419608a8a634fd4d71d7176303b2f41 (patch) | |
tree | 292447a0f0f647253ac269074ba7b6ce4139c576 /R/llhist.R | |
parent | 062a1be18677a4e83a64d23622b5214258d9bc7d (diff) |
Improve parhist and llhist
In particular, adapt the display of parameter boxplots
for saem fits using mkin transformations to the way
used for saem fits using saemix transformations, i.e.
always show parameters on the natural scale, and normalised them by
dividing by the median from the multiple runs.
Diffstat (limited to 'R/llhist.R')
-rw-r--r-- | R/llhist.R | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,6 +1,6 @@ #' Plot the distribution of log likelihoods from multistart objects #' -#' Produces a histogram of log-likelihoods, and an overlayed kernel density +#' Produces a histogram of log-likelihoods, and an overlayed kernel density #' estimate. In addition, the likelihood of the original fit is shown as #' a red vertical line. #' @@ -13,8 +13,13 @@ #' @importFrom KernSmooth bkde #' @export llhist <- function(object, breaks = "Sturges", lpos = "topleft", main = "", ...) { + oldpar <- par(no.readonly = TRUE) + on.exit(par(oldpar, no.readonly = TRUE)) + ll <- sapply(object, logLik) kde <- KernSmooth::bkde(ll) + + par(las = 1) h <- hist(ll, freq = TRUE, xlim = range(kde$x), xlab = "", main = main, |