Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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