When evaluating stimuli, there are several brain regions that encode the value of that stimulus as well as the valence (how pleasant or unpleasant it is)

My reserach interests are around dynamics of affective or emotion experiences

For example, how do different individuals process a string of emotional images

In fMRI studies, pictures are drawn from database with normative valence and arousal ratings.

From the reinforcement learning world, we can consider the learning rate as one helpful metric to address this question.

Specifically, how quickly do people forget what emotional images they have already seen when predicting what they are about to see?

As a reminder:

In a nutshell I wanted to:

1. find the learning rate that best fit an individual’s neural data from value-encoding regions during a picture viewing task…

As an initial venture into this idea:

* Collected fMRI data from 20 people viewing images

* 20 negative images and 20 neutral images in random order

+ from a standardized dataset with normative ratings of valence and arousal
+ 4s presentation, 12 second GAM response function fit

* Extracted average activity in each valence-encoding region for each trial

RL models were fit in MATLAB:

* For each person, loop through possible learning rates

* For each LR fit a model where neural data is regressed on prediction error

* Save the fit indices for the model and chose the best LR per ROI per person

## Load Libraries
library(ggplot2) 
library(DT) 
library(broom)
library(car)
library(lsr)
library(Hmisc)
library(tidyverse)
library(dplyr)
library(psycho)
library(psych)

Load in the summary from the MATLAB RL models and the daily affect and symptom outcome data

rl <- read.csv("/Users/nikki/Desktop/Research/HealthyU_Scanning_Local/RL_inputdata/BestLR_Grp.csv")
ema <- read.csv("/Users/nikki/Desktop/Research/Masters_reanalysis/Data/demos_sxs_ema.csv")

#merge together & reduce
alldata <- merge(rl, ema, by.x = "id", by.y = "ID", all.x = T)
main <- alldata[c(1:4,36,44,71,72,74,75,73,76:78,64,65,66,67,68,69,70,61,62,5:16,18,20)]

datatable(main)

Visualize the optimal learning rates (LR) across subjects

la_hist <- ggplot(data=main, aes(x=LR_lamyg)) +
  geom_histogram(bins = 8, fill = "turquoise4", alpha = .5) +
  geom_density() +
  xlab("Left amaygdala LR") +
  theme_minimal()

ra_hist <- ggplot(data=main, aes(x=LR_ramyg)) +
  geom_histogram(bins = 8, fill = "mediumpurple3", alpha = .5) +
  geom_density() +
  xlab("Right amaygdala LR") +
  theme_minimal()

ofc_hist <- ggplot(data=main, aes(x=LR_ofc)) +
  geom_histogram(bins = 8, fill = "palegreen3", alpha = .5) +
  geom_density() +
  xlab("Orbitalfrontal LR") +
  theme_minimal()

gridExtra::grid.arrange(la_hist,ra_hist,ofc_hist, nrow = 1)

res1 <- cor.test(main$LR_lamyg,main$LR_ramyg)
results1 <- res1 %>% # take the object results and then
  tidy() 
results1
ggplot(data=main, aes(x=LR_lamyg, y=LR_ramyg)) +
  geom_point(color = "darkslategray4", size = 2, alpha = .75) +
  labs(title = "Left and Right amygdala LR concordance") +
  xlab("Left amygdala LR") +
  ylab("Right amygdala LR") +
   theme_gray()

res2 <- cor.test(main$LR_lamyg,main$LR_ofc)
results2 <- res2 %>% 
  tidy() 
results2
ggplot(data=main, aes(x=LR_lamyg, y=LR_ofc)) +
  geom_point(color = "slateblue4", size = 2, alpha = .75) +
  labs(title = "Left amygdala and OFC LR concordance") +
  xlab("Left amygdala LR") +
  ylab("OFC LR") +
   theme_gray()

Visualize the “real-world” affective outcomes

dep <- ggplot(data=main, aes(x=PHQ9_tot_3)) +
  geom_histogram(bins = 10, fill = "gold3", alpha = .5) +
  xlab("Depression Sx (max 27)") +
  theme_minimal()

anx <- ggplot(data=main, aes(x=GAD7_3)) +
  geom_histogram(bins = 10, fill = "darkorange", alpha = .5) +
  xlab("Anxiety Sx (max 21)") +
  theme_minimal()

na <- ggplot(data=main, aes(x=NAmean)) +
  geom_histogram(bins = 12, fill = "orangered", alpha = .5) +
  xlab("Average Daily NA over two months (from 0-100)") +
  theme_minimal()

pa <- ggplot(data=main, aes(x=PAmean)) +
  geom_histogram(bins = 12, fill = "firebrick", alpha = .5) +
  xlab("Average Daily PA over two months (from 0-100)") +
  theme_minimal()

gridExtra::grid.arrange(dep,anx,na,pa, nrow = 2)

Do individual differences in the LRs relate to “real-world” affective outcomes?

cormat <- main[c(2:7,9)] 
cortable<- cormat %>% 
  correlation(adjust = "non")
summary(cortable)
left1 <- ggplot(data=main, aes(x=LR_lamyg)) +
  geom_point(aes(y=PHQ9_tot_3), color = "gold2", size = 3, shape = 4) +
  geom_point(aes(y=GAD7_3), color = "darkorange2", size = 3, shape = 4) +
 geom_smooth(aes(y=PHQ9_tot_3), color = "gold2", size = 1, alpha = .4, formula = y ~ x, method = lm, se=F) +
  geom_smooth(aes(y=GAD7_3), color = "darkorange2", size = 1, alpha = .4, formula = y ~ x, method = lm, se=F) +
   labs(title = "Left amy LR does not predict Depression or Anxiety") +
  xlab("Left amygdala LR") +
  ylab("Depression and Anxiety scores") +
   theme_gray() +
  theme(plot.title = element_text(size = 9),
         axis.title.x=element_text(size = 9),
           axis.title.y=element_text(size = 9),
           axis.text.y=element_text(size = 9),
           axis.text.x=element_text(size = 9))

left2 <- ggplot(data=main, aes(x=LR_lamyg)) +
  geom_point(aes(y=NAmean), color = "orangered2", size = 3, shape = 4) +
  geom_point(aes(y=PAmean), color = "firebrick4", size = 3, shape = 4) +
 geom_smooth(aes(y=NAmean), color = "orangered2", size = 1, alpha = .4, formula = y ~ x, method = lm, se=F) +
  geom_smooth(aes(y=PAmean), color = "firebrick4", size = 1, alpha = .4, formula = y ~ x, method = lm, se=F) +
   labs(title = "Left amyg LR does not predict daily mean NA or PA") +
  xlab("Left amygdala LR") +
  ylab("mean NA and PA") +
   theme_gray() +
  theme(plot.title = element_text(size = 9),
         axis.title.x=element_text(size = 9),
           axis.title.y=element_text(size = 9),
           axis.text.y=element_text(size = 9),
           axis.text.x=element_text(size = 9))


right1 <- ggplot(data=main, aes(x=LR_ramyg)) +
  geom_point(aes(y=PHQ9_tot_3), color = "gold2", size = 3, shape = 4) +
  geom_point(aes(y=GAD7_3), color = "darkorange2", size = 3, shape = 4) +
 geom_smooth(aes(y=PHQ9_tot_3), color = "gold2", size = 1, alpha = .4, formula = y ~ x, method = lm, se=F) +
  geom_smooth(aes(y=GAD7_3), color = "darkorange2", size = 1, alpha = .4, formula = y ~ x, method = lm, se=F) +
   labs(title = "Right amyg LR does not predict Depression or Anxiety") +
  xlab("Right amygdala LR") +
  ylab("Depression and Anxiety scores") +
   theme_gray()+
  theme(plot.title = element_text(size = 9),
         axis.title.x=element_text(size = 9),
           axis.title.y=element_text(size = 9),
           axis.text.y=element_text(size = 9),
           axis.text.x=element_text(size = 9))


right2 <- ggplot(data=main, aes(x=LR_ramyg)) +
  geom_point(aes(y=NAmean), color = "orangered2", size = 3, shape = 4) +
  geom_point(aes(y=PAmean), color = "firebrick4", size = 3, shape = 4) +
 geom_smooth(aes(y=NAmean), color = "orangered2", size = 1, alpha = .4, formula = y ~ x, method = lm, se=F) +
  geom_smooth(aes(y=PAmean), color = "firebrick4", size = 1, alpha = .4, formula = y ~ x, method = lm, se=F) +
   labs(title = "Right amyg LR does not predict daily mean NA or PA") +
  xlab("Right amygdala LR") +
  ylab("mean NA and PA") +
   theme_gray()+
 theme(plot.title = element_text(size = 9),
         axis.title.x=element_text(size = 9),
           axis.title.y=element_text(size = 9),
           axis.text.y=element_text(size = 9),
           axis.text.x=element_text(size = 9))


gridExtra::grid.arrange(left1,left2,right1,right2, nrow = 2)