---
title: "Statistics"
author: "Anonymous"
date: "`r Sys.Date()`"
output: html_document
---


```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
# install.packages("tidyverse")
library(tidyverse)
```


**Load dataset**
```{r label='load_dataset', message=FALSE}
data_score_diffs <- read_csv('./score_diffs.csv')
data_score_diffs %>% head()
```

```{r}
# install.packages("ggthemes") # Install 
library(ggthemes) # Load

data_score_diffs %>% 
  ggplot(aes(x=group, y=value)) +
    geom_bar(position='dodge', stat="identity", aes(fill=group)) +
    facet_grid(~factor(measure, levels=c("TTM", "STAI", "SCFQ", "AAQ-II"))) +
    # scale_fill_manual(values = c('gray', 'red'), guide=FALSE) +
    labs(fill="Group") +
    ylab("Score") +
    xlab("Group") +
    # theme_economist()
    theme_economist_white()
    # theme_stata() + scale_color_stata()
    # theme_wsj()+ scale_colour_wsj("colors6")
    # theme_hc()+ scale_colour_hc()
    # theme_igray() + scale_colour_tableau()
    # theme_calc()
    # theme_clean()

ggsave(file="./pre-post_changes.png", dpi=320, width=16, height=9)
```



```{r}
data_score_diffs_row <- read_csv('./score_diffs_row.csv')
data_score_diffs_row %>% 
  group_by(group, measure) %>% 
  summarise(mean = mean(diff_value), sd = sd(diff_value)) %>% 
  ggplot(aes(x=group, y=mean)) +
    geom_bar(position='dodge', stat="identity", aes(fill=group)) +
  geom_errorbar(aes(ymax = mean + sd, ymin = mean - sd), width = 0.2, size = 0.5) +
    # geom_boxplot() +
    facet_grid(~factor(measure, levels=c("TTM", "STAI", "SCFQ", "AAQ-II"))) +
    # scale_fill_manual(values = c('gray', 'red'), guide=FALSE) +
    labs(fill="Group") +
    ylab("Score") +
    xlab("Group") +
    # theme_economist()
    theme_economist_white()
    # theme_stata() + scale_color_stata()
    # theme_wsj()+ scale_colour_wsj("colors6")
    # theme_hc()+ scale_colour_hc()
    # theme_igray() + scale_colour_tableau()
    # theme_calc()
    # theme_clean()

```

