From 7a3f2ee22419608a8a634fd4d71d7176303b2f41 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 19 Sep 2022 12:55:00 +0200 Subject: 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. --- vignettes/web_only/multistart.R | 7 +++++-- vignettes/web_only/multistart.html | 13 +++++++------ vignettes/web_only/multistart.rmd | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-) (limited to 'vignettes') diff --git a/vignettes/web_only/multistart.R b/vignettes/web_only/multistart.R index a860757d..b995c545 100644 --- a/vignettes/web_only/multistart.R +++ b/vignettes/web_only/multistart.R @@ -14,10 +14,13 @@ dmta_ds[["Elliot 1"]] <- dmta_ds[["Elliot 2"]] <- NULL f_mmkin <- mmkin("DFOP", dmta_ds, error_model = "tc", cores = 7, quiet = TRUE) f_saem_full <- saem(f_mmkin) f_saem_full_multi <- multistart(f_saem_full, n = 16, cores = 16) -parhist(f_saem_full_multi, lpos = "bottomright") +parhist(f_saem_full_multi) ## ----------------------------------------------------------------------------- f_saem_reduced <- update(f_saem_full, covariance.model = diag(c(1, 1, 0, 1))) f_saem_reduced_multi <- multistart(f_saem_reduced, n = 16, cores = 16) -parhist(f_saem_reduced_multi, lpos = "bottomright") +parhist(f_saem_reduced_multi, lpos = "topright") + +## ----------------------------------------------------------------------------- +llhist(f_saem_reduced_multi) diff --git a/vignettes/web_only/multistart.html b/vignettes/web_only/multistart.html index 004b62be..5a91584c 100644 --- a/vignettes/web_only/multistart.html +++ b/vignettes/web_only/multistart.html @@ -364,7 +364,7 @@ pre code {

Short demo of the multistart method

Johannes Ranke

-

Last change 16 September 2022 (rebuilt 2022-09-16)

+

Last change 19 September 2022 (rebuilt 2022-09-19)

@@ -384,16 +384,17 @@ dmta_ds[["Elliot 1"]] <- dmta_ds[["Elliot 2"]] <- NULL
f_mmkin <- mmkin("DFOP", dmta_ds, error_model = "tc", cores = 7, quiet = TRUE)
 f_saem_full <- saem(f_mmkin)
 f_saem_full_multi <- multistart(f_saem_full, n = 16, cores = 16)
-parhist(f_saem_full_multi, lpos = "bottomright")
-

+parhist(f_saem_full_multi) +

We see that not all variability parameters are identifiable, most problematic is the variance of k2. So we reduce the parameter distribution model by removing the intersoil variability for this parameter.

f_saem_reduced <- update(f_saem_full, covariance.model = diag(c(1, 1, 0, 1)))
 f_saem_reduced_multi <- multistart(f_saem_reduced, n = 16, cores = 16)
-parhist(f_saem_reduced_multi, lpos = "bottomright")
-

-

We can also analyse the log-likelihoods obtained in the multiple runs

+parhist(f_saem_reduced_multi, lpos = "topright") +

+

We can also analyse the log-likelihoods obtained in the multiple runs:

llhist(f_saem_reduced_multi)

+

The one run with the lower likelihood is probably responsible for the outliers in the boxplots above, and caused by some weird starting value combination. In any case, the converged values from the original fit (red circles) appear perfectly acceptable, supporting the choice of starting values made by mkin.

diff --git a/vignettes/web_only/multistart.rmd b/vignettes/web_only/multistart.rmd index a25b73ce..8f349973 100644 --- a/vignettes/web_only/multistart.rmd +++ b/vignettes/web_only/multistart.rmd @@ -1,7 +1,7 @@ --- title: Short demo of the multistart method author: Johannes Ranke -date: Last change 16 September 2022 (rebuilt `r Sys.Date()`) +date: Last change 19 September 2022 (rebuilt `r Sys.Date()`) output: html_document vignette: > @@ -34,7 +34,7 @@ random effects for all degradation parameters. f_mmkin <- mmkin("DFOP", dmta_ds, error_model = "tc", cores = 7, quiet = TRUE) f_saem_full <- saem(f_mmkin) f_saem_full_multi <- multistart(f_saem_full, n = 16, cores = 16) -parhist(f_saem_full_multi, lpos = "bottomright") +parhist(f_saem_full_multi) ``` We see that not all variability parameters are identifiable, most problematic @@ -44,7 +44,7 @@ removing the intersoil variability for this parameter. ```{r} f_saem_reduced <- update(f_saem_full, covariance.model = diag(c(1, 1, 0, 1))) f_saem_reduced_multi <- multistart(f_saem_reduced, n = 16, cores = 16) -parhist(f_saem_reduced_multi, lpos = "bottomright") +parhist(f_saem_reduced_multi, lpos = "topright") ``` We can also analyse the log-likelihoods obtained in the multiple runs: -- cgit v1.2.1