library("papaja")
library("ggplot2")
library("tidyverse")
library("scales")
library("gridExtra")
library("here")
library("kableExtra")
library("ggraph")
library("grid")
library("corrplot")

# Seed for random number generation
set.seed(42)
knitr::opts_chunk$set(
  cache = TRUE,
  cache.comments = FALSE,
  collapse = TRUE,
  warning = FALSE,
  message = FALSE,
  error = FALSE,
  echo = FALSE,
  strip.white = TRUE,
  comment = "#>",
  fig.path = "../figures/",
  results = "asis",
  tidy = "styler",
  dev = c('pdf', 'tiff'),
  dev.args = list(pdf = list(colormodel = 'cmyk'), 
                  tiff = list(compression = 'lzw')),
  dpi = 600,
  fig.width = 7,
  fig.height = 7,
  concordance = TRUE,
  global.par = TRUE
)

par(font.main = 1, cex.main = 1.05)
theme_set(theme_apa(base_size = 15) + theme(legend.position = "bottom"))
fp <- here("analysis", "data", "derived_data", "mids_rf.rds")
mids_rf <- readr::read_rds(fp)

(ref:LOT) An example of the imputed data in the nucleus of the lateral olfactory tract. We were missing 4 observations in total, 2 in each group. The figure shows the original data in the first column on the left and then 10 sets of data augmented with the imputed observations in magenta.

g_lot <- stripplot(mids_rf, LOT...1.3. ~ .imp, pch = 20, cex = 2, 
          xlab = "", ylab = "",
          scales = list(x = list(labels = c(0, paste0("i", 1:10)), cex = 1.2), 
                        y = list(cex = 1.2)), 
          par.settings = list(axis.line = list(col = 0)),
          panel=function(...){
            lims <- current.panel.limits()
            panel.stripplot(...)
            panel.abline(h=lims$ylim[1],v=lims$xlim[1], col = "black", lwd = 2)
          })
g_lot
fp_heatmap_df <- here("analysis", "data", "derived_data", "heatmap_df.rds")
heatmap_df <- readr::read_rds(fp_heatmap_df)

(ref:heatmap) Heatmap of the significant changes in correlation coefficients expressed as a difference in normalised z-scores between control and ketamine-treatment groups. Red part of the colormap depicts cases where strong positive correlations in control rats were negative or non-significant in ketamine rats. Blue part of the colormap corresponds to the cases of increased positive association between brain regions in ketamine-treated rats. White color corresponds to the absence of significant differences in pairwise association between two conditions.

corrplot(heatmap_df, is.corr = FALSE, method = "color", tl.col = "black", tl.cex = 0.42,
         order = "alphabet", diag = FALSE,
         title = expression(paste("Heatmap of changes in pairwise correlations expressed as ", Delta,
         " z-scores at p < 0.05")), mar = c(1, 1, 3, 1), cex.main = 1.6)


kissmyjazz/ketamineCoxPaper documentation built on Nov. 4, 2019, 3:51 p.m.