Skip to content

Commit

Permalink
update vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
InkaSpy committed Jan 6, 2025
1 parent 4d4ba97 commit ed45831
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 70 deletions.
2 changes: 1 addition & 1 deletion vignettes/Power_analysis_REACTIV.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ resultList

### Analysis

```{r eval=TRUE, output=FALSE}
```{r eval=TRUE, echo=TRUE, results='hide', message=FALSE}
devtools::install_github("thomasp85/patchwork")
#devtools::install_github("basf/xeredar")
purrr::map(c("dplyr","tidyr", "purrr", "furrr", "gt","easystats","rlang","drc", "DHARMa", "devtools", "patchwork", "ggplot2"), require, character.only = TRUE)
Expand Down
18 changes: 6 additions & 12 deletions vignettes/Running_RADAR_analysis.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Analysis of all RADAR validation studies"
output: rmarkdown::html_vignette
author: "Inka Marie Spyridonov"
date: "2024-12-17"
vignette: >
%\VignetteIndexEntry{Analysis of RADAR validation studies}
%\VignetteEngine{knitr::rmarkdown}
Expand Down Expand Up @@ -35,9 +36,7 @@ The following sections contain the code that needs to be executed to reproduce t


### Functions
```{r}
```{r eval=TRUE, echo=TRUE, results='hide', message=FALSE}
decreasing_alpha <- function(df, vector){
for(i in vector){
result <- xeredar::data_prep(df, row=FALSE, alpha = i, trim=FALSE, outlier = FALSE)
Expand Down Expand Up @@ -111,14 +110,12 @@ significances <- function(df, Williams= FALSE){
}
}
```

### Checking all RADAR validation studies for ED activity


```{r eval=TRUE, output=FALSE}
```{r eval=TRUE, echo=TRUE, results='hide', message=FALSE}
devtools::install_github("thomasp85/patchwork")
#devtools::install_github("basf/xeredar")
purrr::map(c("tidyverse","tidyr", "purrr", "furrr", "gt","easystats","rlang","drc", "DHARMa", "devtools", "patchwork"), require, character.only = TRUE)
Expand All @@ -127,14 +124,11 @@ library(patchwork)



```{r eval = TRUE, output = FALSE}
```{r eval=TRUE, echo=TRUE, results='hide', message=FALSE, warning=FALSE, fig.show='hide'}
anovas <- purrr::imap(xeredar::RADAR_valid_data_table_spiked_unspiked, ~ check(.x, .y)) |> purrr::flatten()
resultList <-
anovas_unspiked <- anovas[stringr::str_detect(names(anovas), "Unspiked")]
anovas_spiked<- anovas[!stringr::str_detect(names(anovas), "Unspiked")]
Expand Down Expand Up @@ -203,7 +197,7 @@ Result_Radar_valid <- dplyr::full_join(significances_Spiked, significances_Unspi
```


```{r eval=TRUE}
```{r eval=TRUE, echo=TRUE, message=FALSE}
gt::gt(Result_Radar_valid) |>
gt::tab_style(
style = list(
Expand Down
5 changes: 0 additions & 5 deletions vignettes/Software_validation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ gt::gt(thyroid_active, rowname_col = "substance") |>
```


##







Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ resultList

### Analysis

```{r eval=TRUE}
```{r eval=TRUE, echo=TRUE, results='hide', message=FALSE, warning=FALSE, fig.show='hide'}
#devtools::install_git("https://gitlab.roqs.basf.net/WillmsIM/xetaana.git")
#install.packages("easystats")
lapply(c("tidyverse","xeredar","tidyr", "purrr", "furrr", "gt","easystats","rlang","drc", "DHARMa", "devtools"), require, character.only = TRUE)
lapply(c("tidyverse","xeredar","tidyr", "purrr", "furrr", "gt","easystats","rlang","drc", "DHARMa", "devtools", "ggplot2"), require, character.only = TRUE)
```

Expand Down Expand Up @@ -106,12 +106,12 @@ gt::gt(xeredar::SimulationInfoWTzeroInflated) |> gt::tab_caption(caption = "Summ
```{r eval=TRUE}
xeredar::SimulationInfoWTzeroInflated |>
dplyr::select(adj_ICC, Country, Spiked) |>
dplyr::mutate(Spiked = if_else(Spiked == TRUE, "Spiked", "Unspiked")) |>
ggplot(aes(y= as.numeric(adj_ICC), x= Country, color = Spiked))+
geom_jitter(alpha= 0.5, width = 0.2)+
geom_abline(slope=0, intercept= 0.1337804)+
labs(color='Spiked or Unspiked?')+
ylab(label="adjusted ICC value")+
dplyr::mutate(Spiked = dplyr::if_else(Spiked == TRUE, "Spiked", "Unspiked")) |>
ggplot2::ggplot(aes(y= as.numeric(adj_ICC), x= Country, color = Spiked)) +
geom_jitter(alpha= 0.5, width = 0.2) +
geom_abline(slope=0, intercept= 0.1337804) +
labs(color='Spiked or Unspiked?') +
ylab(label="adjusted ICC value") +
xlab(label="")
```

Expand Down Expand Up @@ -451,45 +451,5 @@ resultsUnspiked_power_reactive <- dplyr::bind_rows(resultsUnspiked_power_reacti
resultsUnspiked_power_reactive <- dplyr::left_join(resultsUnspiked_power_reactive, perc_effect_e_dose_Unspiked)
usethis::use_data(resultsUnspiked_power_reactive, overwrite = TRUE)
```

```{r eval=TRUE}
breaks=c("mixedDunnett","PooledDunnetts","pooledDunns" ,"mixedWilliamsIncrease")
labels=c("mixed Dunnett", "Pooled Dunnetts","Pooled Dunns","mixed Williams")
type1_error_Spiked <- xeredar::resultsSpiked_power_reactive |> dplyr::arrange(e, percEffect) |> filter(percEffect <= 1) |>
ggplot2::ggplot(aes(x=PercentSign, color=Test))+
geom_boxplot( alpha= 0.5)+
scale_x_continuous(labels = scales::percent, trans = "log10")+
xlab("% significant tests")
power_Spiked <- xeredar::resultsSpiked_power_reactive |> dplyr::arrange(e, percEffect) |> dplyr::filter(Conc==100) |>
ggplot2::ggplot(ggplot2::aes(x=percEffect, y=PercentSign, color=Test))+
ggplot2::geom_line(linewidth=1.2)+
ggplot2::geom_hline(x=as.numeric(0:300), yintercept=0.8)+
ggplot2::scale_color_discrete(name ="Tests",
breaks = breaks,
labels = labels)+
ggplot2::ylab("% significant")+
ggplot2::xlab("% effect")
power_Unspiked <- xeredar::resultsUnspiked_power_reactive |> dplyr::arrange(e, percEffect) |> dplyr::filter(Conc==100) |>
ggplot2::ggplot(ggplot2::aes(x=percEffect, y=PercentSign, color=Test))+
ggplot2::geom_line(linewidth=1.2)+
ggplot2::geom_hline(x=as.numeric(0:300), yintercept=0.8)+
ggplot2::scale_color_discrete(name ="Tests",
breaks = breaks,
labels = labels)+
ggplot2::ylab("% significant")+
ggplot2::xlab("% effect")
type1_error_Spiked <- xeredar::resultsSpiked_power_reactive |> dplyr::arrange(e, percEffect) |> filter(percEffect <= 1) |>
ggplot2::ggplot(aes(x=PercentSign, color=Test))+
geom_boxplot( alpha= 0.5)+
scale_x_continuous(labels = scales::percent, trans = "log10")+
xlab("% significant tests")
power_Spiked + power_Unspiked
```
8 changes: 4 additions & 4 deletions vignettes/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was generated by the {rix} R package v0.12.4 on 2024-12-19
# This file was generated by the {rix} R package v0.12.4 on 2025-01-06
# with following call:
# >rix::rix(r_ver = "4989a246d7a390a859852baddb1013f825435cee",
# >rix::rix(r_ver = "bf689c40d035239a489de5997a4da5352434632e",
# > r_pkgs = c("tidyverse",
# > "tidyr",
# > "purrr",
Expand All @@ -20,11 +20,11 @@
# > ide = "rstudio",
# > project_path = "./vignettes",
# > overwrite = TRUE)
# It uses nixpkgs' revision 4989a246d7a390a859852baddb1013f825435cee for reproducibility purposes
# It uses nixpkgs' revision bf689c40d035239a489de5997a4da5352434632e for reproducibility purposes
# which will install R version latest.
# Report any issues to https://github.com/ropensci/rix
let
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/4989a246d7a390a859852baddb1013f825435cee.tar.gz") {};
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/bf689c40d035239a489de5997a4da5352434632e.tar.gz") {};

rpkgs = builtins.attrValues {
inherit (pkgs.rPackages)
Expand Down

0 comments on commit ed45831

Please sign in to comment.