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
# Replicating and reanalyzing https://www.thelancet.com/journals/lanres/article/PIIS2213-2600(21)00356-8/fulltext#tbl1 | |
# Figure S3 | |
library(tidyverse) | |
library(brms) | |
library(metafor) | |
library(tidybayes) | |
library(broom) | |
### 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
# Load/Install packages | |
if (!require("pacman")) install.packages("pacman") | |
pacman::p_load(tidyverse, # data wrangling + plotting | |
metafor, # to calculate effect sizes | |
brms, # to fit Bayesian model | |
tidybayes) # data wrangling + plotting | |
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
renv::use("tidyverse", | |
"here", | |
"rio", | |
"survHE") | |
# Load data | |
pacemaker_original = rio::import(here::here("data", | |
"pacemaker_km.csv")) | |
head(pacemaker_original) |
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(MASS, | |
brms, | |
magrittr, | |
ggplot2, | |
emmeans, | |
tidybayes) | |
data <- MASS::birthwt | |
b1 <- brms::brm(data = 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
# Install/Load packages | |
pacman::p_load(MASS, | |
brms, | |
magrittr, | |
ggplot2, | |
emmeans, | |
tidybayes) | |
# Load data | |
data <- MASS::birthwt |
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
# Ensures the package "pacman" is installed | |
if (!require("pacman")) install.packages("pacman") | |
pacman::p_load(Hmisc, tidyverse, brms, tidybayes) | |
# Load data | |
load(url('http://hbiostat.org/data/gusto.rda')) | |
# Data preparation | |
gusto <- |
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(tidyverse) | |
library(ggdist) | |
data.frame(draws = rnorm(10e4, 0, 0.2)) |> | |
ggplot(aes(draws, | |
fill = stat(x < 10e5), | |
slab_alpha = stat(desc(x))) | |
) + | |
stat_halfeye(fill_type = "gradient", | |
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(metafor, | |
brms, | |
tidyr, | |
dplyr) | |
pacman::p_load_gh("stan/cmdstanr") | |
# Load dataset with two correlated outcomes | |
dat = metafor::dat.berkey1998 |
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(brms, | |
tidybayes, | |
tidyverse, | |
MetBrewer) | |
pacman::p_load_gh("stan/cmdstanr", | |
"wviechtb/metafor", # for {metadat} and vcor() | |
"jamesotto852/ggdensity") |
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(brms, | |
tidybayes, | |
tidyverse, | |
MetBrewer, | |
mvtnorm) | |
pacman::p_load_gh("stan/cmdstanr", | |
"wviechtb/metafor", # for {metadat} and vcor() | |
"jamesotto852/ggdensity") |
OlderNewer