brain

references:
- ISI, exploration 9.1, p.481

library(tidyverse)
library(knitr)

data

brain <- read.csv("Brain.csv", header = TRUE)
brain$Treatment <- factor(brain$Treatment, 
                          levels = c("None", "Social", "Walking", "TaiChi"))
str(brain)
## 'data.frame':    107 obs. of  2 variables:
##  $ Treatment  : Factor w/ 4 levels "None","Social",..: 4 4 4 4 4 4 4 4 4 4 ...
##  $ BrainChange: num  0.987 1.96 0.304 0.005 -1.829 ...
tbl <- brain %>%
  group_by(Treatment) %>%
  summarize(q1 = quantile(BrainChange, 0.25),
            M = median(BrainChange),
            q3 = quantile(BrainChange, 0.75),
            mean = mean(BrainChange),
            s = sd(BrainChange),
            n = n())
kable(tbl)
Treatment q1 M q3 mean s n
None -1.16875 -0.585 0.9725 -0.2401250 1.2584309 24
Social 0.00750 0.596 0.8060 0.4056296 0.6968969 27
Walking -1.05850 -0.026 0.9710 -0.1503333 1.3868388 27
TaiChi 0.00500 0.449 0.9870 0.4710690 0.8557466 29

Barplot.

ggplot(tbl, aes(x = Treatment, y = mean, fill = Treatment)) +
  geom_bar(stat = "identity") +
  scale_fill_manual(values = c("azure", "bisque", "skyblue", "orchid")) +
  labs(title = "Brain Volume Percent Change")