From 1c5608e1efc43cd1e7f59640195b357064ff6268 Mon Sep 17 00:00:00 2001 From: Nicole Erler Date: Sun, 22 Feb 2026 15:40:41 +0100 Subject: [PATCH 1/4] fix math output using katex --- _pkgdown.yml | 3 +- vignettes/TheoreticalBackground.Rmd | 74 ++++++++++++++++------------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index f9e30b91..b9ba5e07 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -13,6 +13,7 @@ template: code-color: "#991433" code-color-dark: "#D10E3B" link-color-dark: "#D10E3B" + math-rendering: katex navbar: structure: @@ -23,7 +24,7 @@ navbar: icon: fa-home href: index.html aria-label: home - + figures: dev: grDevices::png diff --git a/vignettes/TheoreticalBackground.Rmd b/vignettes/TheoreticalBackground.Rmd index 18e9ed9f..92a72b69 100644 --- a/vignettes/TheoreticalBackground.Rmd +++ b/vignettes/TheoreticalBackground.Rmd @@ -1,6 +1,6 @@ --- title: "Theoretical Background" -date: "2020-06-20" +date: "2026-02-22" output: bookdown::html_document2: toc: true @@ -8,6 +8,8 @@ output: number_sections: false pkgdown: as_is: true +template: + math-rendering: katex vignette: > %\VignetteIndexEntry{Theoretical Background} %\VignetteEncoding{UTF-8} @@ -221,16 +223,19 @@ implemented as a link in ### Cumulative logit (mixed) models Cumulative logit mixed models are of the form -\begin{eqnarray*} -y_{ij} &\sim& \text{Mult}(\pi_{ij,1}, \ldots, \pi_{ij,K}),\\[2ex] -\pi_{ij,1} &=& P(y_{ij} \leq 1),\\ -\pi_{ij,k} &=& P(y_{ij} \leq k) - P(y_{ij} \leq k-1), \quad k \in 2, \ldots, K-1,\\ -\pi_{ij,K} &=& 1 - \sum_{k = 1}^{K-1}\pi_{ij,k},\\[2ex] -\text{logit}(P(y_{ij} \leq k)) &=& \gamma_k + \eta_{ij}, \quad k \in 1,\ldots,K,\\ -\eta_{ij} &=& \mathbf x_{ij}^\top\boldsymbol\beta + \mathbf z_{ij}^\top\mathbf b_i,\\[2ex] -\gamma_1,\delta_1,\ldots,\delta_{K-1} &\overset{iid}{\sim}& N(\mu_\gamma, \sigma_\gamma^2),\\ -\gamma_k &\sim& \gamma_{k-1} + \exp(\delta_{k-1}),\quad k = 2,\ldots,K, -\end{eqnarray*} + + +\begin{align*} +y_{ij} &\sim \text{Mult}(\pi_{ij,1}, \ldots, \pi_{ij,K}),\\[2ex] +\pi_{ij,1} &= P(y_{ij} \leq 1),\\ +\pi_{ij,k} &= P(y_{ij} \leq k) - P(y_{ij} \leq k-1), \quad k \in 2, \ldots, K-1,\\ +\pi_{ij,K} &= 1 - \sum_{k = 1}^{K-1}\pi_{ij,k},\\[2ex] +\text{logit}(P(y_{ij} \leq k)) &= \gamma_k + \eta_{ij}, \quad k \in 1,\ldots,K,\\ +\eta_{ij} &= \mathbf x_{ij}^\top\boldsymbol\beta + \mathbf z_{ij}^\top\mathbf b_i,\\[2ex] +\gamma_1,\delta_1,\ldots,\delta_{K-1} &\overset{iid}{\sim} N(\mu_\gamma, \sigma_\gamma^2),\\ +\gamma_k &\sim \gamma_{k-1} + \exp(\delta_{k-1}),\quad k = 2,\ldots,K, +\end{align*} + where $\pi_{ij,k} = P(y_{ij} = k)$ and $\text{logit}(x) = \log\left(\frac{x}{1-x}\right)$. A cumulative logit regression model for a univariate outcome $y_i$ can be obtained by dropping the index \(j\) and omitting \(\mathbf z_{ij}^\top\mathbf b_i\). @@ -251,13 +256,13 @@ a parametric model which assumes a Weibull distribution for the true Cox proportional hazards model. The parametric survival model is implemented as -\begin{eqnarray*} -T_i^* &\sim& \text{Weibull}(1, r_i, s),\\ -D_i &\sim& \unicode{x1D7D9}(T_i^* \geq C_i),\\ -\log(r_j) &=& - \mathbf x_i^\top\boldsymbol\beta,\\ -s &\sim& \text{Exp}(0.01), -\end{eqnarray*} -where $\unicode{x1D7D9}$ is the indicator function which is one if $T_i^*\geq C_i$, +\begin{align*} +T_i^* &\sim \text{Weibull}(1, r_i, s),\\ +D_i &\sim \text{𝟙}(T_i^* \geq C_i),\\ +\log(r_j) &= - \mathbf x_i^\top\boldsymbol\beta,\\ +s &\sim \text{Exp}(0.01), +\end{align*} +where 𝟙 is the indicator function which is one if $T_i^*\geq C_i$, and zero otherwise. The Cox proportional hazards model can be written as @@ -281,12 +286,12 @@ A convenient way to specify the joint distribution of the incomplete covariates \(\mathbf X_{mis} = (\mathbf x_{mis_1}, \ldots, \mathbf x_{mis_q})\) is to use a sequence of conditional univariate distributions [@Ibrahim2002; @Erler2016] -\begin{eqnarray} +\begin{align} p(\mathbf x_{mis_1}, \ldots, \mathbf x_{mis_q} \mid \mathbf X_{obs}, \boldsymbol\theta_{x}) -& = & p(\mathbf x_{mis_1} \mid \mathbf X_{obs}, \boldsymbol\theta_{x_1})\\ -& & \prod_{\ell=2}^q p(\mathbf x_{mis_{\ell}} \mid \mathbf X_{obs}, \mathbf x_{mis_1}, +& = p(\mathbf x_{mis_1} \mid \mathbf X_{obs}, \boldsymbol\theta_{x_1})\nonumber\\ +& \phantom{=} \prod_{\ell=2}^q p(\mathbf x_{mis_{\ell}} \mid \mathbf X_{obs}, \mathbf x_{mis_1}, \ldots, \mathbf x_{mis_{\ell-1}}, \boldsymbol\theta_{x_\ell}),(\#eq:factorization) -\end{eqnarray} +\end{align} with $\boldsymbol\theta_{x} = (\boldsymbol\theta_{x_1}^\top, \ldots, \boldsymbol\theta_{x_q}^\top)^\top$. @@ -318,26 +323,26 @@ and covariates. When, for instance, the analysis model is a GLM, the full conditional distribution of an incomplete covariate $x_{i, mis_{\ell}}$ can be written as -\begin{eqnarray} \nonumber +\begin{align} \nonumber p(x_{i, mis_{\ell}} \mid \mathbf y_i, \mathbf x_{i,obs}, \mathbf x_{i,mis_{-\ell}}, \boldsymbol\theta) -&\propto& p \left(y_i \mid \mathbf x_{i, obs}, \mathbf x_{i, mis}, +\propto& p \left(y_i \mid \mathbf x_{i, obs}, \mathbf x_{i, mis}, \boldsymbol\theta_{y\mid x} \right) p(\mathbf x_{i, mis}\mid \mathbf x_{i, obs}, \boldsymbol\theta_{x})\, p(\boldsymbol\theta_{y\mid x})\, p(\boldsymbol\theta_{x})\\\nonumber -&\propto& p \left(y_i \mid \mathbf x_{i, obs}, \mathbf x_{i, mis}, +\propto& p \left(y_i \mid \mathbf x_{i, obs}, \mathbf x_{i, mis}, \boldsymbol\theta_{y\mid x} \right)\\\nonumber -& & p(x_{i, mis_\ell} \mid \mathbf x_{i, obs}, \mathbf x_{i, mis_{<\ell}}, \boldsymbol\theta_{x_\ell})\\\nonumber -& & \left\{ + & p(x_{i, mis_\ell} \mid \mathbf x_{i, obs}, \mathbf x_{i, mis_{<\ell}}, \boldsymbol\theta_{x_\ell})\\\nonumber + & \left\{ \prod_{k=\ell+1}^q p(x_{i,mis_k}\mid \mathbf x_{i, obs}, \mathbf x_{i, mis_{ Date: Sun, 22 Feb 2026 15:42:08 +0100 Subject: [PATCH 2/4] fix figure captions in vignettes --- vignettes/AfterFitting.Rmd | 92 +++------------ vignettes/AfterFitting.Rmd.orig | 4 +- vignettes/MinimalExample.Rmd | 43 +++---- vignettes/MinimalExample.Rmd.orig | 2 + vignettes/SelectingParameters.Rmd | 156 +++++++++++-------------- vignettes/SelectingParameters.Rmd.orig | 4 +- 6 files changed, 114 insertions(+), 187 deletions(-) diff --git a/vignettes/AfterFitting.Rmd b/vignettes/AfterFitting.Rmd index a9fe05b5..95944d84 100644 --- a/vignettes/AfterFitting.Rmd +++ b/vignettes/AfterFitting.Rmd @@ -1,7 +1,7 @@ --- title: "After Fitting" subtitle: "Summary, visualization and evaluation of the results" -date: January 03, 2026 +date: February 22, 2026 output: rmarkdown::html_vignette: toc: true @@ -55,10 +55,7 @@ mod13a <- lm_imp(SBP ~ gender + WC + alc + creat, data = NHANES, n.iter = 500, traceplot(mod13a) ``` -
-plot of chunk trace13a -

plot of chunk trace13a

-
+ When the sampler has converged the chains show one horizontal band, as in the above figure. @@ -81,10 +78,7 @@ traceplot(mod13a, ncol = 3, use_ggplot = TRUE) + scale_color_brewer(palette = 'Dark2') ``` -
-plot of chunk ggtrace15a -

plot of chunk ggtrace15a

-
+ ### Density plot @@ -103,10 +97,7 @@ densplot(mod13a, ncol = 3, col = c("darkred", "darkblue", "darkgreen"), col = grey(0.8)))) ``` -
-plot of chunk dens13a-2 -

plot of chunk dens13a-2

-
+ or marking the posterior mean and 2.5% and 97.5% quantiles: ``` r @@ -122,10 +113,7 @@ densplot(mod13a, ncol = 3, ) ``` -
-plot of chunk densplot15a -

plot of chunk densplot15a

-
+ Like with `traceplot()` it is possible to use the **ggplot2** version of `densplot()` @@ -179,10 +167,7 @@ p13a + labels = c('JointAI', 'compl.case')) ``` -
-plot of chunk ggdens15a -

plot of chunk ggdens15a

-
+ ## Model Summary @@ -319,10 +304,7 @@ estimated posterior distribution. The figure visualizes three examples of posterior distributions and the corresponding minimum of $Pr(\theta > 0)$ and $Pr(\theta < 0)$ (shaded area): -
-plot of chunk tailprob -

plot of chunk tailprob

-
+ ## Evaluation criteria @@ -411,10 +393,7 @@ plot(MC_error(mod13a)) # left panel: all iterations 101:600 plot(MC_error(mod13a, end = 250)) # right panel: iterations 101:250 ``` -
-plot of chunk MCE15a -

plot of chunk MCE15a

-
+ ## Subset of output {#sec:subset} @@ -515,10 +494,7 @@ densplot(mod13c, subset = list(analysis_main = FALSE, other = c('beta[4]', 'beta[5]')), nrow = 1) ``` -
-plot of chunk densplot13c -

plot of chunk densplot13c

-
+ This also works when a subset of the imputed values should be displayed: @@ -537,10 +513,7 @@ sub3 traceplot(mod13d, subset = list(analysis_main = FALSE, other = sub3), ncol = 2) ``` -
-plot of chunk trace15d -

plot of chunk trace15d

-
+ When the number of imputed values is large or in order to check convergence of random effects, it may not be feasible to plot and inspect all trace plots. @@ -561,10 +534,7 @@ traceplot(mod13e, subset = list(analysis_main = FALSE, other = sample(ri, size = 12)), ncol = 4) ``` -
-plot of chunk ri -

plot of chunk ri

-
+ ### Subset of MCMC samples @@ -586,47 +556,32 @@ mod14 <- lm_imp(SBP ~ gender + WC + alc + creat, data = NHANES, n.iter = 100, densplot(mod14, ncol = 3) ``` -
-plot of chunk mod14 -

plot of chunk mod14

-
+ ``` r densplot(mod14, exclude_chains = c(2,4), ncol = 3) ``` -
-plot of chunk mod14 -

plot of chunk mod14

-
+ ``` r traceplot(mod14, thin = 10, ncol = 3) ``` -
-plot of chunk trace14 -

plot of chunk trace14

-
+ ``` r traceplot(mod14, start = 150, ncol = 3) ``` -
-plot of chunk trace14 -

plot of chunk trace14

-
+ ``` r traceplot(mod14, end = 120, ncol = 3) ``` -
-plot of chunk trace14 -

plot of chunk trace14

-
+ @@ -697,10 +652,7 @@ matplot(pred$newdata$age, pred$fitted, xlab = 'age in months', ylab = 'predicted value') ``` -
-plot of chunk predplot -

plot of chunk predplot

-
+ It is possible to have multiple variables vary and to set values for these variables: @@ -734,10 +686,7 @@ ggplot(pred$newdata, aes(x = age, y = fit, color = factor(HEIGHT_M), scale_y_continuous(name = 'Expected BMI', breaks = seq(15, 18, 0.5)) ``` -
-plot of chunk predplotgg -

plot of chunk predplotgg

-
+ @@ -785,8 +734,5 @@ of the observed and imputed values. plot_imp_distr(impDF, nrow = 1) ``` -
-plot of chunk plotimpdistr -

plot of chunk plotimpdistr

-
+ diff --git a/vignettes/AfterFitting.Rmd.orig b/vignettes/AfterFitting.Rmd.orig index dd256d5e..f7295bd2 100644 --- a/vignettes/AfterFitting.Rmd.orig +++ b/vignettes/AfterFitting.Rmd.orig @@ -19,6 +19,8 @@ knitr::opts_chunk$set( fig.width = 7, out.width = '100%', dev = "svglite", + fig.cap = "", + fig.scap = "", fig.align = 'center', fig.path = "figures_AfterFitting/" ) @@ -79,7 +81,7 @@ rows and columns for the layout of the grid of plots. With the argument `use_ggplot` it is possible to get a [**ggplot2**](https://CRAN.R-project.org/package=ggplot2) version of the traceplot. It can be extended using standard **ggplot2** syntax. -```{r ggtrace15a, fig.width = 7, fig.height = 3.5, out.width = '100%'} +```{r ggtrace15a, fig.width = 7, fig.height = 3.5, out.width = '100%', message = FALSE} library(ggplot2) traceplot(mod13a, ncol = 3, use_ggplot = TRUE) + theme(legend.position = 'bottom') + diff --git a/vignettes/MinimalExample.Rmd b/vignettes/MinimalExample.Rmd index 78134533..485c2a4f 100644 --- a/vignettes/MinimalExample.Rmd +++ b/vignettes/MinimalExample.Rmd @@ -2,7 +2,7 @@ title: "Minimal Example" description: "A minimal example to demonstrate the usage of the R package JointAI." author: "Nicole Erler" -date: January 03, 2026 +date: February 22, 2026 resource_files: - man/figures/JointAI_square.png opengraph: @@ -71,10 +71,7 @@ Convergence can be evaluated visually with a trace plot. traceplot(lm1) ``` -
-plot of chunk results_lm1 -

plot of chunk results_lm1

-
+ The function [`traceplot()`](https://nerler.github.io/JointAI/reference/traceplot.html) produces a plot of the sampled values across @@ -105,22 +102,22 @@ summary(lm1) #> #> Posterior summary: #> Mean SD 2.5% 97.5% tail-prob. GR-crit MCE/SD -#> (Intercept) 59.667 22.5323 13.8296 104.999 0.00800 1.00 0.0263 -#> genderfemale -3.088 2.2801 -7.3085 1.497 0.18533 1.00 0.0258 -#> age 0.367 0.0730 0.2256 0.512 0.00000 1.01 0.0262 -#> raceOther Hispanic 0.857 5.1357 -8.8799 10.758 0.88933 1.00 0.0258 -#> raceNon-Hispanic White -1.286 3.0295 -6.9351 4.658 0.66267 1.00 0.0258 -#> raceNon-Hispanic Black 9.061 3.4765 2.3074 15.679 0.01067 1.01 0.0258 -#> raceother 3.919 3.4728 -2.6699 11.094 0.25467 1.00 0.0258 -#> WC 0.243 0.0811 0.0835 0.401 0.00267 1.00 0.0258 -#> alc>=1 7.249 2.2744 2.5975 11.650 0.00000 1.00 0.0325 -#> educhigh -3.392 2.2355 -8.0464 0.830 0.10400 1.01 0.0267 -#> albu 5.390 4.1032 -2.9169 13.239 0.18133 1.01 0.0260 -#> bili -5.456 4.8697 -14.3350 4.293 0.25467 1.01 0.0285 +#> (Intercept) 60.879 22.8704 19.1247 106.227 0.0040 1.00 0.0271 +#> genderfemale -3.177 2.2549 -7.6423 1.099 0.1640 1.00 0.0258 +#> age 0.364 0.0708 0.2196 0.505 0.0000 1.01 0.0258 +#> raceOther Hispanic 0.518 5.0580 -9.2403 10.675 0.9373 1.00 0.0258 +#> raceNon-Hispanic White -1.451 3.0937 -7.2049 4.686 0.6227 1.00 0.0276 +#> raceNon-Hispanic Black 9.047 3.6389 2.0441 16.042 0.0147 1.00 0.0267 +#> raceother 3.686 3.4550 -3.0852 10.725 0.2653 1.00 0.0268 +#> WC 0.236 0.0822 0.0754 0.392 0.0040 1.00 0.0258 +#> alc>=1 7.272 2.3870 2.5418 11.763 0.0040 1.03 0.0284 +#> educhigh -3.397 2.1457 -7.3896 0.869 0.1120 1.00 0.0258 +#> albu 5.320 4.0590 -2.7810 12.922 0.1987 1.00 0.0291 +#> bili -5.516 4.9060 -15.2486 4.592 0.2413 1.01 0.0274 #> #> Posterior summary of residual std. deviation: #> Mean SD 2.5% 97.5% GR-crit MCE/SD -#> sigma_SBP 13.2 0.716 11.9 14.7 1 0.0281 +#> sigma_SBP 13.2 0.738 11.9 14.7 1.02 0.0282 #> #> #> MCMC settings: @@ -155,10 +152,7 @@ $$2\times\min\left\{Pr(\theta > 0), Pr(\theta < 0)\right\}$$ In the following graphics, the shaded areas represent the minimum of $Pr(\theta > 0)$ and $Pr(\theta < 0)$: -
-plot of chunk tailprob -

plot of chunk tailprob

-
+ #### Gelman-Rubin criterion The Gelman-Rubin^[Gelman, A and Rubin, DB (1992) Inference from iterative @@ -206,10 +200,7 @@ The posterior distributions can be visualized using the function `densplot()`: densplot(lm1) ``` -
-plot of chunk densplot -

plot of chunk densplot

-
+ By default, `densplot()` plots the empirical distribution of each of the chains separately. When `joined = TRUE` the distributions of the combined chains diff --git a/vignettes/MinimalExample.Rmd.orig b/vignettes/MinimalExample.Rmd.orig index 543edf2a..d74985e4 100644 --- a/vignettes/MinimalExample.Rmd.orig +++ b/vignettes/MinimalExample.Rmd.orig @@ -29,6 +29,8 @@ knitr::opts_chunk$set( fig.width = 7, fig.align = 'center', out.width = '100%', + fig.cap = "", + fig.scap = "", dev = "svglite", fig.path = "figures_MinimalExample/" ) diff --git a/vignettes/SelectingParameters.Rmd b/vignettes/SelectingParameters.Rmd index e0cda946..0ef36239 100644 --- a/vignettes/SelectingParameters.Rmd +++ b/vignettes/SelectingParameters.Rmd @@ -1,7 +1,7 @@ --- title: "Parameter Selection" subtitle: "How to specify which parameters to monitor and display in the results" -date: January 03, 2026 +date: February 22, 2026 output: rmarkdown::html_vignette: toc: true @@ -217,20 +217,20 @@ terms and transformations of variables. ``` r head(lm2$data_list$M_lvlone) -#> SBP alc occup smoke WC (Intercept) age alc>=1 smokeformer smokecurrent -#> 10 108.0000 NA 1 1 99.0 1 35 NA NA NA -#> 14 105.3333 0 1 1 82.7 1 38 NA NA NA -#> 41 110.0000 0 3 1 94.9 1 78 NA NA NA -#> 77 106.0000 1 2 1 82.4 1 23 NA NA NA -#> 91 114.6667 0 3 1 93.1 1 40 NA NA NA -#> 105 139.3333 1 NA 3 105.4 1 54 NA NA NA -#> occuplooking for work occupnot working -#> 10 NA NA -#> 14 NA NA -#> 41 NA NA -#> 77 NA NA -#> 91 NA NA -#> 105 NA NA +#> SBP alc occup smoke WC (Intercept) age alc>=1 smokeformer +#> 10 108.0000 NA 1 1 99.0 1 35 NA NA +#> 14 105.3333 0 1 1 82.7 1 38 NA NA +#> 41 110.0000 0 3 1 94.9 1 78 NA NA +#> 77 106.0000 1 2 1 82.4 1 23 NA NA +#> 91 114.6667 0 3 1 93.1 1 40 NA NA +#> 105 139.3333 1 NA 3 105.4 1 54 NA NA +#> smokecurrent occuplooking for work occupnot working +#> 10 NA NA NA +#> 14 NA NA NA +#> 41 NA NA NA +#> 77 NA NA NA +#> 91 NA NA NA +#> 105 NA NA NA ``` @@ -284,8 +284,8 @@ list_models(lm2) #> family: gaussian #> link: identity #> * Predictor variables: -#> (Intercept), age, WC, alc>=1, smokeformer, smokecurrent, occuplooking for -#> work, occupnot working +#> (Intercept), age, WC, alc>=1, smokeformer, smokecurrent, +#> occuplooking for work, occupnot working #> * Regression coefficients: #> beta[1:8] (normal prior(s) with mean 0 and precision 1e-04) #> * Precision of "SBP" : @@ -297,8 +297,8 @@ list_models(lm2) #> link: logit #> * Reference category: "<1" #> * Predictor variables: -#> (Intercept), age, WC, smokeformer, smokecurrent, occuplooking for work, -#> occupnot working +#> (Intercept), age, WC, smokeformer, smokecurrent, +#> occuplooking for work, occupnot working #> * Regression coefficients: #> alpha[1:7] (normal prior(s) with mean 0 and precision 1e-04) #> @@ -446,9 +446,11 @@ lme3b <- lme_imp(bmi ~ age + EDUC, random = ~age | ID, data = simLong, n.adapt = RinvD_main = FALSE, ranef_main = FALSE)) #> Warning: -#> It is currently not possible to use "contr.poly" for incomplete categorical -#> covariates. I will use "contr.treatment" instead. You can specify (globally) -#> which types of contrasts are used by changing "options('contrasts')". +#> It is currently not possible to use "contr.poly" for +#> incomplete categorical covariates. I will use +#> "contr.treatment" instead. You can specify (globally) which +#> types of contrasts are used by changing +#> "options('contrasts')". parameters(lme3b) #> outcome outcat varname coef @@ -525,16 +527,16 @@ summary(lm5) #> #> #> Posterior summary: -#> Mean SD 2.5% 97.5% tail-prob. GR-crit MCE/SD -#> (Intercept) 81.096 9.6988 60.971 97.166 0.00000 1.01 0.0577 -#> genderfemale 0.676 2.5491 -3.776 5.439 0.81333 1.00 0.0577 -#> WC 0.300 0.0699 0.164 0.425 0.00000 1.02 0.0577 -#> alc>=1 6.645 2.2974 2.500 11.345 0.00667 1.02 0.0689 -#> creat 8.206 8.1859 -7.115 24.301 0.34000 1.07 0.0577 +#> Mean SD 2.5% 97.5% tail-prob. GR-crit MCE/SD +#> (Intercept) 81.7399 9.6925 63.439 100.547 0.000 1.04 0.0577 +#> genderfemale 0.0802 2.6383 -4.441 5.527 0.933 1.00 0.0577 +#> WC 0.3074 0.0767 0.168 0.451 0.000 1.01 0.0577 +#> alc>=1 6.3855 2.5770 1.542 11.284 0.020 1.01 0.0670 +#> creat 6.8877 7.4473 -5.536 21.447 0.387 1.13 0.0586 #> #> Posterior summary of residual std. deviation: #> Mean SD 2.5% 97.5% GR-crit MCE/SD -#> sigma_SBP 14.4 0.806 13 16.3 1.02 0.0577 +#> sigma_SBP 14.4 0.704 13.1 15.9 1 0.0577 #> #> #> MCMC settings: @@ -549,10 +551,7 @@ summary(lm5) traceplot(lm5) ``` -
-plot of chunk unnamed-chunk-9 -

plot of chunk unnamed-chunk-9

-
+ ``` r @@ -560,10 +559,7 @@ traceplot(lm5) densplot(lm5) ``` -
-plot of chunk unnamed-chunk-9 -

plot of chunk unnamed-chunk-9

-
+ ``` r @@ -572,26 +568,26 @@ GR_crit(lm5) #> Potential scale reduction factors: #> #> Point est. Upper C.I. -#> (Intercept) 1.00 1.01 -#> genderfemale 1.00 1.00 -#> WC 1.00 1.02 -#> alc>=1 1.00 1.02 -#> creat 1.03 1.07 -#> sigma_SBP 1.00 1.02 +#> (Intercept) 1.009 1.04 +#> genderfemale 0.999 1.00 +#> WC 1.003 1.01 +#> alc>=1 1.003 1.01 +#> creat 1.035 1.13 +#> sigma_SBP 0.997 1.00 #> #> Multivariate psrf #> -#> 1.03 +#> 1.04 # Monte Carlo Error of the MCMC sample MC_error(lm5) -#> est MCSE SD MCSE/SD -#> (Intercept) 81.10 0.560 9.70 0.058 -#> genderfemale 0.68 0.147 2.55 0.058 -#> WC 0.30 0.004 0.07 0.058 -#> alc>=1 6.64 0.158 2.30 0.069 -#> creat 8.21 0.473 8.19 0.058 -#> sigma_SBP 14.42 0.047 0.81 0.058 +#> est MCSE SD MCSE/SD +#> (Intercept) 81.74 0.5596 9.692 0.058 +#> genderfemale 0.08 0.1523 2.638 0.058 +#> WC 0.31 0.0044 0.077 0.058 +#> alc>=1 6.39 0.1727 2.577 0.067 +#> creat 6.89 0.4361 7.447 0.059 +#> sigma_SBP 14.38 0.0407 0.704 0.058 ``` When `analysis_main` was not switched on the default behaviour is that all @@ -607,10 +603,7 @@ lm4 <- lm_imp(SBP ~ gender + WC + alc + creat, traceplot(lm4, ncol = 4) ``` -
-plot of chunk unnamed-chunk-10 -

plot of chunk unnamed-chunk-10

-
+ ### Select a subset of the variables to display To display other parts of the MCMC sample, `subset` needs to be specified: @@ -621,21 +614,21 @@ GR_crit(lm5, subset = c(analysis_main = FALSE, other_models = TRUE)) #> Potential scale reduction factors: #> #> Point est. Upper C.I. -#> alc: (Intercept) 1.081 1.268 -#> alc: genderfemale 1.104 1.327 -#> alc: WC 1.015 1.061 -#> alc: creat 1.061 1.210 -#> creat: (Intercept) 1.015 1.056 -#> creat: genderfemale 0.996 0.998 -#> creat: WC 1.018 1.060 -#> WC: (Intercept) 1.003 1.021 -#> WC: genderfemale 1.001 1.013 -#> sigma_creat 1.006 1.022 -#> sigma_WC 1.007 1.010 +#> alc: (Intercept) 0.997 1.001 +#> alc: genderfemale 1.005 1.025 +#> alc: WC 1.030 1.086 +#> alc: creat 1.007 1.034 +#> creat: (Intercept) 0.996 0.997 +#> creat: genderfemale 0.999 1.000 +#> creat: WC 0.995 0.996 +#> WC: (Intercept) 1.011 1.039 +#> WC: genderfemale 1.003 1.024 +#> sigma_creat 1.010 1.040 +#> sigma_WC 1.007 1.032 #> #> Multivariate psrf #> -#> 1.1 +#> 1.05 ``` To select only some of the parameters, they can be specified directly by @@ -652,16 +645,16 @@ summary(lm5, subset = list(other = c('creat', 'alc>=1'))) #> #> #> Posterior summary: -#> Mean SD 2.5% 97.5% tail-prob. GR-crit MCE/SD -#> (Intercept) 81.096 9.6988 60.971 97.166 0.00000 1.01 0.0577 -#> genderfemale 0.676 2.5491 -3.776 5.439 0.81333 1.00 0.0577 -#> WC 0.300 0.0699 0.164 0.425 0.00000 1.02 0.0577 -#> alc>=1 6.645 2.2974 2.500 11.345 0.00667 1.02 0.0689 -#> creat 8.206 8.1859 -7.115 24.301 0.34000 1.07 0.0577 +#> Mean SD 2.5% 97.5% tail-prob. GR-crit MCE/SD +#> (Intercept) 81.7399 9.6925 63.439 100.547 0.000 1.04 0.0577 +#> genderfemale 0.0802 2.6383 -4.441 5.527 0.933 1.00 0.0577 +#> WC 0.3074 0.0767 0.168 0.451 0.000 1.01 0.0577 +#> alc>=1 6.3855 2.5770 1.542 11.284 0.020 1.01 0.0670 +#> creat 6.8877 7.4473 -5.536 21.447 0.387 1.13 0.0586 #> #> Posterior summary of residual std. deviation: #> Mean SD 2.5% 97.5% GR-crit MCE/SD -#> sigma_SBP 14.4 0.806 13 16.3 1.02 0.0577 +#> sigma_SBP 14.4 0.704 13.1 15.9 1 0.0577 #> #> #> MCMC settings: @@ -693,10 +686,7 @@ sub3 traceplot(lm2, subset = list(other = sub3), ncol = 2) ``` -
-plot of chunk lm2_2 -

plot of chunk lm2_2

-
+ ### Random subset of subject-specific values @@ -719,10 +709,7 @@ rs <- grep('^b_bmi_ID\\[[[:digit:]]+,2\\]$', colnames(lme4$MCMC[[1]]), value = T traceplot(lme4, subset = list(other = sample(ri, size = 8)), ncol = 4) ``` -
-plot of chunk unnamed-chunk-11 -

plot of chunk unnamed-chunk-11

-
+ ``` r @@ -730,8 +717,5 @@ traceplot(lme4, subset = list(other = sample(ri, size = 8)), ncol = 4) traceplot(lme4, subset = list(other = sample(rs, size = 8)), ncol = 4) ``` -
-plot of chunk unnamed-chunk-11 -

plot of chunk unnamed-chunk-11

-
+ diff --git a/vignettes/SelectingParameters.Rmd.orig b/vignettes/SelectingParameters.Rmd.orig index 40ae870f..32cc9e2d 100644 --- a/vignettes/SelectingParameters.Rmd.orig +++ b/vignettes/SelectingParameters.Rmd.orig @@ -20,6 +20,8 @@ knitr::opts_chunk$set( comment = "#>", dev = "svglite", out.width = "100%", + fig.cap = "", + fig.scap = "", fig.width = 7, fig.align = 'center', fig.path = "figures_SelectingParameters/" @@ -339,7 +341,7 @@ Note that the model summary will contain separate parts per sub-model when regression coefficients from different models are monitored. This also works when a subset of the imputed values should be displayed: -```{r lm2_2, fig.height = 2, fig.width = 5, out.width = "50%", warning = FALSE} +```{r lm2_2, fig.height = 2, fig.width = 5, out.width = "60%", warning = FALSE} # Re-run the model from above, now creating MCMC samples lm2 <- lm_imp(SBP ~ age + WC + alc + smoke + occup, data = NHANES, n.iter = 100, progress.bar = 'none', From 96deed88c692ea826e0321f31e73034f72ed9b2c Mon Sep 17 00:00:00 2001 From: Nicole Erler Date: Sun, 22 Feb 2026 15:42:39 +0100 Subject: [PATCH 3/4] automatically created figure outputs due to re-run of vignettes --- vignettes/figures_AfterFitting/mod14-1.svg | 318 +++++----- vignettes/figures_AfterFitting/mod14-2.svg | 296 +++++----- vignettes/figures_AfterFitting/ri-1.svg | 343 +++++------ vignettes/figures_AfterFitting/trace14-1.svg | 206 ++++--- vignettes/figures_AfterFitting/trace14-2.svg | 192 +++--- vignettes/figures_AfterFitting/trace14-3.svg | 203 ++++--- .../figures_MinimalExample/densplot-1.svg | 559 +++++++++--------- .../figures_MinimalExample/results_lm1-1.svg | 303 +++++----- .../figures_SelectingParameters/lm2_2-1.svg | 48 +- .../unnamed-chunk-10-1.svg | 95 +-- .../unnamed-chunk-11-1.svg | 206 ++++--- .../unnamed-chunk-11-2.svg | 204 ++++--- .../unnamed-chunk-9-1.svg | 173 +++--- .../unnamed-chunk-9-2.svg | 294 +++++---- 14 files changed, 1717 insertions(+), 1723 deletions(-) diff --git a/vignettes/figures_AfterFitting/mod14-1.svg b/vignettes/figures_AfterFitting/mod14-1.svg index ec74d227..cd77dd22 100644 --- a/vignettes/figures_AfterFitting/mod14-1.svg +++ b/vignettes/figures_AfterFitting/mod14-1.svg @@ -26,26 +26,28 @@ - - - - - -60 -80 -100 -120 - + + + + + + +40 +60 +80 +100 +120 + - - - - + + + + 0.00 -0.01 -0.02 -0.03 -0.04 +0.01 +0.02 +0.03 +0.04 @@ -63,11 +65,11 @@ - - - - - + + + + + @@ -77,26 +79,26 @@ - - - - - --5 -0 -5 -10 - + + + + + + +-10 +-5 +0 +5 +10 + - - - - + + + 0.00 -0.05 -0.10 -0.15 -0.20 +0.05 +0.10 +0.15 @@ -109,11 +111,11 @@ density - - - - - + + + + + @@ -123,33 +125,32 @@ - - - - - - - - -0.0 -0.2 -0.4 -0.6 - + + + + + + + +0.1 +0.2 +0.3 +0.4 +0.5 +0.6 + - - - - - - + + + + + 0 -1 -2 -3 -4 -5 -6 +1 +2 +3 +4 +5 @@ -162,11 +163,11 @@ density - - - - - + + + + + @@ -176,26 +177,26 @@ - - - - - -0 -5 -10 -15 - + + + + + +0 +5 +10 +15 + - - - - + + + + 0.00 -0.05 -0.10 -0.15 -0.20 +0.05 +0.10 +0.15 +0.20 @@ -208,11 +209,11 @@ density - - - - - + + + + + @@ -222,33 +223,31 @@ - - - - - - - - --20 --10 -0 -10 -20 -30 -40 - + + + + + + + + +-20 +-10 +0 +10 +20 +30 +40 + - - - - - - + + + + + 0.00 -0.02 -0.04 -0.06 +0.02 +0.04 @@ -261,11 +260,11 @@ density - - - - - + + + + + @@ -275,34 +274,33 @@ - - - - - - - - -11 -12 -13 -14 -15 -16 -17 - + + + + + + + + +12 +13 +14 +15 +16 +17 +18 + - - - - - + + + + + + 0.0 -0.1 -0.2 -0.3 -0.4 -0.5 +0.2 +0.4 +0.6 @@ -315,11 +313,11 @@ density - - - - - + + + + + diff --git a/vignettes/figures_AfterFitting/mod14-2.svg b/vignettes/figures_AfterFitting/mod14-2.svg index 28b9c62f..21913702 100644 --- a/vignettes/figures_AfterFitting/mod14-2.svg +++ b/vignettes/figures_AfterFitting/mod14-2.svg @@ -35,26 +35,28 @@ - - - - - -60 -80 -100 -120 - + + + + + + +40 +60 +80 +100 +120 + - - - - + + + + 0.00 -0.01 -0.02 -0.03 -0.04 +0.01 +0.02 +0.03 +0.04 @@ -67,9 +69,9 @@ density - - - + + + @@ -79,26 +81,26 @@ - - - - - --5 -0 -5 -10 - + + + + + + +-10 +-5 +0 +5 +10 + - - - - + + + 0.00 -0.05 -0.10 -0.15 -0.20 +0.05 +0.10 +0.15 @@ -111,9 +113,9 @@ density - - - + + + @@ -123,31 +125,30 @@ - - - - - - - - -0.0 -0.2 -0.4 -0.6 - - - - - - - -0 -1 -2 -3 -4 -5 + + + + + + +0.1 +0.2 +0.3 +0.4 +0.5 + + + + + + + +0 +1 +2 +3 +4 +5 @@ -160,9 +161,9 @@ density - - - + + + @@ -172,24 +173,26 @@ - - - - - -0 -5 -10 -15 - - - - - -0.00 -0.05 -0.10 -0.15 + + + + + +0 +5 +10 +15 + + + + + + +0.00 +0.05 +0.10 +0.15 +0.20 @@ -202,9 +205,9 @@ density - - - + + + @@ -214,33 +217,29 @@ - - - - - - - - --20 --10 -0 -10 -20 -30 -40 - + + + + + + + +-20 +-10 +0 +10 +20 +30 + - - - - - - + + + + + 0.00 -0.02 -0.04 -0.06 +0.02 +0.04 @@ -253,9 +252,9 @@ density - - - + + + @@ -265,32 +264,33 @@ - - - - - - - -12 -13 -14 -15 -16 -17 - - - - - - - -0.0 -0.1 -0.2 -0.3 -0.4 -0.5 + + + + + + + + +12 +13 +14 +15 +16 +17 +18 + + + + + + + + +0.0 +0.2 +0.4 +0.6 @@ -303,9 +303,9 @@ density - - - + + + diff --git a/vignettes/figures_AfterFitting/ri-1.svg b/vignettes/figures_AfterFitting/ri-1.svg index 3970ec29..77f86806 100644 --- a/vignettes/figures_AfterFitting/ri-1.svg +++ b/vignettes/figures_AfterFitting/ri-1.svg @@ -33,7 +33,7 @@ - + @@ -46,18 +46,16 @@ 100 300 500 - - - - - - - - - -16.0 -16.6 -17.2 + + + + + + + +16.6 +17.0 +17.4 @@ -66,12 +64,12 @@ -b_bmi_ID[110,1] +b_bmi_ID[9,1] Iterations - - + + @@ -79,7 +77,7 @@ - + @@ -92,15 +90,18 @@ 100 300 500 - - - - - -16.0 -16.5 -17.0 -17.5 + + + + + + + + + +17.0 +17.6 +18.2 @@ -109,12 +110,12 @@ -b_bmi_ID[200,1] +b_bmi_ID[42,1] Iterations - - + + @@ -122,7 +123,7 @@ - + @@ -135,17 +136,19 @@ 100 300 500 - - - - - - - - -16.2 -16.8 -17.4 + + + + + + + + + +15.4 +15.8 +16.2 +16.6 @@ -154,12 +157,12 @@ -b_bmi_ID[31,1] +b_bmi_ID[189,1] Iterations - - + + @@ -167,7 +170,7 @@ - + @@ -180,13 +183,18 @@ 100 300 500 - - - - -16.5 -17.0 -17.5 + + + + + + + + +15.0 +15.4 +15.8 +16.2 @@ -195,12 +203,12 @@ -b_bmi_ID[119,1] +b_bmi_ID[88,1] Iterations - - + + @@ -208,7 +216,7 @@ - + @@ -221,16 +229,18 @@ 100 300 500 - - - - - - - -16.0 -16.4 -16.8 + + + + + + + + +16.4 +16.8 +17.2 +17.6 @@ -239,12 +249,12 @@ -b_bmi_ID[72,1] +b_bmi_ID[162,1] Iterations - - + + @@ -252,7 +262,7 @@ - + @@ -265,18 +275,13 @@ 100 300 500 - - - - - - - - - -15.8 -16.4 -17.0 + + + + +16.0 +16.5 +17.0 @@ -285,12 +290,12 @@ -b_bmi_ID[154,1] +b_bmi_ID[79,1] Iterations - - + + @@ -298,7 +303,7 @@ - + @@ -311,18 +316,18 @@ 100 300 500 - - - - - - - - -16.6 -17.0 -17.4 -17.8 + + + + + + + + +16.0 +16.4 +16.8 +17.2 @@ -331,12 +336,12 @@ -b_bmi_ID[82,1] +b_bmi_ID[105,1] Iterations - - + + @@ -344,7 +349,7 @@ - + @@ -357,13 +362,18 @@ 100 300 500 - - - - - -15.0 -16.0 + + + + + + + + +16.2 +16.6 +17.0 +17.4 @@ -372,12 +382,12 @@ -b_bmi_ID[125,1] +b_bmi_ID[13,1] Iterations - - + + @@ -385,7 +395,7 @@ - + @@ -398,18 +408,15 @@ 100 300 500 - - - - - - - - -16.2 -16.6 -17.0 -17.4 + + + + + +15.5 +16.0 +16.5 +17.0 @@ -418,12 +425,12 @@ -b_bmi_ID[170,1] +b_bmi_ID[3,1] Iterations - - + + @@ -431,7 +438,7 @@ - + @@ -444,13 +451,18 @@ 100 300 500 - - - - -16.0 -16.5 -17.0 + + + + + + + + +15.8 +16.2 +16.6 +17.0 @@ -459,12 +471,12 @@ -b_bmi_ID[176,1] +b_bmi_ID[152,1] Iterations - - + + @@ -472,7 +484,7 @@ - + @@ -485,17 +497,13 @@ 100 300 500 - - - - - - - - -14.8 -15.4 -16.0 + + + + +15.5 +16.0 +16.5 @@ -504,12 +512,12 @@ -b_bmi_ID[80,1] +b_bmi_ID[149,1] Iterations - - + + @@ -517,7 +525,7 @@ - + @@ -530,13 +538,18 @@ 100 300 500 - - - - -16.0 -16.5 -17.0 + + + + + + + + +16.4 +16.8 +17.2 +17.6 @@ -545,12 +558,12 @@ -b_bmi_ID[79,1] +b_bmi_ID[57,1] Iterations - - + + diff --git a/vignettes/figures_AfterFitting/trace14-1.svg b/vignettes/figures_AfterFitting/trace14-1.svg index 75ed32ac..fc65cb07 100644 --- a/vignettes/figures_AfterFitting/trace14-1.svg +++ b/vignettes/figures_AfterFitting/trace14-1.svg @@ -33,7 +33,7 @@ - + @@ -47,19 +47,17 @@ 140 160 180 - - - - - - - -60 -70 -80 -90 -100 -110 + + + + + + +60 +70 +80 +90 +100 @@ -72,10 +70,10 @@ Iterations - - - - + + + + @@ -83,7 +81,7 @@ - + @@ -97,17 +95,21 @@ 140 160 180 - - - - - - --4 --2 -0 -2 -4 + + + + + + + + +-4 +-2 +0 +2 +4 +6 +8 @@ -120,10 +122,10 @@ Iterations - - - - + + + + @@ -131,7 +133,7 @@ - + @@ -145,15 +147,18 @@ 140 160 180 - - - - - -0.1 -0.2 -0.3 -0.4 + + + + + + + + +0.20 +0.30 +0.40 +0.50 @@ -166,10 +171,10 @@ Iterations - - - - + + + + @@ -177,7 +182,7 @@ - + @@ -191,21 +196,17 @@ 140 160 180 - - - - - - - - -0 -2 -4 -6 -8 -10 -12 + + + + + + +2 +4 +6 +8 +10 @@ -218,10 +219,10 @@ Iterations - - - - + + + + @@ -229,7 +230,7 @@ - + @@ -243,21 +244,19 @@ 140 160 180 - - - - - - - - --10 --5 -0 -5 -10 -15 -20 + + + + + + + +-5 +0 +5 +10 +15 +20 @@ -270,10 +269,10 @@ Iterations - - - - + + + + @@ -281,7 +280,7 @@ - + @@ -295,18 +294,15 @@ 140 160 180 - - - - - - - - -13.5 -14.5 -15.5 -16.5 + + + + + +13 +14 +15 +16 @@ -319,10 +315,10 @@ Iterations - - - - + + + + diff --git a/vignettes/figures_AfterFitting/trace14-2.svg b/vignettes/figures_AfterFitting/trace14-2.svg index 49ed87bb..95b24fbc 100644 --- a/vignettes/figures_AfterFitting/trace14-2.svg +++ b/vignettes/figures_AfterFitting/trace14-2.svg @@ -33,7 +33,7 @@ - + @@ -49,18 +49,18 @@ 180 190 200 - - - - - - - -60 -70 -80 -90 -100 + + + + + + + +60 +70 +80 +90 +100 @@ -73,10 +73,10 @@ Iterations - - - - + + + + @@ -84,7 +84,7 @@ - + @@ -100,21 +100,13 @@ 180 190 200 - - - - - - - - --6 --4 --2 -0 -2 -4 -6 + + + + +-5 +0 +5 @@ -127,10 +119,10 @@ Iterations - - - - + + + + @@ -138,7 +130,7 @@ - + @@ -154,19 +146,17 @@ 180 190 200 - - - - - - - -0.1 -0.2 -0.3 -0.4 -0.5 -0.6 + + + + + + +0.1 +0.2 +0.3 +0.4 +0.5 @@ -179,10 +169,10 @@ Iterations - - - - + + + + @@ -190,7 +180,7 @@ - + @@ -206,13 +196,19 @@ 180 190 200 - - - - -0 -5 -10 + + + + + + + +2 +4 +6 +8 +10 +12 @@ -225,10 +221,10 @@ Iterations - - - - + + + + @@ -236,7 +232,7 @@ - + @@ -252,17 +248,17 @@ 180 190 200 - - - - - - --20 --10 -0 -10 -20 + + + + + + +-10 +0 +10 +20 +30 @@ -275,10 +271,10 @@ Iterations - - - - + + + + @@ -286,7 +282,7 @@ - + @@ -302,15 +298,17 @@ 180 190 200 - - - - - -13 -14 -15 -16 + + + + + + +13 +14 +15 +16 +17 @@ -323,10 +321,10 @@ Iterations - - - - + + + + diff --git a/vignettes/figures_AfterFitting/trace14-3.svg b/vignettes/figures_AfterFitting/trace14-3.svg index 234e30c8..d553d49e 100644 --- a/vignettes/figures_AfterFitting/trace14-3.svg +++ b/vignettes/figures_AfterFitting/trace14-3.svg @@ -33,7 +33,7 @@ - + @@ -45,17 +45,19 @@ 110 115 120 - - - - - - -60 -70 -80 -90 -100 + + + + + + + +50 +60 +70 +80 +90 +100 @@ -68,10 +70,10 @@ Iterations - - - - + + + + @@ -79,7 +81,7 @@ - + @@ -91,19 +93,13 @@ 110 115 120 - - - - - - - --4 --2 -0 -2 -4 -6 + + + + +-5 +0 +5 @@ -116,10 +112,10 @@ Iterations - - - - + + + + @@ -127,7 +123,7 @@ - + @@ -139,15 +135,16 @@ 110 115 120 - - - - - -0.1 -0.2 -0.3 -0.4 + + + + + + + +0.20 +0.30 +0.40 @@ -160,10 +157,10 @@ Iterations - - - - + + + + @@ -171,7 +168,7 @@ - + @@ -183,21 +180,21 @@ 110 115 120 - - - - - - - - -0 -2 -4 -6 -8 -10 -12 + + + + + + + + +0 +2 +4 +6 +8 +10 +12 @@ -210,10 +207,10 @@ Iterations - - - - + + + + @@ -221,7 +218,7 @@ - + @@ -233,21 +230,21 @@ 110 115 120 - - - - - - - - - --5 -0 -5 -10 -20 -30 + + + + + + + + +-5 +0 +5 +10 +15 +20 +25 @@ -260,10 +257,10 @@ Iterations - - - - + + + + @@ -271,7 +268,7 @@ - + @@ -283,17 +280,15 @@ 110 115 120 - - - - - - -12 -13 -14 -15 -16 + + + + + +13 +14 +15 +16 @@ -306,10 +301,10 @@ Iterations - - - - + + + + diff --git a/vignettes/figures_MinimalExample/densplot-1.svg b/vignettes/figures_MinimalExample/densplot-1.svg index 0385afba..df118b67 100644 --- a/vignettes/figures_MinimalExample/densplot-1.svg +++ b/vignettes/figures_MinimalExample/densplot-1.svg @@ -26,22 +26,22 @@ - - - - - -0 -50 -100 -150 - + + + + + +0 +50 +100 +150 + - - - + + + 0.000 -0.015 +0.015 @@ -59,9 +59,9 @@ - - - + + + @@ -71,22 +71,22 @@ - - - - - --10 --5 -0 -5 - + + + + + +-10 +-5 +0 +5 + - - - + + + 0.00 -0.10 +0.10 @@ -99,9 +99,9 @@ density - - - + + + @@ -111,29 +111,28 @@ - - - - - - - -0.1 -0.2 -0.3 -0.4 -0.5 -0.6 - + + + + + + + +0.1 +0.3 +0.5 + - - - - - + + + + + + 0 -2 -4 +2 +4 +6 @@ -146,9 +145,9 @@ density - - - + + + @@ -158,26 +157,26 @@ - - - - - - - --20 --10 -0 -10 -20 -30 - + + + + + + +-20 +-10 +0 +10 +20 + - - - + + + + 0.00 -0.04 +0.04 +0.08 @@ -190,9 +189,9 @@ density - - - + + + @@ -202,29 +201,30 @@ - - - - - - - --15 --5 -0 -5 -10 - + + + + + + + +-15 +-10 +-5 +0 +5 +10 + - - - - - - - + + + + + + + 0.00 -0.08 +0.08 @@ -237,9 +237,9 @@ density - - - + + + @@ -249,32 +249,32 @@ - - - - - - - - --5 -0 -5 -10 -15 -20 -25 - + + + + + + + + +-5 +0 +5 +10 +15 +20 +25 + - - - - - - + + + + + + 0.00 -0.06 -0.12 +0.06 +0.12 @@ -287,9 +287,9 @@ density - - - + + + @@ -299,29 +299,30 @@ - - - - - - - - --10 -0 -5 -10 -15 -20 - + + + + + + + +-10 +-5 +0 +5 +10 +15 + - - - - - + + + + + + 0.00 -0.06 +0.06 +0.12 @@ -334,9 +335,9 @@ density - - - + + + @@ -346,28 +347,28 @@ - - - - - - - - --0.1 -0.1 -0.3 -0.5 - + + + + + + + + +-0.1 +0.1 +0.3 +0.5 + - - - - - + + + + + 0 -2 -4 +2 +4 @@ -380,9 +381,9 @@ density - - - + + + @@ -392,22 +393,22 @@ - - - - - -0 -5 -10 -15 - + + + + + +0 +5 +10 +15 + - - - + + + 0.00 -0.10 +0.10 @@ -420,9 +421,9 @@ density - - - + + + @@ -432,24 +433,24 @@ - - - - - - --15 --10 --5 -0 -5 - + + + + + +-10 +-5 +0 +5 + - - - + + + + 0.00 -0.10 +0.10 +0.20 @@ -462,9 +463,9 @@ density - - - + + + @@ -474,28 +475,30 @@ - - - - - - - - --10 -0 -5 -10 -20 - + + + + + + + + + +-15 +-5 +0 +5 +10 +20 + - - - - - + + + + + 0.00 -0.06 +0.06 @@ -508,9 +511,9 @@ density - - - + + + @@ -520,24 +523,23 @@ - - - - - --20 --10 -0 -10 - + + + + + +-20 +-10 +0 +10 + - - - - + + + + 0.00 -0.04 -0.08 +0.06 @@ -550,9 +552,9 @@ density - - - + + + @@ -562,30 +564,27 @@ - - - - - - - -11 -12 -13 -14 -15 -16 - + + + + + + + + +11 +12 +14 +16 + - - - - - - + + + + + 0.0 -0.3 -0.6 +0.3 @@ -598,9 +597,9 @@ density - - - + + + diff --git a/vignettes/figures_MinimalExample/results_lm1-1.svg b/vignettes/figures_MinimalExample/results_lm1-1.svg index 1e6970c5..5b74b3ae 100644 --- a/vignettes/figures_MinimalExample/results_lm1-1.svg +++ b/vignettes/figures_MinimalExample/results_lm1-1.svg @@ -33,7 +33,7 @@ - + @@ -49,16 +49,13 @@ 400 500 600 - - - - - - - - -0 -60 + + + + + +0 +100 @@ -71,8 +68,8 @@ Iterations - - + + @@ -80,7 +77,7 @@ - + @@ -96,14 +93,12 @@ 400 500 600 - - - - - --10 -0 -5 + + + + +-10 +0 @@ -116,8 +111,8 @@ Iterations - - + + @@ -125,7 +120,7 @@ - + @@ -141,15 +136,15 @@ 400 500 600 - - - - - - -0.2 -0.4 -0.6 + + + + + + + +0.1 +0.4 @@ -162,8 +157,8 @@ Iterations - - + + @@ -171,7 +166,7 @@ - + @@ -187,13 +182,17 @@ 400 500 600 - - - - - --10 -10 + + + + + + + + +-15 +0 +15 @@ -206,8 +205,8 @@ Iterations - - + + @@ -215,7 +214,7 @@ - + @@ -231,15 +230,13 @@ 400 500 600 - - - - - - --10 -0 -10 + + + + + +-10 +0 @@ -252,8 +249,8 @@ Iterations - - + + @@ -261,7 +258,7 @@ - + @@ -277,14 +274,15 @@ 400 500 600 - - - - - - -0 -10 + + + + + + +0 +10 +20 @@ -297,8 +295,8 @@ Iterations - - + + @@ -306,7 +304,7 @@ - + @@ -322,16 +320,15 @@ 400 500 600 - - - - - - - --10 -0 -10 + + + + + + +-5 +5 +15 @@ -344,8 +341,8 @@ Iterations - - + + @@ -353,7 +350,7 @@ - + @@ -369,15 +366,15 @@ 400 500 600 - - - - - - - -0.0 -0.3 + + + + + + + +0.0 +0.3 @@ -390,8 +387,8 @@ Iterations - - + + @@ -399,7 +396,7 @@ - + @@ -415,14 +412,14 @@ 400 500 600 - - - - - -0 -5 -15 + + + + + +0 +5 +15 @@ -435,8 +432,8 @@ Iterations - - + + @@ -444,7 +441,7 @@ - + @@ -460,12 +457,12 @@ 400 500 600 - - - - --10 -0 + + + + +-10 +0 @@ -478,8 +475,8 @@ Iterations - - + + @@ -487,7 +484,7 @@ - + @@ -503,15 +500,16 @@ 400 500 600 - - - - - - --5 -5 -15 + + + + + + + +-10 +5 +15 @@ -524,8 +522,8 @@ Iterations - - + + @@ -533,7 +531,7 @@ - + @@ -549,17 +547,17 @@ 400 500 600 - - - - - - - - --20 --5 -10 + + + + + + + + +-20 +-5 +10 @@ -572,8 +570,8 @@ Iterations - - + + @@ -581,7 +579,7 @@ - + @@ -597,16 +595,15 @@ 400 500 600 - - - - - - - -11 -13 -15 + + + + + + + +11 +14 @@ -619,8 +616,8 @@ Iterations - - + + diff --git a/vignettes/figures_SelectingParameters/lm2_2-1.svg b/vignettes/figures_SelectingParameters/lm2_2-1.svg index 3b14cade..adb6ff1a 100644 --- a/vignettes/figures_SelectingParameters/lm2_2-1.svg +++ b/vignettes/figures_SelectingParameters/lm2_2-1.svg @@ -33,7 +33,7 @@ - + @@ -46,18 +46,13 @@ 100 140 180 - - - - - - - - - -50 -80 -110 + + + + + +60 +100 @@ -70,8 +65,8 @@ Iterations - - + + @@ -79,7 +74,7 @@ - + @@ -92,14 +87,15 @@ 100 140 180 - - - - - - -60 -100 + + + + + + +60 +100 +140 @@ -112,8 +108,8 @@ Iterations - - + + diff --git a/vignettes/figures_SelectingParameters/unnamed-chunk-10-1.svg b/vignettes/figures_SelectingParameters/unnamed-chunk-10-1.svg index d3da1e45..8e9f5235 100644 --- a/vignettes/figures_SelectingParameters/unnamed-chunk-10-1.svg +++ b/vignettes/figures_SelectingParameters/unnamed-chunk-10-1.svg @@ -33,7 +33,7 @@ - + @@ -46,13 +46,16 @@ 100 140 180 - - - - - -0.2 -0.4 + + + + + + + +0.2 +0.4 +0.6 @@ -65,8 +68,8 @@ Iterations - - + + @@ -74,7 +77,7 @@ - + @@ -87,15 +90,15 @@ 100 140 180 - - - - - - -0.3 -0.5 -0.7 + + + + + + +0.3 +0.5 +0.7 @@ -108,8 +111,8 @@ Iterations - - + + @@ -117,7 +120,7 @@ - + @@ -130,15 +133,15 @@ 100 140 180 - - - - - - -0.1 -0.3 -0.5 + + + + + + +0.1 +0.3 +0.5 @@ -151,8 +154,8 @@ Iterations - - + + @@ -160,7 +163,7 @@ - + @@ -173,15 +176,15 @@ 100 140 180 - - - - - - -0.90 -0.94 -0.98 + + + + + + +0.88 +0.92 +0.96 @@ -194,8 +197,8 @@ Iterations - - + + diff --git a/vignettes/figures_SelectingParameters/unnamed-chunk-11-1.svg b/vignettes/figures_SelectingParameters/unnamed-chunk-11-1.svg index 02e5acfa..c1317a20 100644 --- a/vignettes/figures_SelectingParameters/unnamed-chunk-11-1.svg +++ b/vignettes/figures_SelectingParameters/unnamed-chunk-11-1.svg @@ -33,7 +33,7 @@ - + @@ -46,15 +46,15 @@ 100 140 180 - - - - - -16.5 -17.0 -17.5 -18.0 + + + + + + +16.0 +17.0 +18.0 @@ -63,12 +63,12 @@ -b_bmi_ID[13,1] +b_bmi_ID[79,1] Iterations - - + + @@ -76,7 +76,7 @@ - + @@ -89,15 +89,13 @@ 100 140 180 - - - - - -16.5 -17.0 -17.5 -18.0 + + + + + +15.0 +16.0 @@ -106,12 +104,12 @@ -b_bmi_ID[196,1] +b_bmi_ID[66,1] Iterations - - + + @@ -119,7 +117,7 @@ - + @@ -132,15 +130,15 @@ 100 140 180 - - - - - -16.0 -16.5 -17.0 -17.5 + + + + + + +16.5 +17.5 +18.5 @@ -149,12 +147,12 @@ -b_bmi_ID[192,1] +b_bmi_ID[100,1] Iterations - - + + @@ -162,7 +160,7 @@ - + @@ -175,13 +173,15 @@ 100 140 180 - - - - - -16.5 -17.5 + + + + + + +16.0 +17.0 +18.0 @@ -190,12 +190,12 @@ -b_bmi_ID[162,1] +b_bmi_ID[13,1] Iterations - - + + @@ -203,7 +203,7 @@ - + @@ -216,16 +216,15 @@ 100 140 180 - - - - - - - -15.0 -16.0 -17.0 + + + + + +16.0 +16.5 +17.0 +17.5 @@ -234,12 +233,12 @@ -b_bmi_ID[65,1] +b_bmi_ID[159,1] Iterations - - + + @@ -247,7 +246,7 @@ - + @@ -260,13 +259,15 @@ 100 140 180 - - - - - -16.5 -17.5 + + + + + +16.5 +17.0 +17.5 +18.0 @@ -275,12 +276,12 @@ -b_bmi_ID[194,1] +b_bmi_ID[196,1] Iterations - - + + @@ -288,7 +289,7 @@ - + @@ -301,18 +302,15 @@ 100 140 180 - - - - - - - - -16.5 -17.5 -18.5 -19.5 + + + + + +17.5 +18.0 +18.5 +19.0 @@ -321,12 +319,12 @@ -b_bmi_ID[53,1] +b_bmi_ID[46,1] Iterations - - + + @@ -334,7 +332,7 @@ - + @@ -347,15 +345,15 @@ 100 140 180 - - - - - - -16.0 -17.0 -18.0 + + + + + +16.0 +16.5 +17.0 +17.5 @@ -364,12 +362,12 @@ -b_bmi_ID[44,1] +b_bmi_ID[187,1] Iterations - - + + diff --git a/vignettes/figures_SelectingParameters/unnamed-chunk-11-2.svg b/vignettes/figures_SelectingParameters/unnamed-chunk-11-2.svg index e8641044..a514b87d 100644 --- a/vignettes/figures_SelectingParameters/unnamed-chunk-11-2.svg +++ b/vignettes/figures_SelectingParameters/unnamed-chunk-11-2.svg @@ -33,7 +33,7 @@ - + @@ -46,14 +46,16 @@ 100 140 180 - - - - - --0.04 -0.00 -0.02 + + + + + + + +-0.10 +-0.06 +-0.02 @@ -62,12 +64,12 @@ -b_bmi_ID[88,2] +b_bmi_ID[112,2] Iterations - - + + @@ -75,7 +77,7 @@ - + @@ -88,13 +90,15 @@ 100 140 180 - - - - - --0.02 -0.02 + + + + + + +-0.04 +0.00 +0.04 @@ -103,12 +107,12 @@ -b_bmi_ID[50,2] +b_bmi_ID[157,2] Iterations - - + + @@ -116,7 +120,7 @@ - + @@ -129,15 +133,15 @@ 100 140 180 - - - - - --0.02 -0.00 -0.02 -0.04 + + + + + + +-0.06 +-0.02 +0.02 @@ -146,12 +150,12 @@ -b_bmi_ID[151,2] +b_bmi_ID[183,2] Iterations - - + + @@ -159,7 +163,7 @@ - + @@ -172,14 +176,16 @@ 100 140 180 - - - - - --0.04 -0.00 -0.02 + + + + + + + +-0.08 +-0.04 +0.00 @@ -188,12 +194,12 @@ -b_bmi_ID[8,2] +b_bmi_ID[55,2] Iterations - - + + @@ -201,7 +207,7 @@ - + @@ -214,13 +220,15 @@ 100 140 180 - - - - - --0.04 -0.00 + + + + + + +-0.06 +-0.02 +0.02 @@ -229,12 +237,12 @@ -b_bmi_ID[62,2] +b_bmi_ID[26,2] Iterations - - + + @@ -242,7 +250,7 @@ - + @@ -255,16 +263,15 @@ 100 140 180 - - - - - - - --0.06 --0.02 -0.02 + + + + + + +-0.08 +-0.04 +0.00 @@ -273,12 +280,12 @@ -b_bmi_ID[177,2] +b_bmi_ID[71,2] Iterations - - + + @@ -286,7 +293,7 @@ - + @@ -299,13 +306,15 @@ 100 140 180 - - - - - --0.04 -0.00 + + + + + + +-0.04 +0.00 +0.04 @@ -314,12 +323,12 @@ -b_bmi_ID[190,2] +b_bmi_ID[145,2] Iterations - - + + @@ -327,7 +336,7 @@ - + @@ -340,16 +349,15 @@ 100 140 180 - - - - - - - --0.06 --0.02 -0.02 + + + + + + +-0.06 +-0.02 +0.02 @@ -358,12 +366,12 @@ -b_bmi_ID[81,2] +b_bmi_ID[165,2] Iterations - - + + diff --git a/vignettes/figures_SelectingParameters/unnamed-chunk-9-1.svg b/vignettes/figures_SelectingParameters/unnamed-chunk-9-1.svg index 9a038c04..386cdd7f 100644 --- a/vignettes/figures_SelectingParameters/unnamed-chunk-9-1.svg +++ b/vignettes/figures_SelectingParameters/unnamed-chunk-9-1.svg @@ -33,7 +33,7 @@ - + @@ -49,18 +49,18 @@ 160 180 200 - - - - - - - -50 -60 -70 -80 -90 + + + + + + + +60 +70 +80 +90 +110 @@ -73,8 +73,8 @@ Iterations - - + + @@ -82,7 +82,7 @@ - + @@ -98,15 +98,15 @@ 160 180 200 - - - - - --5 -0 -5 -10 + + + + + +-5 +0 +5 +10 @@ -119,8 +119,8 @@ Iterations - - + + @@ -128,7 +128,7 @@ - + @@ -144,17 +144,17 @@ 160 180 200 - - - - - - -0.1 -0.2 -0.3 -0.4 -0.5 + + + + + + +0.1 +0.2 +0.3 +0.4 +0.5 @@ -167,8 +167,8 @@ Iterations - - + + @@ -176,7 +176,7 @@ - + @@ -192,21 +192,22 @@ 160 180 200 - - - - - - - - - -0 -2 -4 -6 -8 -12 + + + + + + + + + +-2 +0 +2 +4 +6 +8 +12 @@ -219,8 +220,8 @@ Iterations - - + + @@ -228,7 +229,7 @@ - + @@ -244,17 +245,15 @@ 160 180 200 - - - - - - --10 -0 -10 -20 -30 + + + + + +-10 +0 +10 +20 @@ -267,8 +266,8 @@ Iterations - - + + @@ -276,7 +275,7 @@ - + @@ -292,19 +291,15 @@ 160 180 200 - - - - - - - -12 -13 -14 -15 -16 -17 + + + + + +13 +14 +15 +16 @@ -317,8 +312,8 @@ Iterations - - + + diff --git a/vignettes/figures_SelectingParameters/unnamed-chunk-9-2.svg b/vignettes/figures_SelectingParameters/unnamed-chunk-9-2.svg index 97a0ee0e..c0b7b86c 100644 --- a/vignettes/figures_SelectingParameters/unnamed-chunk-9-2.svg +++ b/vignettes/figures_SelectingParameters/unnamed-chunk-9-2.svg @@ -35,26 +35,26 @@ - - - - - -40 -60 -80 -100 - - - - - - -0.00 -0.01 -0.02 -0.03 -0.04 + + + + + + +40 +60 +80 +100 +120 + + + + + + +0.00 +0.02 +0.04 @@ -67,9 +67,9 @@ density - - - + + + @@ -79,26 +79,26 @@ - - - - - - --10 --5 -0 -5 -10 - + + + + + + +-10 +-5 +0 +5 +10 + - - - + + + 0.00 -0.05 -0.10 -0.15 +0.05 +0.10 +0.15 @@ -111,9 +111,9 @@ density - - - + + + @@ -123,30 +123,34 @@ - - - - - - -0.1 -0.2 -0.3 -0.4 -0.5 - + + + + + + + + +0.0 +0.1 +0.2 +0.3 +0.4 +0.5 +0.6 + - - - - - + + + + + 0 -1 -2 -3 -4 -5 +1 +2 +3 +4 +5 @@ -159,9 +163,9 @@ density - - - + + + @@ -171,26 +175,26 @@ - - - - - -0 -5 -10 -15 - + + + + + + +-5 +0 +5 +10 +15 + - - - - + + + 0.00 -0.05 -0.10 -0.15 -0.20 +0.05 +0.10 +0.15 @@ -203,9 +207,9 @@ density - - - + + + @@ -215,33 +219,29 @@ - - - - - - - - --20 --10 -0 -10 -20 -30 -40 - - - - - - - - -0.00 -0.02 -0.04 -0.06 + + + + + + + +-20 +-10 +0 +10 +20 +30 + + + + + + + +0.00 +0.02 +0.04 @@ -254,9 +254,9 @@ density - - - + + + @@ -266,31 +266,29 @@ - - - - - - - -12 -13 -14 -15 -16 -17 - - - - - - - - -0.0 -0.2 -0.4 -0.6 + + + + + + + +12 +13 +14 +15 +16 +17 + + + + + + + +0.0 +0.2 +0.4 @@ -303,9 +301,9 @@ density - - - + + + From 754d47e67bb420cea1184413c8199bfe7ce0c569 Mon Sep 17 00:00:00 2001 From: Nicole Erler Date: Sun, 22 Feb 2026 15:43:11 +0100 Subject: [PATCH 4/4] fix math, typo and figure captions in vignette --- vignettes/ModelSpecification.Rmd | 10 ++++++---- vignettes/ModelSpecification.Rmd.orig | 8 ++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/vignettes/ModelSpecification.Rmd b/vignettes/ModelSpecification.Rmd index 438b543a..f93902c0 100644 --- a/vignettes/ModelSpecification.Rmd +++ b/vignettes/ModelSpecification.Rmd @@ -1,6 +1,6 @@ --- title: "Model Specification" -date: January 03, 2026 +date: February 22, 2026 output: rmarkdown::html_vignette: toc: true @@ -685,14 +685,16 @@ distributions they are ordered so that longitudinal (level-1) variables may have baseline (level-2) variables in their linear predictors but not vice versa. For example: -$$\begin{align} + +\begin{align} p(y, x, b, \theta) = & p(y \mid x_1, ..., x_4, b_y, \theta_y) && \text{analysis model}\\ & p(x_1\mid \theta_{x1}) && \text{model for a complete baseline covariate}\\ & p(x_2\mid x_1, \theta_{x2}) && \text{model for an incomplete baseline covariate}\\ & p(x_3\mid x_1, x_2, b_{x3}, \theta_{x3}) && \text{model for a complete longitudinal covariate}\\ & p(x_4\mid x_1, x_2, x_3, b_{x4}, \theta_{x4}) && \text{model for an incomplete longitudinal covariate}\\ & p(b_y|\theta_b) p(b_{x3}|\theta_b) p(b_{x4}|\theta_b) && \text{models for the random effects}\\ -& p(\theta_y) p(\theta_{x1}) \ldots p(\theta_{x4}) p(\theta_b) && \text{prior distributions}\end{align}$$ +& p(\theta_y) p(\theta_{x1}) \ldots p(\theta_{x4}) p(\theta_b) && \text{prior distributions} +\end{align} Since the parameter vectors $\theta_{x1}$, $\theta_{x2}$, ... are assumed to be a priori independent, and furthermore $x_1$ is completely observed and modelled @@ -1125,7 +1127,7 @@ refs_mod10 <- set_refcat(NHANES, formula = formula(mod10b)) #> How do you want to specify the reference categories? #> #> 1: Use the first category for each variable. -#> 2: Use the last category for each variable. +#> 2: Use the last category for each variabe. #> 3: Use the largest category for each variable. #> 4: Specify the reference categories individually. ``` diff --git a/vignettes/ModelSpecification.Rmd.orig b/vignettes/ModelSpecification.Rmd.orig index 8b40382c..47bb46ef 100644 --- a/vignettes/ModelSpecification.Rmd.orig +++ b/vignettes/ModelSpecification.Rmd.orig @@ -17,6 +17,8 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 7, + fig.cap = "", + fig.scap = "", fig.align = 'center' ) library(JointAI) @@ -536,14 +538,16 @@ distributions they are ordered so that longitudinal (level-1) variables may have baseline (level-2) variables in their linear predictors but not vice versa. For example: -$$\begin{align} + +\begin{align} p(y, x, b, \theta) = & p(y \mid x_1, ..., x_4, b_y, \theta_y) && \text{analysis model}\\ & p(x_1\mid \theta_{x1}) && \text{model for a complete baseline covariate}\\ & p(x_2\mid x_1, \theta_{x2}) && \text{model for an incomplete baseline covariate}\\ & p(x_3\mid x_1, x_2, b_{x3}, \theta_{x3}) && \text{model for a complete longitudinal covariate}\\ & p(x_4\mid x_1, x_2, x_3, b_{x4}, \theta_{x4}) && \text{model for an incomplete longitudinal covariate}\\ & p(b_y|\theta_b) p(b_{x3}|\theta_b) p(b_{x4}|\theta_b) && \text{models for the random effects}\\ -& p(\theta_y) p(\theta_{x1}) \ldots p(\theta_{x4}) p(\theta_b) && \text{prior distributions}\end{align}$$ +& p(\theta_y) p(\theta_{x1}) \ldots p(\theta_{x4}) p(\theta_b) && \text{prior distributions} +\end{align} Since the parameter vectors $\theta_{x1}$, $\theta_{x2}$, ... are assumed to be a priori independent, and furthermore $x_1$ is completely observed and modelled