This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Thanks to metafor-project.org | |
### https://www.metafor-project.org/doku.php/plots:forest_plot_revman | |
### You will want to use png or pdf or tif to save this res 350, width=3196, height=1648 | |
### Import Dataset | |
pacman::p_load(readxl, | |
metafor, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(ggdist) | |
library(MetBrewer) | |
library(dplyr) | |
pal = met.brewer(name="VanGogh1", n=7, type="discrete") | |
set.seed(123) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load(dplyr, | |
brms, | |
patchwork, | |
ggplot2) | |
# Install rmsb v0.2 to use cmdstan | |
pacman::p_load_gh("harrelfe/rmsb") | |
# Data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load(rmsb, | |
dplyr, | |
magrittr, | |
ggdist, | |
tidyr, | |
brms) | |
# Data | |
a <- c(rep(0,0), rep(1,3), rep(2,5), rep(3,5), rep(4,25), rep(5,40), rep(6,24)) | |
b <- c(rep(0,2), rep(1,3), rep(2,9), rep(3,17), rep(4,33), rep(5,18), rep(6,18)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load(survival, brms, simsurv, splines2) | |
n <- 100 | |
h = c(rep("A", n/4), | |
rep("B", n/4), | |
rep("C", n/4), | |
rep("D", n/4)) | |
covs <- data.frame(id = 1:n, race_final = stats::rbinom(n, 1L, 0.5), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load(extraDistr, dplyr, purrr, tidyr, ggplot2, forcats, ggdist, patchwork) | |
set.seed(123) | |
N = 100 | |
mean_ARR = rhnorm(N, sigma = 0.02) | |
d = | |
tibble(mu = mean_ARR) |> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load(rms, marginaleffects, brms, dplyr, tidybayes) | |
load(url( | |
"https://github.com/vincentarelbundock/modelarchive/raw/main/data-raw/gusto.rda" | |
)) | |
gusto <- subset(gusto, tx %in% c("tPA", "SK")) | |
gusto$tx <- factor(gusto$tx, levels = c("tPA", "SK")) | |
dd = sample_frac(gusto, size = 0.1, weight = tx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install/load packages ----- | |
pacman::p_load(ggdist, | |
dplyr, | |
tidyr, | |
rmsb, | |
stringr, | |
gt, | |
flextable) | |
## Data ---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load(brms, | |
tidybayes, | |
ggplot2, | |
dplyr, | |
tidyr, | |
gt, | |
stringr) | |
#define function to calculate mode | |
# https://www.statology.org/mode-in-r/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rms) | |
#define function to calculate mode | |
# https://www.statology.org/mode-in-r/ | |
find_mode <- function(x) { | |
u <- unique(x) | |
tab <- tabulate(match(x, u)) | |
u[tab == max(tab)] | |
} |
NewerOlder