From af2abcfe7759b83fb69d16c3f2f6a00487b4c62c Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 30 Jun 2023 16:28:39 +0200 Subject: [PATCH] fix --- vignettes/probability_of_direction.Rmd | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/vignettes/probability_of_direction.Rmd b/vignettes/probability_of_direction.Rmd index b9774d8ff..a5d72bffa 100644 --- a/vignettes/probability_of_direction.Rmd +++ b/vignettes/probability_of_direction.Rmd @@ -154,7 +154,7 @@ Let's compare the 4 available methods, the **direct** method and 3 Let's start by testing the proximity and similarity of the results obtained by different methods. -```{r message=FALSE, warning=FALSE, fig.align='center'} +```{r message=FALSE, warning=FALSE, fig.align='center', eval=FALSE} library(bayestestR) library(logspline) library(KernSmooth) @@ -181,6 +181,33 @@ data <- as.data.frame(sapply(data, as.numeric)) bayesplot::mcmc_pairs(data) + theme_classic() ``` +```{r echo=FALSE, message=FALSE, warning=FALSE, fig.align='center'} +library(bayestestR) +library(logspline) +library(KernSmooth) + +# Compute the correlations +data <- data.frame() +for (the_mean in runif(25, 0, 4)) { + for (the_sd in runif(25, 0.5, 4)) { + x <- rnorm(100, the_mean, abs(the_sd)) + data <- rbind( + data, + data.frame( + "direct" = pd(x), + "kernel" = pd(x, method = "kernel"), + "logspline" = pd(x, method = "logspline"), + "KernSmooth" = pd(x, method = "KernSmooth") + ) + ) + } +} +data <- as.data.frame(sapply(data, as.numeric)) + +# Visualize the correlations +suppressWarnings(bayesplot::mcmc_pairs(data)) + + theme_classic() +``` All methods give are highly correlated and give very similar results. That means that the method choice is not a drastic game changer and cannot be used to tweak