Skip to content

Instantly share code, notes, and snippets.

@aaroncharlton
Created March 23, 2022 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaroncharlton/b669e3c058a1a14d258509611350a635 to your computer and use it in GitHub Desktop.
Save aaroncharlton/b669e3c058a1a14d258509611350a635 to your computer and use it in GitHub Desktop.
Simulations of Sinha & Wang 2013
# recreate summary statistics - table 1
set.seed(123)
lonely_tib <- tibble(mean = rep(NA,1000),
sd = rep(NA, 1000))
for(i in 1:1000){
lonely <- rnorm(n = 153/3, mean = 0, sd = 1)
lonely_tib$mean[i] <- mean(lonely)
lonely_tib$sd[i] <- sd(lonely)
}
library(ggplot2)
ggplot(data=lonely_tib, aes(x=mean)) +
geom_histogram() +
geom_vline(xintercept = c(-.09,-.27,-.21,-1.31,-1.49,-1.41,.52,-.54,.51), colour = "red") +
labs(title = "Means", subtitle = "Study 1a")+
theme(axis.text=element_text(size=16),
axis.title=element_text(size=18,face="bold"),
plot.title = element_text(size=22),
plot.subtitle = element_text(size=17))
ggplot(data=lonely_tib, aes(x=sd)) +
geom_histogram() +
labs(title = "Standard deviations", subtitle = "Study 1a")+
geom_vline(xintercept = c(.56,.91,.64,.7,1.5,.8,1.4,1.5,1.5), colour = "red") +
theme(axis.text=element_text(size=16),
axis.title=element_text(size=18,face="bold"),
plot.title = element_text(size=22),
plot.subtitle = element_text(size=17))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment