<style type="text/css">
div.main-container {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
</style>

1. JP_Data

-Note: Large chunks of code have been hidden to improve readibility.

2. Data Read-In

-Code hidden

3. Data Pre-processing

Creating Trial Number Column

-Code Hidden

Probe accuracy, incorrect trials, improbable reaction times

-The code below when run illustrates that there are no administrations -Code Hidden #With <50% accuracy. Nothing excluded here.

-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.

-Filtering out improbable reaction times

-Maximum & Minimum RT after exclusions

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

-MAD & SD Calculation Results

-Excluding Folks based on SD for Reaction Times

3. Descriptive Statistics

-Code Hidden

4. Attentional Bias (AB) Calculations

-Code for AB calculations hidden

-Attentional Bias Metrics Per Subject, Condition, Session, & Cue -Code hidden

5. ANOVA’s

-Changing session variable to represent just pre-post -Code Hidden

-Something to note: There are several subjects who appear to have no data for at least Condition/1 time-point:

Folks Missing 1 pre/post data point: #Condition A: 15 #Condition B: 02 #Condition C: 14

Folks Missing both pre/post data points #Condition A: 03, 11, 13, 14, 18, 22, 28 #Condition B: 03, 13, 17 #Condition C: 17,18,23

-R drops these folks from ANOVA analysis below. Listwise deletion results in a small subsample, with between 12-15/28 getting dropped, depending on condition.

Adding grouping by condition variable

-Code Hidden

-Changing Data into Long Format -Code Hidden

6. Mixed-Effects ANOVAs examining Attentional Biases by Session*Condition

6a. Mean Bias

-DV: Opioid Mean Bias

df_long_opioid_mean_bias <- df_long %>% filter(Cue == "opioid" & Bias_Type == "mean_bias")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_opioid_mean_bias,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df     MSE    F  ges p.value
## 1           Session       1, 15 1730.29 0.70 .017    .417
## 2         Condition 1.87, 28.00  674.69 0.72 .013    .487
## 3 Session:Condition 1.71, 25.58  599.62 1.92 .027    .171
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

-DV: Pain Mean Bias

df_long_pain_mean_bias <- df_long %>% filter(Cue == "pain" & Bias_Type == "mean_bias")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_pain_mean_bias,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df     MSE    F  ges p.value
## 1           Session       1, 15  899.92 0.37 .005    .552
## 2         Condition 1.27, 19.02 1477.83 0.28 .009    .657
## 3 Session:Condition 1.80, 26.94  418.87 0.17 .002    .825
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

6b. Mean Away Bias

-DV: Opioid Mean Away Bias

df_long_opioid_mean_away <- df_long %>% filter(Cue == "opioid" & Bias_Type == "mean_away")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_opioid_mean_away,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df     MSE    F  ges p.value
## 1           Session       1, 15 1084.77 2.34 .010    .147
## 2         Condition 1.48, 22.25 1281.37 0.86 .007    .406
## 3 Session:Condition 1.98, 29.77  373.76 0.42 .001    .660
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

-DV: Pain Mean Away Bias

df_long_pain_mean_away <- df_long %>% filter(Cue == "pain" & Bias_Type == "mean_away")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_pain_mean_away,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df     MSE    F   ges p.value
## 1           Session       1, 15  697.86 1.10  .003    .310
## 2         Condition 1.66, 24.90 1342.32 0.07 <.001    .899
## 3 Session:Condition 1.51, 22.72  809.59 0.07 <.001    .881
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

6c. Mean Toward Bias

-DV: Opioid Mean Toward Bias

df_long_opioid_mean_toward <- df_long %>% filter(Cue == "opioid" & Bias_Type == "mean_toward")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_opioid_mean_toward,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df     MSE    F  ges p.value
## 1           Session       1, 15  331.77 1.33 .002    .266
## 2         Condition 1.83, 27.44 1097.91 0.65 .007    .515
## 3 Session:Condition 1.20, 18.06 1727.81 0.21 .002    .696
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

-DV: Pain Mean Toward Bias

df_long_pain_mean_toward <- df_long %>% filter(Cue == "pain" & Bias_Type == "mean_toward")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_pain_mean_toward,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df     MSE    F  ges p.value
## 1           Session       1, 15 1623.54 0.22 .002    .643
## 2         Condition 1.91, 28.68  845.07 1.05 .008    .359
## 3 Session:Condition 1.69, 25.36  433.06 0.60 .002    .527
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

6d. Peak Away Bias

-DV: Opioid Peak Away Bias

df_long_opioid_peak_away <- df_long %>% filter(Cue == "opioid" & Bias_Type == "peak_away")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_opioid_peak_away,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df      MSE    F   ges p.value
## 1           Session       1, 15  5111.51 1.17  .002    .296
## 2         Condition 1.64, 24.59 16820.23 0.80  .007    .438
## 3 Session:Condition 1.72, 25.80  7437.94 0.00 <.001    .993
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

-DV: Pain Peak Away Bias

df_long_pain_peak_away <- df_long %>% filter(Cue == "pain" & Bias_Type == "peak_away")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_pain_peak_away,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df      MSE    F  ges p.value
## 1           Session       1, 15 10744.89 1.46 .006    .246
## 2         Condition 1.98, 29.73  6103.29 0.37 .002    .693
## 3 Session:Condition 1.55, 23.30  9044.77 0.71 .004    .468
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

6e. Peak Toward Bias

-DV: Opioid Peak Toward Bias

df_long_opioid_peak_toward <- df_long %>% filter(Cue == "opioid" & Bias_Type == "peak_toward")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_opioid_peak_toward,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df      MSE      F   ges p.value
## 1           Session       1, 15  7247.98 3.83 +  .012    .069
## 2         Condition 1.62, 24.32 11543.84   0.13 <.001    .840
## 3 Session:Condition 1.20, 17.99 19441.12   0.25  .002    .668
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

-DV: Pain Peak Toward Bias

df_long_pain_peak_toward <- df_long %>% filter(Cue == "pain" & Bias_Type == "peak_toward")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_pain_peak_toward,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df      MSE    F   ges p.value
## 1           Session       1, 15 12315.63 0.04 <.001    .853
## 2         Condition 1.32, 19.84 14603.39 0.45  .004    .562
## 3 Session:Condition 1.35, 20.18  5994.07 0.31  .001    .649
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

6f. Variability Bias

-DV: Opioid Variability Bias

df_long_opioid_variability <- df_long %>% filter(Cue == "opioid" & Bias_Type == "variability")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_opioid_variability,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df    MSE    F  ges p.value
## 1           Session       1, 15 305.22 1.86 .004    .192
## 2         Condition 1.86, 27.85 623.94 0.82 .006    .441
## 3 Session:Condition 1.89, 28.32 283.68 0.62 .002    .534
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

-DV: Pain Variability Bias

df_long_pain_variability <- df_long %>% filter(Cue == "pain" & Bias_Type == "variability")

afex::aov_car(formula = RT ~ Session*Condition + Error(Subject/Session*Condition), data = df_long_pain_variability,
              type = 3, na.rm = T)
## Warning: Missing values for following ID(s):
## 56002, 56003, 56011, 56013, 56014, 56015, 56017, 56018, 56022, 56023, 56028
## Removing those cases from the analysis.
## Anova Table (Type 3 tests)
## 
## Response: RT
##              Effect          df    MSE    F   ges p.value
## 1           Session       1, 15 646.84 0.46  .002    .510
## 2         Condition 1.96, 29.36 390.98 0.80  .004    .457
## 3 Session:Condition 1.85, 27.72 370.63 0.04 <.001    .950
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
## 
## Sphericity correction method: GG

7. Muiltilevel Models examining Attentional Bias regressed on session*condition (fixed effects). Random intercepts per subject, random slopes across sessions (pre-post)

7a. Mean Bias

-DV: Opioid Mean Bias

re_O_MB <- lmer(RT ~ (1|Subject), data = df_long_opioid_mean_bias)
performance::icc(re_O_MB)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.088
##   Conditional ICC: 0.088
MLM_O_MB <- lmer(RT ~ Session*Condition + (1 + Session|Subject), data = df_long_opioid_mean_bias)
#The code below then obtains mltiple Degree-of-Freedom F-Tests for the above-specified model
anova(MLM_O_MB, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session            204.29  204.29     1 25.962  0.3180 0.5777
## Condition         1456.11  728.06     2 84.311  1.1332 0.3268
## Session:Condition 1513.27  756.63     2 83.174  1.1777 0.3131
#Model Parameters 
summary(MLM_O_MB)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_mean_bias
## 
## REML criterion at convergence: 1244.3
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.21980 -0.47485 -0.01903  0.39442  3.14079 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  Subject  (Intercept) 348.7    18.67         
##           SessionPost 613.7    24.77    -0.85
##  Residual             642.5    25.35         
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)
## (Intercept)             -3.3981     7.0389  74.7171  -0.483    0.631
## SessionPost              8.6312     9.6716  75.8654   0.892    0.375
## ConditionB               9.1184     8.0190  85.2335   1.137    0.259
## ConditionC              -5.5859     8.0191  85.2271  -0.697    0.488
## SessionPost:ConditionB -14.4242    11.1918  83.9354  -1.289    0.201
## SessionPost:ConditionC  -0.3397    11.2622  84.4068  -0.030    0.976
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.754                            
## ConditionB  -0.649  0.475                     
## ConditionC  -0.649  0.475  0.573              
## SssnPst:CnB  0.467 -0.650 -0.719 -0.413       
## SssnPst:CnC  0.464 -0.647 -0.410 -0.715  0.559
#Means/SDs
df_long_opioid_mean_bias %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT))
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition       M    SD
##   <fct>   <chr>       <dbl> <dbl>
## 1 Pre     A          -4.26   31.4
## 2 Pre     B           4.98   26.2
## 3 Pre     C         -10.7    33.1
## 4 Post    A           5.55   34.4
## 5 Post    B           0.433  23.7
## 6 Post    C          -0.937  31.5
#Actual Means
AM <- ggplot(df_long_opioid_mean_bias, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", position = position_dodge(width = 0.5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_mean_bias, aes(x=Session,y=predict(MLM_O_MB), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", position = position_dodge(width = 0.5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

-DV: Pain Mean Bias (NON-CONVERGENCE)

re_P_MB <- lmer(RT ~ (1|Subject), data = df_long_pain_mean_bias)
## boundary (singular) fit: see help('isSingular')
performance::icc(re_P_MB) #Error suggesting singularity
## Warning: Can't compute random effect variances. Some variance components equal
##   zero. Your model may suffer from singularity (see '?lme4::isSingular'
##   and '?performance::check_singularity').
##   Solution: Respecify random structure! You may also decrease the
##   'tolerance' level to enforce the calculation of random effect variances.
## [1] NA
MLM_P_MB <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_mean_bias,
                 control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5))) 
## boundary (singular) fit: see help('isSingular')
#^Control liner above added to assist with convergence after receiving the following error:
#Warning: Model failed to converge with 1 negative eigenvalue: -1.1e+01
#Afterwards, the error "boundary (singular) fit: see help('isSingular')" suggests our random effects here are very small or close to 0
isSingular(MLM_P_MB) #Verifies at least 1 random effect is small or close to 0
## [1] TRUE
#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_MB, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
## Session           205.71  205.71     1  22.746  0.3232 0.5753
## Condition         925.42  462.71     2 100.496  0.7270 0.4859
## Session:Condition 993.78  496.89     2 106.258  0.7807 0.4607
#Means/SDs
df_long_pain_mean_bias %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition      M    SD
##   <fct>   <chr>      <dbl> <dbl>
## 1 Pre     A         -4.69   22.8
## 2 Post    A         -7.40   36.3
## 3 Pre     B         -6.71   20.8
## 4 Post    B          3.85   32.3
## 5 Pre     C          0.104  26.5
## 6 Post    C          1.59   21.6
#Parameter Estimates
summary(MLM_P_MB)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_mean_bias
## Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e+05))
## 
## REML criterion at convergence: 1224.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.4227 -0.4652  0.0981  0.4275  3.4955 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  Subject  (Intercept)  34.55    5.878        
##           SessionPost 384.34   19.605   -1.00
##  Residual             636.45   25.228        
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)
## (Intercept)              -5.005      5.926  91.776  -0.845    0.401
## SessionPost              -1.634      9.103  83.223  -0.180    0.858
## ConditionB               -1.979      7.775  99.414  -0.255    0.800
## ConditionC                5.396      7.776  99.474   0.694    0.489
## SessionPost:ConditionB   12.585     11.035 106.703   1.140    0.257
## SessionPost:ConditionC    2.309     11.114 108.016   0.208    0.836
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.719                            
## ConditionB  -0.734  0.487                     
## ConditionC  -0.734  0.487  0.560              
## SssnPst:CnB  0.526 -0.678 -0.713 -0.402       
## SssnPst:CnC  0.523 -0.675 -0.399 -0.709  0.555
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
#Actual Means
AM <- ggplot(df_long_pain_mean_bias, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_pain_mean_bias, aes(x=Session,y=predict(MLM_P_MB), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM, PM)

7b. Mean Away Bias

-DV: Opioid Mean Away Bias

re_O_MA <- lmer(RT ~ (1|Subject), data = df_long_opioid_mean_away)
performance::icc(re_O_MA)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.635
##   Conditional ICC: 0.635
MLM_O_MA <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_mean_away)

#Multiple Degree-of-Freedom F-Tests
anova(MLM_O_MA, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session            378.16  378.16     1 19.678  0.4061 0.5313
## Condition         2073.29 1036.65     2 73.367  1.1133 0.3340
## Session:Condition 1003.54  501.77     2 78.812  0.5389 0.5855
#Means/SDs
df_long_opioid_mean_away %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          106.  57.7
## 2 Post    A          104.  63.5
## 3 Pre     B          109.  41.6
## 4 Post    B          115.  57.5
## 5 Pre     C          114.  53.9
## 6 Post    C          115.  54.2
#Parameter Estimates
summary(MLM_O_MA)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_mean_away
## 
## REML criterion at convergence: 1331.4
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.35516 -0.51551 -0.03073  0.32946  2.74247 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 1662.8   40.78        
##           SessionPost  560.4   23.67    0.21
##  Residual              931.1   30.51        
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             113.691     10.727  52.602  10.599 1.16e-14 ***
## SessionPost              -2.904     11.013  76.200  -0.264    0.793    
## ConditionB               -9.120      9.685  78.400  -0.942    0.349    
## ConditionC                2.920      9.688  78.215   0.301    0.764    
## SessionPost:ConditionB   13.874     13.386  80.066   1.036    0.303    
## SessionPost:ConditionC    8.388     13.462  80.923   0.623    0.535    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.368                            
## ConditionB  -0.515  0.479                     
## ConditionC  -0.515  0.479  0.574              
## SssnPst:CnB  0.358 -0.678 -0.702 -0.398       
## SssnPst:CnC  0.356 -0.675 -0.395 -0.695  0.553
#Actual Means
AM <- ggplot(df_long_opioid_mean_away, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_mean_away, aes(x=Session,y=predict(MLM_O_MA), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))


cowplot::plot_grid(AM, PM)

-DV: Pain Mean Away Bias (NON-CONVERGENCE)

re_P_MA <- lmer(RT ~ (1|Subject), data = df_long_pain_mean_away)
performance::icc(re_P_MA)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.745
##   Conditional ICC: 0.745
MLM_P_MA <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_mean_away)
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_P_MA)
## [1] TRUE
#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_MA, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
## Session           1036.10 1036.10     1  53.137  1.1259 0.2935
## Condition         2778.59 1389.30     2 103.619  1.5097 0.2258
## Session:Condition    8.41    4.21     2 101.765  0.0046 0.9954
#Means/SDs
df_long_pain_mean_away %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          110.  60.3
## 2 Post    A          114.  69.2
## 3 Pre     B          112.  47.9
## 4 Post    B          111.  48.7
## 5 Pre     C          112.  62.3
## 6 Post    C          115.  70.9
#Parameter Estimates
summary(MLM_P_MA)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_mean_away
## 
## REML criterion at convergence: 1327.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.6290 -0.4581 -0.1128  0.3960  2.9067 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 2370.6   48.69        
##           SessionPost  123.1   11.10    1.00
##  Residual              920.3   30.34        
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)            117.5566    11.8121  45.3740   9.952 5.51e-13 ***
## SessionPost              5.5747     9.9752  99.1065   0.559    0.578    
## ConditionB             -10.8324     9.5488 102.4076  -1.134    0.259    
## ConditionC              -2.3703     9.5563 102.4536  -0.248    0.805    
## SessionPost:ConditionB   0.2646    13.1255 101.7211   0.020    0.984    
## SessionPost:ConditionC   1.1766    13.1818 101.7196   0.089    0.929    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.239                            
## ConditionB  -0.458  0.506                     
## ConditionC  -0.458  0.506  0.570              
## SssnPst:CnB  0.314 -0.724 -0.696 -0.389       
## SssnPst:CnC  0.312 -0.721 -0.387 -0.689  0.547
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
#Actual Means
AM <- ggplot(df_long_pain_mean_away, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_pain_mean_away, aes(x=Session,y=predict(MLM_P_MA), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

7c. Mean Toward Bias

-DV: Opioid Mean Toward Bias (NON-CONVERGENCE)

re_O_MT <- lmer(RT ~ (1|Subject), data = df_long_opioid_mean_toward)
performance::icc(re_O_MT)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.684
##   Conditional ICC: 0.684
MLM_O_MT <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_mean_toward)
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_MT)
## [1] TRUE
#Multiple Degree-of-Freedom F-Tests
anova(MLM_O_MT, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session             46.89   46.89     1 100.02  0.0567 0.8123
## Condition         1626.97  813.48     2 104.62  0.9838 0.3773
## Session:Condition  459.86  229.93     2 102.02  0.2781 0.7578
#Means/SDs
df_long_opioid_mean_toward %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          101.  52.4
## 2 Post    A          111.  51.6
## 3 Pre     B          113.  40.0
## 4 Post    B          107.  37.8
## 5 Pre     C          115.  63.1
## 6 Post    C          110.  52.9
#Parameter Estimates
summary(MLM_O_MT)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_mean_toward
## 
## REML criterion at convergence: 1304.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.4295 -0.4645 -0.0749  0.3621  4.2082 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  Subject  (Intercept) 1849.12  43.00         
##           SessionPost    2.34   1.53    -1.00
##  Residual              826.85  28.75         
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)            108.3702    10.7536  47.9798  10.078 1.97e-13 ***
## SessionPost              6.5845     9.2397 101.8382   0.713    0.478    
## ConditionB               0.6354     9.1018 103.5472   0.070    0.944    
## ConditionC               9.7676     9.1089 103.6244   1.072    0.286    
## SessionPost:ConditionB  -7.3799    12.4482 102.0260  -0.593    0.555    
## SessionPost:ConditionC  -8.7908    12.4953 101.9863  -0.704    0.483    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.468                            
## ConditionB  -0.481  0.525                     
## ConditionC  -0.481  0.524  0.573              
## SssnPst:CnB  0.333 -0.742 -0.701 -0.394       
## SssnPst:CnC  0.331 -0.739 -0.392 -0.694  0.549
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
#Actual Means
AM <- ggplot(df_long_opioid_mean_toward, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_mean_toward, aes(x=Session,y=predict(MLM_O_MT), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

-DV: Pain Mean Toward Bias

re_P_MT <- lmer(RT ~ (1|Subject), data = df_long_pain_mean_toward)
performance::icc(re_P_MT)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.713
##   Conditional ICC: 0.713
MLM_P_MT <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_mean_toward)

#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_MT, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session            821.77  821.77     1 26.945  1.2168 0.2797
## Condition         1851.76  925.88     2 82.606  1.3710 0.2596
## Session:Condition 1972.03  986.01     2 86.744  1.4600 0.2379
#Means/SDs
df_long_pain_mean_toward %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A         104.   48.4
## 2 Post    A          98.7  50.2
## 3 Pre     B         109.   40.3
## 4 Post    B         117.   52.4
## 5 Pre     C         112.   52.6
## 6 Post    C         116.   63.5
#Parameter Estimates
summary(MLM_P_MT)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_mean_toward
## 
## REML criterion at convergence: 1295.4
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.86247 -0.50958 -0.05566  0.35560  2.93915 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 1567.1   39.59        
##           SessionPost  406.0   20.15    0.64
##  Residual              675.3   25.99        
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             110.895      9.816  46.666  11.298 5.96e-15 ***
## SessionPost              -3.413      9.317  83.654  -0.366    0.715    
## ConditionB               -5.783      8.208  87.169  -0.705    0.483    
## ConditionC                4.279      8.211  86.990   0.521    0.604    
## SessionPost:ConditionB   19.381     11.342  87.833   1.709    0.091 .  
## SessionPost:ConditionC   10.753     11.402  88.443   0.943    0.348    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.189                            
## ConditionB  -0.475  0.473                     
## ConditionC  -0.475  0.473  0.572              
## SssnPst:CnB  0.328 -0.676 -0.698 -0.393       
## SssnPst:CnC  0.325 -0.672 -0.390 -0.691  0.550
#Actual Means
AM <- ggplot(df_long_pain_mean_toward, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_pain_mean_toward, aes(x=Session,y=predict(MLM_P_MT), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

7d. Peak Away Bias

-DV: Opioid Peak Away Bias (NON-CONVERGENCE)

re_O_PA <- lmer(RT ~ (1|Subject), data = df_long_opioid_peak_away)
performance::icc(re_O_PA)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.617
##   Conditional ICC: 0.617
MLM_O_PA <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_peak_away)
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_PA)
## [1] TRUE
#Multiple Degree-of-Freedom F-Tests
anova(MLM_O_PA, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
## Session             135.7   135.7     1  75.837  0.0105 0.9185
## Condition         26491.3 13245.7     2 105.491  1.0291 0.3609
## Session:Condition  7437.8  3718.9     2 102.397  0.2889 0.7497
#Means/SDs
df_long_opioid_peak_away %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          329.  170.
## 2 Post    A          324.  193.
## 3 Pre     B          350.  163.
## 4 Post    B          361.  197.
## 5 Pre     C          372.  204.
## 6 Post    C          351.  179.
#Parameter Estimates
summary(MLM_O_PA)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_peak_away
## 
## REML criterion at convergence: 1649.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.8671 -0.4296 -0.1134  0.4154  2.9405 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 17569.4  132.5        
##           SessionPost   615.2   24.8    1.00
##  Residual             12871.3  113.5        
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             340.128     37.039  58.896   9.183 5.76e-13 ***
## SessionPost              -5.845     36.742 101.766  -0.159    0.874    
## ConditionB               -5.125     35.664 103.712  -0.144    0.886    
## ConditionC               37.061     35.688 103.792   1.038    0.301    
## SessionPost:ConditionB   28.445     49.077 102.345   0.580    0.563    
## SessionPost:ConditionC   -4.643     49.285 102.324  -0.094    0.925    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.407                            
## ConditionB  -0.546  0.516                     
## ConditionC  -0.546  0.516  0.570              
## SssnPst:CnB  0.376 -0.735 -0.698 -0.390       
## SssnPst:CnC  0.373 -0.732 -0.388 -0.691  0.548
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
#Actual Means
AM <- ggplot(df_long_opioid_peak_away, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_peak_away, aes(x=Session,y=predict(MLM_O_PA), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))


cowplot::plot_grid(AM,PM)

-DV: Pain Peak Away Bias

re_P_PA <- lmer(RT ~ (1|Subject), data = df_long_pain_peak_away)
performance::icc(re_P_PA)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.711
##   Conditional ICC: 0.711
MLM_P_PA <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_peak_away)

#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_PA, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session           5979.7  5979.7     1 23.462  0.6931 0.4135
## Condition         3272.4  1636.2     2 79.920  0.1897 0.8276
## Session:Condition 8763.9  4381.9     2 84.768  0.5079 0.6036
#Means/SDs
df_long_pain_peak_away %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          334.  189.
## 2 Post    A          372.  180.
## 3 Pre     B          362.  153.
## 4 Post    B          356.  173.
## 5 Pre     C          353.  173.
## 6 Post    C          342.  187.
#Parameter Estimates
summary(MLM_P_PA)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_peak_away
## 
## REML criterion at convergence: 1614.7
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.27661 -0.56489 -0.03049  0.41850  2.33591 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 20760    144.08       
##           SessionPost  1958     44.25   0.24
##  Residual              8627     92.88       
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             348.594     35.534  46.996   9.810 5.93e-13 ***
## SessionPost              36.423     31.343  87.597   1.162    0.248    
## ConditionB               -1.559     29.440  83.961  -0.053    0.958    
## ConditionC               15.289     29.456  83.712   0.519    0.605    
## SessionPost:ConditionB  -22.266     40.465  85.894  -0.550    0.584    
## SessionPost:ConditionC  -40.975     40.655  86.696  -1.008    0.316    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.368                            
## ConditionB  -0.472  0.505                     
## ConditionC  -0.472  0.504  0.574              
## SssnPst:CnB  0.327 -0.715 -0.701 -0.395       
## SssnPst:CnC  0.324 -0.712 -0.393 -0.694  0.551
#Actual Means
AM <- ggplot(df_long_pain_peak_away, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_pain_peak_away, aes(x=Session,y=predict(MLM_P_PA), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

7e. Peak Toward Bias

-DV: Opioid Peak Toward Bias

re_O_PT <- lmer(RT ~ (1|Subject), data = df_long_opioid_peak_toward)
performance::icc(re_O_PA)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.617
##   Conditional ICC: 0.617
MLM_O_PT <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_peak_toward)
## boundary (singular) fit: see help('isSingular')
#Multiple Degree-of-Freedom F-Tests
anova(MLM_O_PA, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
## Session             135.7   135.7     1  75.837  0.0105 0.9185
## Condition         26491.3 13245.7     2 105.491  1.0291 0.3609
## Session:Condition  7437.8  3718.9     2 102.397  0.2889 0.7497
#Means/SDs
df_long_opioid_peak_toward %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          312.  149.
## 2 Post    A          362.  179.
## 3 Pre     B          370.  170.
## 4 Post    B          380.  162.
## 5 Pre     C          358.  176.
## 6 Post    C          345   188.
#Parameter Estimates
summary(MLM_O_PA)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_peak_away
## 
## REML criterion at convergence: 1649.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.8671 -0.4296 -0.1134  0.4154  2.9405 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 17569.4  132.5        
##           SessionPost   615.2   24.8    1.00
##  Residual             12871.3  113.5        
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             340.128     37.039  58.896   9.183 5.76e-13 ***
## SessionPost              -5.845     36.742 101.766  -0.159    0.874    
## ConditionB               -5.125     35.664 103.712  -0.144    0.886    
## ConditionC               37.061     35.688 103.792   1.038    0.301    
## SessionPost:ConditionB   28.445     49.077 102.345   0.580    0.563    
## SessionPost:ConditionC   -4.643     49.285 102.324  -0.094    0.925    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.407                            
## ConditionB  -0.546  0.516                     
## ConditionC  -0.546  0.516  0.570              
## SssnPst:CnB  0.376 -0.735 -0.698 -0.390       
## SssnPst:CnC  0.373 -0.732 -0.388 -0.691  0.548
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
#Actual Means
AM <- ggplot(df_long_opioid_mean_toward, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_mean_toward, aes(x=Session,y=predict(MLM_O_PT), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

-DV: Pain Peak Toward Bias

re_P_PT <- lmer(RT ~ (1|Subject), data = df_long_pain_peak_toward)
performance::icc(re_P_PT)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.699
##   Conditional ICC: 0.699
MLM_P_PT <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_peak_toward)

#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_PT, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session            2324.3  2324.3     1 25.267  0.3161 0.5789
## Condition         10172.3  5086.2     2 81.690  0.6917 0.5037
## Session:Condition  9286.3  4643.1     2 86.139  0.6314 0.5343
#Means/SDs
df_long_pain_peak_toward %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          335.  150.
## 2 Post    A          332.  163.
## 3 Pre     B          347.  123.
## 4 Post    B          360.  142.
## 5 Pre     C          360.  173.
## 6 Post    C          347.  204.
#Parameter Estimates
summary(MLM_P_PT)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_peak_toward
## 
## REML criterion at convergence: 1592.7
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.73146 -0.52681 -0.01424  0.43289  2.40516 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 14577    120.73       
##           SessionPost  2432     49.31   0.71
##  Residual              7354     85.75       
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             344.405     30.890  49.966  11.149 3.68e-15 ***
## SessionPost               1.814     29.338  87.748   0.062    0.951    
## ConditionB               -6.812     27.016  86.422  -0.252    0.802    
## ConditionC               25.741     27.031  86.187   0.952    0.344    
## SessionPost:ConditionB   31.058     37.270  87.350   0.833    0.407    
## SessionPost:ConditionC   -6.469     37.452  88.046  -0.173    0.863    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.256                            
## ConditionB  -0.496  0.492                     
## ConditionC  -0.496  0.491  0.571              
## SssnPst:CnB  0.342 -0.702 -0.697 -0.391       
## SssnPst:CnC  0.339 -0.699 -0.388 -0.690  0.549
#Actual Means
AM <- ggplot(df_long_pain_peak_toward, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_pain_peak_toward, aes(x=Session,y=predict(MLM_P_PT), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

7f. Variability Bias

-DV: Opioid Variability Bias (NON-CONVERGENCE)

re_O_V <- lmer(RT ~ (1|Subject), data = df_long_opioid_variability)
performance::icc(re_O_V)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.784
##   Conditional ICC: 0.784
MLM_O_V <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_variability)
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_V)
## [1] TRUE
#Multiple Degree-of-Freedom F-Tests
anova(MLM_O_V, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
## Session            211.20  211.20     1  80.418  0.5456 0.4623
## Condition         1593.49  796.74     2 103.656  2.0582 0.1329
## Session:Condition    5.46    2.73     2 101.998  0.0071 0.9930
#Means/SDs
df_long_opioid_variability %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          88.6  42.7
## 2 Post    A          92.5  43.4
## 3 Pre     B          98.1  30.7
## 4 Post    B          95.9  39.5
## 5 Pre     C          98.2  48.5
## 6 Post    C          97.7  47.3
#Parameter Estimates
summary(MLM_O_V)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_variability
## 
## REML criterion at convergence: 1220.5
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.39724 -0.51084 -0.07423  0.45530  2.68996 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 1317.97  36.30        
##           SessionPost   13.84   3.72    1.00
##  Residual              387.10  19.67        
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)             93.7981     8.4125  41.4107  11.150 4.78e-14 ***
## SessionPost              3.1267     6.3582 101.4801   0.492    0.624    
## ConditionB               0.4783     6.2151 102.7932   0.077    0.939    
## ConditionC               7.7974     6.2203 102.8389   1.254    0.213    
## SessionPost:ConditionB  -1.0091     8.5141 101.9806  -0.119    0.906    
## SessionPost:ConditionC  -0.6090     8.5484 101.9658  -0.071    0.943    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.288                            
## ConditionB  -0.420  0.517                     
## ConditionC  -0.420  0.517  0.572              
## SssnPst:CnB  0.289 -0.737 -0.698 -0.391       
## SssnPst:CnC  0.286 -0.734 -0.389 -0.690  0.548
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
#Actual Means
AM <- ggplot(df_long_opioid_variability, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_variability, aes(x=Session,y=predict(MLM_O_V), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

-DV: Pain Variability Bias

re_P_V <- lmer(RT ~ (1|Subject), data = df_long_pain_variability)
performance::icc(re_P_V)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.804
##   Conditional ICC: 0.804
MLM_P_V <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_variability)

#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_V, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session           515.24  515.24     1 23.801  1.3752 0.2525
## Condition         815.83  407.91     2 78.248  1.0887 0.3417
## Session:Condition  15.49    7.74     2 83.947  0.0207 0.9796
#Means/SDs
df_long_pain_variability %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          89.4  45.7
## 2 Post    A          93.2  44.6
## 3 Pre     B          98.2  35.7
## 4 Post    B          98.3  43.2
## 5 Pre     C          97.3  45.9
## 6 Post    C          98.4  54.6
#Parameter Estimates
summary(MLM_P_V)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_variability
## 
## REML criterion at convergence: 1228.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.7438 -0.4918 -0.1046  0.4235  3.1886 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 1480.5   38.48        
##           SessionPost  149.3   12.22    0.52
##  Residual              374.7   19.36        
## Number of obs: 134, groups:  Subject, 27
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             95.2362     8.7356 39.4413  10.902 1.81e-13 ***
## SessionPost              4.2747     6.7269 84.8506   0.635    0.527    
## ConditionB              -0.7355     6.1395 83.3470  -0.120    0.905    
## ConditionC               5.2924     6.1429 83.0851   0.862    0.391    
## SessionPost:ConditionB   1.5426     8.4454 85.1775   0.183    0.856    
## SessionPost:ConditionC   0.2217     8.4874 85.9665   0.026    0.979    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.191                            
## ConditionB  -0.400  0.490                     
## ConditionC  -0.400  0.489  0.574              
## SssnPst:CnB  0.277 -0.696 -0.699 -0.395       
## SssnPst:CnC  0.275 -0.693 -0.392 -0.692  0.551
#Actual Means
AM <- ggplot(df_long_pain_variability, aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_pain_variability, aes(x=Session,y=predict(MLM_P_V), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

8. Muiltilevel Models Separated by Dose examining Attentional Bias regressed on session*condition (fixed effects). Random intercepts per subject, random slopes across sessions (pre-post)

8a. Mean Bias

-DV: Opioid Mean Bias

re_O_MB_LD <- lmer(RT ~ (1|Subject), data = df_long_opioid_mean_bias %>% filter(Dose == "Low"))
re_O_MB_HD <- lmer(RT ~ (1|Subject), data = df_long_opioid_mean_bias %>% filter(Dose == "High"))

performance::icc(re_O_MB_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.043
##   Conditional ICC: 0.043
performance::icc(re_O_MB_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.231
##   Conditional ICC: 0.231
MLM_O_MB_LD <- lmer(RT ~ Session*Condition + (1 + Session|Subject), data = df_long_opioid_mean_bias %>% filter(Dose == "Low"))
MLM_O_MB_HD <- lmer(RT ~ Session*Condition + (1 + Session|Subject), data = df_long_opioid_mean_bias %>% filter(Dose == "High"))
## boundary (singular) fit: see help('isSingular')
#The code below then obtains mltiple Degree-of-Freedom F-Tests for the above-specified model
anova(MLM_O_MB_LD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session            187.78  187.78     1 15.885  0.2607 0.6166
## Condition          199.17   99.58     2 51.463  0.1383 0.8712
## Session:Condition 1545.79  772.89     2 50.360  1.0731 0.3496
anova(MLM_O_MB_HD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session            193.58  193.58     1 11.849  0.3312 0.5757
## Condition         2612.92 1306.46     2 38.010  2.2353 0.1208
## Session:Condition  156.79   78.39     2 35.556  0.1341 0.8749
#Model Parameters 
summary(MLM_O_MB_LD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_mean_bias %>% filter(Dose == "Low")
## 
## REML criterion at convergence: 769.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.8170 -0.6311 -0.0437  0.4117  3.4516 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  Subject  (Intercept) 507.9    22.54         
##           SessionPost 840.4    28.99    -0.96
##  Residual             720.2    26.84         
## Number of obs: 84, groups:  Subject, 16
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)
## (Intercept)              -5.894      9.514  39.086  -0.620    0.539
## SessionPost               8.037     13.003  41.673   0.618    0.540
## ConditionB               10.530     10.402  51.274   1.012    0.316
## ConditionC               -2.869     10.504  50.044  -0.273    0.786
## SessionPost:ConditionB  -14.898     14.530  50.744  -1.025    0.310
## SessionPost:ConditionC    5.206     14.929  49.672   0.349    0.729
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.798                            
## ConditionB  -0.597  0.442                     
## ConditionC  -0.578  0.426  0.529              
## SssnPst:CnB  0.432 -0.619 -0.721 -0.382       
## SssnPst:CnC  0.408 -0.589 -0.374 -0.707  0.527
summary(MLM_O_MB_HD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_mean_bias %>% filter(Dose == "High")
## 
## REML criterion at convergence: 426
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.18606 -0.50718 -0.09435  0.55229  3.02205 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept)  53.0     7.28        
##           SessionPost 103.1    10.15    1.00
##  Residual             584.5    24.18        
## Number of obs: 50, groups:  Subject, 11
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)
## (Intercept)               2.210     10.208  30.630   0.217    0.830
## SessionPost               9.670     13.911  30.831   0.695    0.492
## ConditionB                3.511     12.844  35.533   0.273    0.786
## ConditionC              -12.442     12.600  35.525  -0.987    0.330
## SessionPost:ConditionB   -9.120     17.963  35.504  -0.508    0.615
## SessionPost:ConditionC   -6.626     17.387  35.396  -0.381    0.705
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.628                            
## ConditionB  -0.758  0.538                     
## ConditionC  -0.775  0.545  0.618              
## SssnPst:CnB  0.527 -0.731 -0.698 -0.425       
## SssnPst:CnC  0.538 -0.763 -0.426 -0.699  0.587
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
#Means/SDs
df_long_opioid_mean_bias %>% filter(Dose == "Low") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT))
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition      M    SD
##   <fct>   <chr>      <dbl> <dbl>
## 1 Pre     A          -6.36  35.2
## 2 Pre     B           4.70  30.8
## 3 Pre     C         -10.6   32.4
## 4 Post    A           2.36  37.3
## 5 Post    B          -2.23  21.0
## 6 Post    C           4.81  35.5
df_long_opioid_mean_bias %>% filter(Dose == "High") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT))
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition       M    SD
##   <fct>   <chr>       <dbl> <dbl>
## 1 Pre     A           0.291  23.2
## 2 Pre     B           5.44   17.5
## 3 Pre     C         -10.7    35.9
## 4 Post    A          11.5    30.1
## 5 Post    B           5.75   29.1
## 6 Post    C          -8.41   25.2
#Actual Means
AM_LD <- ggplot(df_long_opioid_mean_bias %>% filter(Dose == "Low"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", position = position_dodge(width = 0.5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))
AM_HD <- ggplot(df_long_opioid_mean_bias %>% filter(Dose == "High"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", position = position_dodge(width = 0.5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM_LD <- ggplot(df_long_opioid_mean_bias %>% filter(Dose == "Low"), aes(x=Session,y=predict(MLM_O_MB_LD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", position = position_dodge(width = 0.5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))
PM_HD <- ggplot(df_long_opioid_mean_bias %>% filter(Dose == "High"), aes(x=Session,y=predict(MLM_O_MB_HD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", position = position_dodge(width = 0.5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM_LD,AM_HD)

cowplot::plot_grid(PM_LD,PM_HD)

-DV: Pain Mean Bias (NON-CONVERGENCE PRESENT IN AT LEAST 1 MODEL)

re_P_MB_LD <- lmer(RT ~ (1|Subject), data = df_long_pain_mean_bias %>% filter(Dose == "Low"))
## boundary (singular) fit: see help('isSingular')
re_P_MB_HD <- lmer(RT ~ (1|Subject), data = df_long_pain_mean_bias %>% filter(Dose == "High"))
## boundary (singular) fit: see help('isSingular')
isSingular(re_P_MB_LD)
## [1] TRUE
isSingular(re_P_MB_HD) #non-convergence of random effects, suggests insufficient variance explained by grouping by subject
## [1] TRUE
performance::icc(re_P_MB_HD)
## Warning: Can't compute random effect variances. Some variance components equal
##   zero. Your model may suffer from singularity (see '?lme4::isSingular'
##   and '?performance::check_singularity').
##   Solution: Respecify random structure! You may also decrease the
##   'tolerance' level to enforce the calculation of random effect variances.
## [1] NA
MLM_P_MB_LD <- lmer(RT ~ Session*Condition + (1 + Session|Subject), data = df_long_pain_mean_bias %>% filter(Dose == "Low"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_P_MB_LD) #non-convergence
## [1] TRUE
MLM_P_MB_HD <- lmer(RT ~ Session*Condition + (1 + Session|Subject), data = df_long_pain_mean_bias %>% filter(Dose == "High"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
## Warning: Model failed to converge with 1 negative eigenvalue: -8.1e-01
isSingular(MLM_P_MB_HD) #non-convergence
## [1] TRUE

8b. Mean Away Bias

-DV: Opioid Mean Away Bias (NON-CONVERGENCE PRESENT IN AT LEAST 1 MODEL)

re_O_MA_LD <- lmer(RT ~ (1|Subject), data = df_long_opioid_mean_away %>% filter(Dose == "Low"))
re_O_MA_HD <- lmer(RT ~ (1|Subject), data = df_long_opioid_mean_away %>% filter(Dose == "High"))

performance::icc(re_O_MA_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.656
##   Conditional ICC: 0.656
performance::icc(re_O_MA_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.625
##   Conditional ICC: 0.625
MLM_O_MA_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_mean_away %>%  filter(Dose == "Low"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5))) #non-convergence
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_MA_LD) #non-convergence
## [1] TRUE
MLM_O_MA_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_mean_away %>%  filter(Dose == "High")) 

#Multiple Degree-of-Freedom F-Tests
anova(MLM_O_MA_HD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session            68.561  68.561     1 10.219  0.0919 0.7678
## Condition         104.643  52.321     2 25.735  0.0701 0.9324
## Session:Condition 222.454 111.227     2 27.119  0.1491 0.8622
#Means/SDs
df_long_opioid_mean_away %>% filter(Dose == "High") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          95.5  35.6
## 2 Post    A          98.4  86.7
## 3 Pre     B         116.   53.9
## 4 Post    B         109.   43.1
## 5 Pre     C         117.   54.7
## 6 Post    C         114.   51.1
#Parameter Estimates
summary(MLM_O_MA_HD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_mean_away %>% filter(Dose == "High")
## 
## REML criterion at convergence: 464.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.2639 -0.4723 -0.1453  0.4648  2.7191 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  Subject  (Intercept) 1965.8   44.34         
##           SessionPost 1570.9   39.63    -0.25
##  Residual              745.9   27.31         
## Number of obs: 50, groups:  Subject, 11
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)            114.5756    18.1553  20.3074   6.311 3.43e-06 ***
## SessionPost            -10.2133    20.3298  25.6452  -0.502    0.620    
## ConditionB              -4.5673    15.6375  27.6238  -0.292    0.772    
## ConditionC               0.8734    15.5171  28.1789   0.056    0.956    
## SessionPost:ConditionB  11.5537    21.3601  27.6550   0.541    0.593    
## SessionPost:ConditionC   5.7990    20.9829  28.8668   0.276    0.784    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.504                            
## ConditionB  -0.534  0.463                     
## ConditionC  -0.555  0.477  0.665              
## SssnPst:CnB  0.381 -0.609 -0.714 -0.468       
## SssnPst:CnC  0.394 -0.650 -0.469 -0.712  0.620
#Actual Means
AM <- ggplot(df_long_opioid_mean_away %>% filter(Dose == "High"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_mean_away %>% filter(Dose == "High"), aes(x=Session,y=predict(MLM_O_MA_HD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))


cowplot::plot_grid(AM, PM)

-DV: Pain Mean Away Bias (NON-CONVERGENCE PRESENT IN AT LEAST 1 MODEL)

re_P_MA_LD <- lmer(RT ~ (1|Subject), data = df_long_pain_mean_away %>% filter(Dose == "Low"))
re_P_MA_HD <- lmer(RT ~ (1|Subject), data = df_long_pain_mean_away %>% filter(Dose == "High"))

performance::icc(re_P_MA_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.725
##   Conditional ICC: 0.725
performance::icc(re_P_MA_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.792
##   Conditional ICC: 0.792
MLM_P_MA_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_mean_away %>%  filter(Dose == "Low"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_P_MA_LD) #non-convergence
## [1] TRUE
MLM_P_MA_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_mean_away %>%  filter(Dose == "High"))


#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_MA_HD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
## Session            573.40  573.40     1  6.8012  0.8775 0.3810
## Condition          998.02  499.01     2 20.4368  0.7636 0.4788
## Session:Condition 1876.09  938.05     2 23.8855  1.4355 0.2578
#Means/SDs
df_long_pain_mean_away %>% filter(Dose == "High") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          92.6  26.5
## 2 Post    A         118.   82.2
## 3 Pre     B         120.   59.5
## 4 Post    B         101.   45.9
## 5 Pre     C         110.   61.3
## 6 Post    C         122.   77.2
#Parameter Estimates
summary(MLM_P_MA_HD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_mean_away %>% filter(Dose == "High")
## 
## REML criterion at convergence: 458.3
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.73299 -0.55854  0.02361  0.37982  2.38923 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 2457.0   49.57        
##           SessionPost  895.2   29.92    0.77
##  Residual              653.5   25.56        
## Number of obs: 50, groups:  Subject, 11
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)            108.8460    18.6088  17.4479   5.849 1.74e-05 ***
## SessionPost             28.3623    17.2569  24.4171   1.644    0.113    
## ConditionB               4.0595    14.1755  24.7819   0.286    0.777    
## ConditionC              -0.4901    14.0046  25.5106  -0.035    0.972    
## SessionPost:ConditionB -32.7531    19.3309  25.1726  -1.694    0.103    
## SessionPost:ConditionC -19.1714    18.7727  27.4501  -1.021    0.316    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.030                            
## ConditionB  -0.467  0.468                     
## ConditionC  -0.482  0.473  0.646              
## SssnPst:CnB  0.322 -0.639 -0.692 -0.431       
## SssnPst:CnC  0.326 -0.673 -0.430 -0.683  0.597
#Actual Means
AM <- ggplot(df_long_pain_mean_away %>% filter(Dose == "High"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_pain_mean_away %>% filter(Dose == "High"), aes(x=Session,y=predict(MLM_P_MA_HD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

8c. Mean Toward Bias

-DV: Opioid Mean Toward Bias

re_O_MT_LD <- lmer(RT ~ (1|Subject), data = df_long_opioid_mean_toward %>% filter(Dose == "Low"))
re_O_MT_HD <- lmer(RT ~ (1|Subject), data = df_long_opioid_mean_toward %>% filter(Dose == "High"))

performance::icc(re_O_MT_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.598
##   Conditional ICC: 0.598
performance::icc(re_O_MT_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.871
##   Conditional ICC: 0.871
MLM_O_MT_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_mean_toward %>% filter(Dose == "Low"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_MT_LD)
## [1] TRUE
MLM_O_MT_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_mean_toward %>% filter(Dose == "High"))

#Multiple Degree-of-Freedom F-Tests
anova(MLM_O_MT_HD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF   DenDF F value  Pr(>F)  
## Session            176.49  176.49     1  8.7816  0.6718 0.43412  
## Condition          218.14  109.07     2 23.8751  0.4152 0.66491  
## Session:Condition 1910.39  955.20     2 26.9879  3.6357 0.03998 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Means/SDs
df_long_opioid_mean_toward %>% filter(Dose == "High") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          82.2  39.0
## 2 Post    A         113.   60.8
## 3 Pre     B         120.   49.7
## 4 Post    B         108.   43.3
## 5 Pre     C         113.   44.1
## 6 Post    C         106.   54.9
#Parameter Estimates
summary(MLM_O_MT_HD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_mean_toward %>% filter(Dose == "High")
## 
## REML criterion at convergence: 421.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9215 -0.4365 -0.0448  0.4367  2.3358 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 1817.9   42.64        
##           SessionPost  165.8   12.87    0.63
##  Residual              262.7   16.21        
## Number of obs: 50, groups:  Subject, 11
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)              98.736     14.688  14.455   6.722 8.28e-06 ***
## SessionPost              24.019     10.078  29.991   2.383   0.0237 *  
## ConditionB               17.191      9.078  27.237   1.894   0.0689 .  
## ConditionC               14.844      8.985  27.768   1.652   0.1098    
## SessionPost:ConditionB  -26.043     12.244  28.002  -2.127   0.0424 *  
## SessionPost:ConditionC  -30.837     11.864  29.793  -2.599   0.0144 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.103                            
## ConditionB  -0.380  0.511                     
## ConditionC  -0.393  0.518  0.652              
## SssnPst:CnB  0.263 -0.693 -0.695 -0.436       
## SssnPst:CnC  0.267 -0.728 -0.436 -0.688  0.597
#Actual Means
AM <- ggplot(df_long_opioid_mean_toward %>% filter(Dose == "High"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_mean_toward %>% filter(Dose == "High"), aes(x=Session,y=predict(MLM_O_MT_HD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))


cowplot::plot_grid(AM,PM)

-DV: Pain Mean Toward Bias (NON-CONVERGENCE PRESENT IN AT LEAST 1 MODEL)

re_P_MT_LD <- lmer(RT ~ (1|Subject), data = df_long_pain_mean_toward %>% filter(Dose == "Low"))
re_P_MT_HD <- lmer(RT ~ (1|Subject), data = df_long_pain_mean_toward %>% filter(Dose == "High"))

performance::icc(re_P_MT_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.663
##   Conditional ICC: 0.663
performance::icc(re_P_MT_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.795
##   Conditional ICC: 0.795
MLM_P_MT_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_mean_toward %>% filter(Dose == "Low"))
MLM_P_MT_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_mean_toward %>% filter(Dose == "High"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_P_MT_HD) #non-convergence
## [1] TRUE
#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_MT_LD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session            331.91  331.91     1 14.909  0.4974 0.4915
## Condition         1140.08  570.04     2 50.204  0.8543 0.4317
## Session:Condition 1839.20  919.60     2 51.894  1.3782 0.2611
#Means/SDs
df_long_pain_mean_toward %>% filter(Dose == "Low") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A         108.   55.3
## 2 Post    A          97.8  48.3
## 3 Pre     B         109.   38.1
## 4 Post    B         117.   54.3
## 5 Pre     C         106.   41.2
## 6 Post    C         114.   64.4
#Parameter Estimates
summary(MLM_P_MT_LD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_mean_toward %>% filter(Dose == "Low")
## 
## REML criterion at convergence: 794
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.61649 -0.46796 -0.03134  0.37930  2.77210 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 1311.8   36.22        
##           SessionPost  695.8   26.38    0.36
##  Residual              667.3   25.83        
## Number of obs: 84, groups:  Subject, 16
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             112.368     11.683  26.670   9.618 3.67e-10 ***
## SessionPost              -7.360     12.276  41.859  -0.600    0.552    
## ConditionB               -6.879     10.012  52.003  -0.687    0.495    
## ConditionC               -2.025     10.109  50.990  -0.200    0.842    
## SessionPost:ConditionB   18.493     13.941  52.591   1.326    0.190    
## SessionPost:ConditionC   22.172     14.350  51.148   1.545    0.129    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.216                            
## ConditionB  -0.468  0.429                     
## ConditionC  -0.453  0.421  0.529              
## SssnPst:CnB  0.325 -0.627 -0.704 -0.372       
## SssnPst:CnC  0.316 -0.594 -0.369 -0.698  0.523
#Actual Means
AM <- ggplot(df_long_pain_mean_toward %>% filter(Dose == "Low"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_pain_mean_toward %>% filter(Dose == "Low"), aes(x=Session,y=predict(MLM_P_MT_LD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))


cowplot::plot_grid(AM,PM)

8d. Peak Away Bias

-DV: Opioid Peak Away Bias

re_O_PA_LD <- lmer(RT ~ (1|Subject), data = df_long_opioid_peak_away %>% filter(Dose == "Low"))
re_O_PA_HD <- lmer(RT ~ (1|Subject), data = df_long_opioid_peak_away %>% filter(Dose == "High"))

performance::icc(re_O_PA_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.609
##   Conditional ICC: 0.609
performance::icc(re_O_PA_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.670
##   Conditional ICC: 0.670
MLM_O_PA_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_peak_away %>% filter(Dose == "Low"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_PA_LD)
## [1] TRUE
MLM_O_PA_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_peak_away %>% filter(Dose == "High"))

#Multiple Degree-of-Freedom F-Tests
anova(MLM_O_PA_HD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
## Session           11388.0 11388.0     1  9.6686  1.5581 0.2413
## Condition         29635.4 14817.7     2 26.1029  2.0274 0.1519
## Session:Condition  1305.4   652.7     2 28.0549  0.0893 0.9148
#Means/SDs
df_long_opioid_peak_away %>% filter(Dose == "High") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          277.  105.
## 2 Post    A          269.  172.
## 3 Pre     B          410.  206.
## 4 Post    B          338.  185.
## 5 Pre     C          346   148.
## 6 Post    C          318.  155.
#Parameter Estimates
summary(MLM_O_PA_HD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_peak_away %>% filter(Dose == "High")
## 
## REML criterion at convergence: 558.5
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.95197 -0.40054  0.00381  0.25373  2.82412 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  Subject  (Intercept) 16796    129.60        
##           SessionPost  5716     75.60   -0.07
##  Residual              7309     85.49        
## Number of obs: 50, groups:  Subject, 11
## 
## Fixed effects:
##                        Estimate Std. Error     df t value Pr(>|t|)    
## (Intercept)              320.10      54.39  21.50   5.885 6.99e-06 ***
## SessionPost              -42.99      54.97  29.40  -0.782    0.440    
## ConditionB                71.82      48.24  28.65   1.489    0.148    
## ConditionC                20.13      47.77  29.26   0.421    0.677    
## SessionPost:ConditionB   -11.93      65.45  28.85  -0.182    0.857    
## SessionPost:ConditionC    12.28      63.75  30.30   0.193    0.849    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.476                            
## ConditionB  -0.548  0.514                     
## ConditionC  -0.567  0.525  0.656              
## SssnPst:CnB  0.386 -0.685 -0.706 -0.452       
## SssnPst:CnC  0.396 -0.723 -0.453 -0.703  0.607
#Actual Means
AM <- ggplot(df_long_opioid_peak_away %>% filter(Dose == "High"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_peak_away %>% filter(Dose == "High"), aes(x=Session,y=predict(MLM_O_PA_HD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM,PM)

-DV: Pain Peak Away Bias

re_P_PA_LD <- lmer(RT ~ (1|Subject), data = df_long_pain_peak_away %>% filter(Dose == "Low"))
re_P_PA_HD <- lmer(RT ~ (1|Subject), data = df_long_pain_peak_away %>% filter(Dose == "High"))

performance::icc(re_P_PA_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.715
##   Conditional ICC: 0.715
performance::icc(re_P_PA_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.722
##   Conditional ICC: 0.722
MLM_P_PA_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_peak_away %>% filter(Dose == "Low"))
MLM_P_PA_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_peak_away %>% filter(Dose == "High"))

#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_PA_LD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session            808.1   808.1     1 14.986  0.0949 0.7622
## Condition         2683.0  1341.5     2 51.348  0.1576 0.8546
## Session:Condition 7638.2  3819.1     2 53.361  0.4487 0.6409
anova(MLM_P_PA_HD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
## Session            8279.8  8279.8     1  6.6396  0.8913 0.3782
## Condition         13618.7  6809.3     2 22.2618  0.7330 0.4917
## Session:Condition 24627.0 12313.5     2 25.3604  1.3255 0.2835
#Means/SDs
df_long_pain_peak_away %>% filter(Dose == "Low") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          366.  215.
## 2 Post    A          376.  177.
## 3 Pre     B          371.  134.
## 4 Post    B          387.  181.
## 5 Pre     C          353.  157.
## 6 Post    C          324.  177.
df_long_pain_peak_away %>% filter(Dose == "High") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition, Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          264.  93.1
## 2 Post    A          364. 200. 
## 3 Pre     B          347. 187. 
## 4 Post    B          293. 148. 
## 5 Pre     C          354. 203. 
## 6 Post    C          364  208.
#Parameter Estimates
summary(MLM_P_PA_LD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_peak_away %>% filter(Dose == "Low")
## 
## REML criterion at convergence: 985
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.10401 -0.56847 -0.02793  0.45852  1.91856 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 20438    142.96       
##           SessionPost  1558     39.47   0.06
##  Residual              8512     92.26       
## Number of obs: 84, groups:  Subject, 16
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)            369.33459   44.40999  25.29642   8.316 1.05e-08 ***
## SessionPost              8.96094   37.76617  53.74150   0.237    0.813    
## ConditionB             -11.45274   35.73417  52.87229  -0.320    0.750    
## ConditionC               0.05451   36.08540  51.93424   0.002    0.999    
## SessionPost:ConditionB  20.21971   49.37309  53.99170   0.410    0.684    
## SessionPost:ConditionC -26.14935   51.00515  52.68777  -0.513    0.610    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.382                            
## ConditionB  -0.440  0.491                     
## ConditionC  -0.425  0.484  0.529              
## SssnPst:CnB  0.303 -0.713 -0.704 -0.371       
## SssnPst:CnC  0.296 -0.685 -0.369 -0.697  0.524
summary(MLM_P_PA_HD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_peak_away %>% filter(Dose == "High")
## 
## REML criterion at convergence: 566.2
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.68813 -0.38241  0.02226  0.47663  2.46423 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 21813    147.69       
##           SessionPost  2177     46.66   0.68
##  Residual              9290     96.38       
## Number of obs: 50, groups:  Subject, 11
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)              303.46      60.95   20.48   4.978 6.76e-05 ***
## SessionPost               96.79      56.25   30.02   1.721   0.0956 .  
## ConditionB                26.12      53.29   26.11   0.490   0.6281    
## ConditionC                51.11      52.64   26.79   0.971   0.3403    
## SessionPost:ConditionB  -113.70      72.07   26.68  -1.578   0.1265    
## SessionPost:ConditionC   -87.45      69.61   28.81  -1.256   0.2191    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.339                            
## ConditionB  -0.535  0.533                     
## ConditionC  -0.552  0.538  0.644              
## SssnPst:CnB  0.369 -0.727 -0.692 -0.429       
## SssnPst:CnC  0.373 -0.759 -0.429 -0.686  0.590
#Actual Means
AM_LD <- ggplot(df_long_pain_peak_away %>% filter(Dose == "Low"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))
AM_HD <- ggplot(df_long_pain_peak_away %>% filter(Dose == "High"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM_LD <- ggplot(df_long_pain_peak_away %>% filter(Dose == "Low"), aes(x=Session,y=predict(MLM_P_PA_LD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))
PM_HD <- ggplot(df_long_pain_peak_away %>% filter(Dose == "High"), aes(x=Session,y=predict(MLM_P_PA_HD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM_LD,PM_LD, AM_HD,PM_HD)

8e. Peak Toward Bias

-DV: Opioid Peak Toward Bias (NON-CONVERGENCE PRESENT IN AT LEAST 1 MODEL)

re_O_PT_LD <- lmer(RT ~ (1|Subject), data = df_long_opioid_peak_toward %>% filter(Dose == "Low"))
re_O_PT_HD <- lmer(RT ~ (1|Subject), data = df_long_opioid_peak_toward %>% filter(Dose == "High"))

performance::icc(re_O_PA_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.609
##   Conditional ICC: 0.609
performance::icc(re_O_PA_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.670
##   Conditional ICC: 0.670
MLM_O_PT_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_peak_toward %>% filter(Dose == "Low"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_PT_LD) #non-convergence
## [1] TRUE
MLM_O_PT_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_peak_toward %>% filter(Dose == "High"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_PT_HD) #non-convergence
## [1] TRUE

-DV: Pain Peak Toward Bias (NON-CONVERGENCE PRESENT IN AT LEAST 1 MODEL)

re_P_PT_LD <- lmer(RT ~ (1|Subject), data = df_long_pain_peak_toward %>% filter(Dose == "Low"))
re_P_PT_HD <- lmer(RT ~ (1|Subject), data = df_long_pain_peak_toward %>% filter(Dose == "High"))

performance::icc(re_P_PT_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.662
##   Conditional ICC: 0.662
performance::icc(re_P_PT_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.786
##   Conditional ICC: 0.786
MLM_P_PT_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_peak_toward %>% filter(Dose == "Low"))
MLM_P_PT_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_peak_toward %>% filter(Dose == "High"),
                    control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_P_PT_HD) #non-convergence
## [1] TRUE
#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_PT_LD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session              79.1    79.1     1 14.297  0.0094 0.9242
## Condition         11509.0  5754.5     2 50.472  0.6825 0.5100
## Session:Condition  5796.0  2898.0     2 52.509  0.3437 0.7107
#Means/SDs
df_long_pain_peak_toward %>% filter(Dose == "Low") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          364.  166.
## 2 Post    A          353.  180.
## 3 Pre     B          349.  133.
## 4 Post    B          365.  147.
## 5 Pre     C          374.  156.
## 6 Post    C          350   221.
#Parameter Estimates
summary(MLM_P_PT_LD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_peak_toward %>% filter(Dose == "Low")
## 
## REML criterion at convergence: 982.8
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.41907 -0.50753 -0.02376  0.42226  2.29480 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 13364    115.60       
##           SessionPost  3378     58.12   0.63
##  Residual              8432     91.83       
## Number of obs: 84, groups:  Subject, 16
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             367.617     38.923  29.321   9.445 2.13e-10 ***
## SessionPost              -7.565     39.126  50.144  -0.193    0.847    
## ConditionB              -27.920     35.398  52.488  -0.789    0.434    
## ConditionC               19.030     35.805  51.432   0.531    0.597    
## SessionPost:ConditionB   33.055     49.144  53.234   0.673    0.504    
## SessionPost:ConditionC   -3.090     50.757  51.805  -0.061    0.952    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.252                            
## ConditionB  -0.495  0.468                     
## ConditionC  -0.481  0.463  0.529              
## SssnPst:CnB  0.340 -0.686 -0.701 -0.369       
## SssnPst:CnC  0.334 -0.657 -0.368 -0.695  0.524
#Actual Means
AM <- ggplot(df_long_pain_peak_toward %>% filter(Dose == "Low"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_pain_peak_toward %>% filter(Dose == "Low"), aes(x=Session,y=predict(MLM_P_PT_LD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM_LD,PM_LD)

8f. Variability Bias

-DV: Opioid Variability Bias (NON-CONVERGENCE PRESENT IN AT LEAST 1 MODEL)

re_O_V_LD <- lmer(RT ~ (1|Subject), data = df_long_opioid_variability %>% filter(Dose == "Low"))
re_O_V_HD <- lmer(RT ~ (1|Subject), data = df_long_opioid_variability %>% filter(Dose == "High"))

performance::icc(re_O_V_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.776
##   Conditional ICC: 0.776
performance::icc(re_O_V_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.827
##   Conditional ICC: 0.827
MLM_O_V_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_variability %>% filter(Dose == "Low"),
                   control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_V_LD) #non-convergence
## [1] TRUE
MLM_O_V_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_opioid_variability %>% filter(Dose == "High"))


#Multiple Degree-of-Freedom F-Tests
anova(MLM_O_V_HD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session             4.884   4.884     1 11.123  0.0216 0.8857
## Condition         183.934  91.967     2 25.837  0.4071 0.6698
## Session:Condition  66.589  33.294     2 28.069  0.1474 0.8636
#Means/SDs
df_long_opioid_variability %>% filter(Dose == "High") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          80.2  31.5
## 2 Post    A          88.7  56.0
## 3 Pre     B         100.   36.8
## 4 Post    B          91.1  31.9
## 5 Pre     C          99.1  39.2
## 6 Post    C          96.0  45.3
#Parameter Estimates
summary(MLM_O_V_HD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_opioid_variability %>% filter(Dose == "High")
## 
## REML criterion at convergence: 415.1
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.69102 -0.60651  0.04626  0.39193  2.38422 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 1175.6   34.29        
##           SessionPost  254.6   15.96    0.24
##  Residual              225.9   15.03        
## Number of obs: 50, groups:  Subject, 11
## 
## Fixed effects:
##                        Estimate Std. Error     df t value Pr(>|t|)    
## (Intercept)              91.173     12.314 15.913   7.404 1.54e-06 ***
## SessionPost               2.593     10.069 29.473   0.257    0.799    
## ConditionB                5.192      8.527 28.385   0.609    0.547    
## ConditionC                8.403      8.453 28.889   0.994    0.328    
## SessionPost:ConditionB   -4.687     11.555 28.771  -0.406    0.688    
## SessionPost:ConditionC   -6.010     11.272 30.126  -0.533    0.598    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.244                            
## ConditionB  -0.428  0.494                     
## ConditionC  -0.444  0.505  0.659              
## SssnPst:CnB  0.301 -0.661 -0.704 -0.452       
## SssnPst:CnC  0.308 -0.699 -0.452 -0.699  0.609
#Actual Means
AM <- ggplot(df_long_opioid_variability %>% filter(Dose == "High"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM <- ggplot(df_long_opioid_variability %>% filter(Dose == "High"), aes(x=Session,y=predict(MLM_O_V_HD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

cowplot::plot_grid(AM_HD,PM_HD)

-DV: Pain Variability Bias

re_P_V_LD <- lmer(RT ~ (1|Subject), data = df_long_pain_variability %>% filter(Dose == "Low"))
re_P_V_HD <- lmer(RT ~ (1|Subject), data = df_long_pain_variability %>% filter(Dose == "High"))

performance::icc(re_P_V_LD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.761
##   Conditional ICC: 0.761
performance::icc(re_P_V_HD)
## # Intraclass Correlation Coefficient
## 
##      Adjusted ICC: 0.889
##   Conditional ICC: 0.889
MLM_P_V_LD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_variability %>% filter(Dose == "Low"))
MLM_P_V_HD <- lmer(RT ~ Session*Condition + (1 + Session |Subject), data = df_long_pain_variability %>% filter(Dose == "High"))


#Multiple Degree-of-Freedom F-Tests
anova(MLM_P_V_LD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Session           174.37 174.371     1 13.149  0.3557 0.5610
## Condition         586.42 293.212     2 48.617  0.5982 0.5538
## Session:Condition 119.71  59.855     2 51.141  0.1221 0.8853
anova(MLM_P_V_HD, type = "III")
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
## Session           341.56  341.56     1  9.4895  1.7757 0.2138
## Condition         219.77  109.89     2 24.1668  0.5713 0.5722
## Session:Condition 203.66  101.83     2 27.0957  0.5294 0.5949
#Means/SDs
df_long_pain_variability %>% filter(Dose == "Low") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          94.4  52.4
## 2 Post    A          93.8  45.1
## 3 Pre     B          99.6  30.5
## 4 Post    B         101.   45.0
## 5 Pre     C          96.7  45.1
## 6 Post    C          96.2  57.0
df_long_pain_variability %>% filter(Dose == "High") %>% select(-Cue, -Bias_Type) %>% group_by(Session, Condition) %>% summarise(M = mean(RT), SD = sd(RT)) %>% arrange(Condition,Session)
## `summarise()` has grouped output by 'Session'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups:   Session [2]
##   Session Condition     M    SD
##   <fct>   <chr>     <dbl> <dbl>
## 1 Pre     A          78.5  26.6
## 2 Post    A          92.0  47.3
## 3 Pre     B          95.9  45.2
## 4 Post    B          91.9  41.4
## 5 Pre     C          98.1  49.5
## 6 Post    C         101.   54.2
#Parameter Estimates
summary(MLM_P_V_LD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_variability %>% filter(Dose == "Low")
## 
## REML criterion at convergence: 767.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5495 -0.5076 -0.1696  0.4355  2.7427 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 1427.4   37.78        
##           SessionPost  151.0   12.29    0.43
##  Residual              490.2   22.14        
## Number of obs: 84, groups:  Subject, 16
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)            98.08464   11.36428 23.35943   8.631    1e-08 ***
## SessionPost            -0.01073    9.28602 50.23042  -0.001    0.999    
## ConditionB             -1.77172    8.56859 50.73274  -0.207    0.837    
## ConditionC              3.55380    8.65490 49.64885   0.411    0.683    
## SessionPost:ConditionB  5.16185   11.85777 51.93351   0.435    0.665    
## SessionPost:ConditionC  5.23287   12.24614 50.34591   0.427    0.671    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.242                            
## ConditionB  -0.412  0.478                     
## ConditionC  -0.398  0.472  0.529              
## SssnPst:CnB  0.283 -0.698 -0.702 -0.370       
## SssnPst:CnC  0.278 -0.668 -0.369 -0.696  0.524
summary(MLM_P_V_HD)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RT ~ Session * Condition + (1 + Session | Subject)
##    Data: df_long_pain_variability %>% filter(Dose == "High")
## 
## REML criterion at convergence: 412
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.54854 -0.58499  0.05419  0.53893  1.79712 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr
##  Subject  (Intercept) 1719.1   41.46        
##           SessionPost  213.7   14.62    0.60
##  Residual              192.4   13.87        
## Number of obs: 50, groups:  Subject, 11
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)              89.816     13.922  13.525   6.452 1.79e-05 ***
## SessionPost              13.497      9.189  28.619   1.469    0.153    
## ConditionB                1.707      7.817  27.278   0.218    0.829    
## ConditionC                9.007      7.743  27.791   1.163    0.255    
## SessionPost:ConditionB   -5.752     10.569  27.973  -0.544    0.591    
## SessionPost:ConditionC  -10.532     10.276  29.629  -1.025    0.314    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SssnPs CndtnB CndtnC SsP:CB
## SessionPost -0.015                            
## ConditionB  -0.346  0.489                     
## ConditionC  -0.358  0.497  0.656              
## SssnPst:CnB  0.241 -0.659 -0.698 -0.443       
## SssnPst:CnC  0.246 -0.695 -0.443 -0.692  0.602
#Actual Means
AM_LD <- ggplot(df_long_pain_variability %>% filter(Dose == "Low"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))
AM_HD <- ggplot(df_long_pain_variability %>% filter(Dose == "High"), aes(x=Session,y=RT, col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))

#Predicted Means
PM_LD <- ggplot(df_long_pain_variability %>% filter(Dose == "Low"), aes(x=Session,y=predict(MLM_P_V_LD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))
PM_HD <- ggplot(df_long_pain_variability %>% filter(Dose == "High"), aes(x=Session,y=predict(MLM_P_V_HD), col = Condition)) +
  stat_summary(fun.data = "mean_cl_boot",position = position_dodge(width = .5)) + ggtitle("Group Means") +
  theme_light() +
  theme(plot.title = element_text(hjust = 0.5))


cowplot::plot_grid(AM_LD,PM_LD,AM_HD,PM_HD)