1. Ross Attentional Bias (AB) Data

-Note: Large chunks of code have been hidden to improve readibility. ## 1. Load Packages Used in Data Analysis -Code hidden

2. Data Read-In

-Code hidden

3. Data Pre-processing

Probe accuracy, incorrect trials, improbable reaction times

-The code below when run illustrates that there are no administrations #With <50% accuracy. Nothing excluded here. No cues at administrations with < 50% accuracy for any timepoint

df %>% 
  group_by(Subject, ExperimentName, Cue) %>% 
  summarise(Percent_Accurate = mean(Accuracy)) %>% 
  filter(Percent_Accurate < 0.50) 
## `summarise()` has grouped output by 'Subject', 'ExperimentName'. You can
## override using the `.groups` argument.

-The code below indicates the overall # of trials and the counts/percents for 1) incorrect trials to be excluded, and 2) improbable reaction time trials (i.e., <200ms OR >1500ms) to be excluded. The code immediately following then excludes this data.

df %>% 
  group_by(ExperimentName) %>% 
  summarise(Overall_Trials = n(), #Overall trial counts
            Count_Inc_Trial = sum(ifelse(Accuracy == 0,1,0)), #Incorrect trial count
            Per_Inc_Trial = 1 - mean(Accuracy), #Percent of trials that are incorrect
            Count_Inc_RT = sum(ifelse(RT < 200 | RT > 1500, 1, 0)), 
            #Count of trials whose reaction times are < 200 or > 1500
            Per_Inc_RT = 1 - mean(ifelse(RT < 200 | RT > 1500, 0, 1)))

-Filtering out improbable reaction times

df <- df %>% 
  filter(Accuracy == 1) %>%  #Exclude incorrect trials
  filter(RT > 200 & RT < 1500) #Exclude RT's <200ms or >1500ms

-Maximum RT after exclusions

max(df$RT)
## [1] 1495

-Minimum RT after exclusions

min(df$RT)
## [1] 273

-Code for Median Absolute Deviation and SD calculations for Reaction Times hidden

-MAD & SD Calculation Results

df %>% 
  group_by(ExperimentName) %>% 
  summarise(Ovr_Trl_Aftr_Exc = n(), #Overall trial counts after excluding for above-noted criteria
            Count_MAD3_Over = sum(ifelse(RT > MAD_Exclude_Score, 1,0)), #Count of trials that had RT > 3MAD above individual median
            Per_MAD3_Over = mean(ifelse(RT > MAD_Exclude_Score, 1, 0)),
            Count_SD3_Over = sum(ifelse(RT > SD_Exclude_Score, 1,0)), #Count of trials that had RT > 3MAD above individual median
            Per_SD3_Over = mean(ifelse(RT > SD_Exclude_Score, 1, 0)))

-Excluding Folks based on SD for Reaction Times

df <- df %>% 
  filter(RT < SD_Exclude_Score) #Exclude folks whose RT are >3SD above their individual means

4. Attentional Bias (AB) Calculations

-Code for AB calculations hidden

-Illustration of AB output

Grouped_Output

5. Mixed ANOVA’s (DV = RT, WIV = Pre/Post cue, BIV = Condition)

-Reading in data for ANOVA’s (code hidden)

## Rows: 28 Columns: 28
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (28): ptid, Condition, SEX, MOUD, drug_BS, drug_mean_towrd, drug_mean_aw...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

5a. Drug Mean Bias

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df     MSE      F  ges p.value
## 1            Condition 1, 26  918.40   1.38 .024    .251
## 2           Time_Point 1, 26 1040.86 3.44 + .066    .075
## 3 Condition:Time_Point 1, 26 1040.86   0.46 .009    .504
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5b. Drug Mean Toward ANOVA

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df     MSE       F  ges p.value
## 1            Condition 1, 26 4123.24 8.56 ** .191    .007
## 2           Time_Point 1, 26 1609.41    0.09 .001    .762
## 3 Condition:Time_Point 1, 26 1609.41    1.18 .013    .286
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5c. Drug Mean Away ANOVA

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df     MSE      F  ges p.value
## 1            Condition 1, 26 5178.90 4.99 * .143    .034
## 2           Time_Point 1, 26  773.49   0.26 .001    .614
## 3 Condition:Time_Point 1, 26  773.49   2.28 .011    .143
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5d. Drug Peak Toward ANOVA

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df      MSE      F   ges p.value
## 1            Condition 1, 26 35044.60 5.16 *  .144    .032
## 2           Time_Point 1, 26  6478.72   0.94  .006    .341
## 3 Condition:Time_Point 1, 26  6478.72   0.07 <.001    .793
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5e. Drug Peak Away ANOVA

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df      MSE      F   ges p.value
## 1            Condition 1, 26 57895.85 5.97 *  .169    .022
## 2           Time_Point 1, 26  7305.64   0.36  .002    .553
## 3 Condition:Time_Point 1, 26  7305.64   0.00 <.001    .953
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5f. Drug Variability

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df     MSE      F  ges p.value
## 1            Condition 1, 26 2823.56 7.62 * .199    .010
## 2           Time_Point 1, 26  510.11   0.66 .004    .425
## 3 Condition:Time_Point 1, 26  510.11 3.06 + .018    .092
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5g. Pain Bias

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df     MSE    F   ges p.value
## 1            Condition 1, 26  593.35 0.34  .005    .564
## 2           Time_Point 1, 26 1009.01 0.01 <.001    .906
## 3 Condition:Time_Point 1, 26 1009.01 0.20  .005    .659
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5h. Pain Mean Toward

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df     MSE      F  ges p.value
## 1            Condition 1, 26 5364.99 5.76 * .147    .024
## 2           Time_Point 1, 26 1535.92   0.74 .006    .398
## 3 Condition:Time_Point 1, 26 1535.92 6.42 * .052    .018
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5i. Pain Mean Away

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df     MSE      F  ges p.value
## 1            Condition 1, 26 4457.38 6.11 * .148    .020
## 2           Time_Point 1, 26 1576.59   0.13 .001    .724
## 3 Condition:Time_Point 1, 26 1576.59 3.33 + .032    .079
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5j. Peak Pain Toward

Pain_P_twrd_AOV <- ANOVA_df_long %>% filter(Time_Point %in% c("pain_peak_toward", "post_pain_peak_toward"))
afex::aov_car(formula = RT_Values ~ Time_Point*Condition + Error(ptid/(Time_Point)), data = Pain_P_twrd_AOV, type = 3)
## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df      MSE      F  ges p.value
## 1            Condition 1, 26 50428.84 5.32 * .150    .029
## 2           Time_Point 1, 26  8219.99   0.26 .001    .618
## 3 Condition:Time_Point 1, 26  8219.99   1.41 .008    .245
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
Pain_P_twrd_AOV %>% select(Condition, Time_Point, RT_Values) %>% group_by(Condition, Time_Point) %>% summarise(M = mean(RT_Values), Med = median(RT_Values), SD = sd(RT_Values))
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5k. Peak Pain Away

Pain_P_Away_AOV <- ANOVA_df_long %>% filter(Time_Point %in% c("pain_mean_away", "post_pain_mean_away"))
afex::aov_car(formula = RT_Values ~ Time_Point*Condition + Error(ptid/(Time_Point)), data = Pain_P_Away_AOV, type = 3)
## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df     MSE      F  ges p.value
## 1            Condition 1, 26 4457.38 6.11 * .148    .020
## 2           Time_Point 1, 26 1576.59   0.13 .001    .724
## 3 Condition:Time_Point 1, 26 1576.59 3.33 + .032    .079
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
Pain_P_Away_AOV %>% select(Condition, Time_Point, RT_Values) %>% group_by(Condition, Time_Point) %>% summarise(M = mean(RT_Values), Med = median(RT_Values), SD = sd(RT_Values))
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.

5l. Pain Variability

## Contrasts set to contr.sum for the following variables: Condition
## Anova Table (Type 3 tests)
## 
## Response: RT_Values
##                 Effect    df     MSE      F  ges p.value
## 1            Condition 1, 26 3911.63 6.03 * .154    .021
## 2           Time_Point 1, 26 1085.28   0.77 .006    .388
## 3 Condition:Time_Point 1, 26 1085.28 5.24 * .042    .030
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## `summarise()` has grouped output by 'Condition'. You can override using the
## `.groups` argument.