<style type="text/css">
div.main-container {
max-width: 100%;
margin-left: auto;
margin-right: auto;
}
</style>
-Note: Large chunks of code have been hidden to improve readibility. -NOTE: Did some reading, this data is a particular type of MLM: “Cross-classified”. This means our level 1 units (i.e., RT observations) are clustered within two grouping variables (1 = Subject, 2 = Condition). Need to do a little more research on this. ## 1. Load Packages Used in Data Analysis -Code hidden
-Code hidden
length(df$Session[df$Subject == 56001 & df$Session == 1]) #160 rows ("trials") per part.
## [1] 160
dim(df) #21,440 total rows ("trials")
## [1] 21440 8
21440/160 #160 rows repeated 134 times
## [1] 134
df$Trial <- rep(seq(1:160), 134) #Code creates a sequence of 1-160, per participant per session, and stores this in the "Trial" variable
-The code below when run illustrates that there are no administrations #With <50% accuracy. Nothing excluded here.
df %>%
group_by(Subject, Session, Cue) %>%
summarise(Percent_Accurate = mean(Accuracy)) %>%
filter(Percent_Accurate < 0.50)
## `summarise()` has grouped output by 'Subject', 'Session'. You can override
## using the `.groups` argument.
## # A tibble: 0 × 4
## # Groups: Subject, Session [0]
## # … with 4 variables: Subject <dbl>, Session <fct>, Cue <fct>,
## # Percent_Accurate <dbl>
-The code below indicates the overall # of trials and the counts/percents for 1) incorrect trials to be excluded, and 2) improbable reaction time trials (i.e., <200ms OR >1500ms) to be excluded. The code immediately following then excludes this data.
df %>%
group_by(Session) %>%
summarise(Overall_Trials = n(), #Overall trial counts
Count_Inc_Trial = sum(ifelse(Accuracy == 0,1,0)), #Incorrect trial count
Per_Inc_Trial = 1 - mean(Accuracy), #Percent of trials that are incorrect
Count_Inc_RT = sum(ifelse(RT < 200 | RT > 1500, 1, 0)),
#Count of trials whose reaction times are < 200 or > 1500
Per_Inc_RT = 1 - mean(ifelse(RT < 200 | RT > 1500, 0, 1)))
## # A tibble: 6 × 6
## Session Overall_Trials Count_Inc_Trial Per_Inc_Trial Count_Inc_RT Per_Inc_RT
## <fct> <int> <dbl> <dbl> <dbl> <dbl>
## 1 1 4160 84 0.0202 79 0.0190
## 2 2 4160 161 0.0387 80 0.0192
## 3 3 3680 60 0.0163 70 0.0190
## 4 4 3680 82 0.0223 62 0.0168
## 5 5 2880 71 0.0247 69 0.0240
## 6 6 2880 74 0.0257 90 0.0312
-Filtering out improbable reaction times
df <- df %>%
filter(Accuracy == 1) %>% #Exclude incorrect trials
filter(RT > 200 & RT < 1500) #Exclude RT's <200ms or >1500ms
-Maximum & Minimum RT after exclusions
max(df$RT)
## [1] 1499
min(df$RT)
## [1] 207
-Code for Median Absolute Deviation and SD calculations for Reaction Times hidden
-MAD & SD Calculation Results
df %>%
group_by(Session) %>%
summarise(Ovr_Trl_Aftr_Exc = n(), #Overall trial counts after excluding for above-noted criteria
Count_MAD3_Over = sum(ifelse(RT > MAD_Exclude_Score, 1,0)), #Count of trials that had RT > 3MAD above individual median
Per_MAD3_Over = mean(ifelse(RT > MAD_Exclude_Score, 1, 0)),
Count_SD3_Over = sum(ifelse(RT > SD_Exclude_Score, 1,0)), #Count of trials that had RT > 3MAD above individual median
Per_SD3_Over = mean(ifelse(RT > SD_Exclude_Score, 1, 0)))
## # A tibble: 6 × 6
## Session Ovr_Trl_Aftr_Exc Count_MAD3_Over Per_MAD3_Over Count_SD3_Over Per_SD…¹
## <fct> <int> <dbl> <dbl> <dbl> <dbl>
## 1 1 4005 205 0.0512 79 0.0197
## 2 2 3931 138 0.0351 54 0.0137
## 3 3 3551 115 0.0324 47 0.0132
## 4 4 3538 119 0.0336 50 0.0141
## 5 5 2746 114 0.0415 54 0.0197
## 6 6 2725 128 0.0470 52 0.0191
## # … with abbreviated variable name ¹Per_SD3_Over
-Excluding Folks based on SD for Reaction Times
df <- df %>%
filter(RT < SD_Exclude_Score) #Exclude folks whose RT are >3SD above their individual means
df %>% select(RT, Condition, Session, Cue) %>% group_by(Condition, Session, Cue) %>%
summarise(across(everything(), list(mean = mean, sd = sd, min = min, max = max)))
## `summarise()` has grouped output by 'Condition', 'Session'. You can override
## using the `.groups` argument.
## # A tibble: 36 × 7
## # Groups: Condition, Session [18]
## Condition Session Cue RT_mean RT_sd RT_min RT_max
## <chr> <fct> <fct> <dbl> <dbl> <dbl> <dbl>
## 1 A 1 opioid 623. 210. 339 1447
## 2 A 1 pain 635. 213. 317 1440
## 3 A 2 opioid 580. 144. 207 1295
## 4 A 2 pain 576. 151. 367 1356
## 5 A 3 opioid 557. 125. 207 1167
## 6 A 3 pain 562. 133. 312 1316
## 7 A 4 opioid 551. 140. 342 1348
## 8 A 4 pain 552. 144. 328 1241
## 9 A 5 opioid 536. 141. 301 1217
## 10 A 5 pain 534. 137. 322 1219
## # … with 26 more rows
-Code for AB calculations hidden
-Attentional Bias Metrics Per Subject, Condition, Session, & Cue
By_Subject_Output
## # A tibble: 268 × 10
## # Groups: Subject, Condition, Session [134]
## Subject Condi…¹ Session Cue Mean_…² Mean_…³ Mean_…⁴ Peak_…⁵ Peak_…⁶ Varia…⁷
## <dbl> <chr> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 56001 C 1 opio… 6.24 97.9 103. 442 203 82.1
## 2 56001 C 1 pain 33.2 139. 61.2 429 226 76.5
## 3 56001 C 2 opio… 12.3 114. 110. 402 296 87.9
## 4 56001 C 2 pain 0.776 100. 107. 380 287 76.7
## 5 56001 A 3 opio… 22.9 115. 113. 350 528 101.
## 6 56001 A 3 pain 4.97 65.3 89.6 228 228 74.2
## 7 56001 A 4 opio… -39.8 82.1 106. 240 347 73.7
## 8 56001 A 4 pain 1.86 75.7 101. 326 486 80.2
## 9 56001 B 5 opio… -0.504 88.8 65.7 251 178 64.5
## 10 56001 B 5 pain 9.94 110. 52.1 305 289 79.9
## # … with 258 more rows, and abbreviated variable names ¹Condition, ²Mean_Bias,
## # ³Mean_Toward, ⁴Mean_Away, ⁵Peak_Toward, ⁶Peak_Away, ⁷Variability
By_Condition_Output
## # A tibble: 36 × 9
## # Groups: Condition, Session [18]
## Condition Session Cue Mean_Bias Mean_Tow…¹ Mean_…² Peak_…³ Peak_…⁴ Varia…⁵
## <chr> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 A 1 opioid -4.88 112. 117. 323. 317. 92.8
## 2 A 1 pain 1.90 117. 125. 400. 353. 98.4
## 3 B 1 opioid -3.52 95.1 90.3 318. 313. 89.7
## 4 B 1 pain 6.39 84.6 90.5 292. 290. 81.8
## 5 C 1 opioid -9.58 119. 128. 364. 367. 104.
## 6 C 1 pain 5.10 130. 118. 396. 386. 107.
## 7 A 2 opioid 20.0 102. 96.6 317. 329. 89.9
## 8 A 2 pain -10.2 93.9 105. 354. 341. 89.9
## 9 B 2 opioid 3.00 106. 109. 406. 331. 86.2
## 10 B 2 pain 28.8 117. 96.1 364. 299. 94.3
## # … with 26 more rows, and abbreviated variable names ¹Mean_Toward, ²Mean_Away,
## # ³Peak_Toward, ⁴Peak_Away, ⁵Variability
By_Session_Output
## # A tibble: 12 × 8
## # Groups: Session [6]
## Session Cue Mean_Bias Mean_Toward Mean_Away Peak_Toward Peak_Away Variab…¹
## <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 opioid -6.27 109. 113. 337. 335. 96.2
## 2 1 pain 4.50 113. 112. 366. 347. 96.9
## 3 2 opioid 1.82 108. 110. 357. 341. 93.2
## 4 2 pain 6.25 110. 112. 359. 342. 96.2
## 5 3 opioid -0.233 111. 108. 373. 364. 94.1
## 6 3 pain -4.52 105. 111. 338. 353. 94.5
## 7 4 opioid 4.76 111. 110. 377. 352. 93.3
## 8 4 pain 2.01 110. 106. 343. 362. 96.2
## 9 5 opioid -3.19 106. 105. 324. 348. 92.1
## 10 5 pain -13.3 103. 107. 326. 342. 90.4
## 11 6 opioid -3.74 105. 110. 335. 329. 96.1
## 12 6 pain -12.3 106. 116. 313. 348. 91.9
## # … with abbreviated variable name ¹Variability
By_Cue_Output
## # A tibble: 2 × 7
## Cue Mean_Bias Mean_Toward Mean_Away Peak_Toward Peak_Away Variability
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 opioid -1.01 108. 110. 352. 345. 94.2
## 2 pain -1.76 108. 111. 343. 349. 94.7
-Code Hidden -Changing session variable to represent just pre-post
-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 seems to be dropping these folks from ANOVA analysis below. I’m trying to specify a way for them to be kept and not succeeding at the moment, but even if I can, that still is going to result with at least 13/28 getting dropped. A REALLY small sample of N=15 at best or N=12 at worst.
df$Dose <- ifelse(df$Subject == "56001" | df$Subject == "56002"| df$Subject == "56005"| df$Subject == "56006" | df$Subject == "56009"| df$Subject == "56010"| df$Subject == "56014"| df$Subject == "56016"| df$Subject == "56018"| df$Subject == "56019"| df$Subject == "56020"| df$Subject == "56021"| df$Subject == "56022"| df$Subject == "56023"| df$Subject == "56026"| df$Subject == "56027", "Low", "High")
df$Dose[df$Subject == "56024"] <- "Not randomized"
table(df$Dose)
##
## High Low
## 7607 12553
-Changing Data into Long Format
df_long <- df %>% select(Subject, Dose, Condition, Session, Cue, mean_bias:variability) %>%
pivot_longer(cols = c(mean_bias:variability), names_to = "Bias_Type", values_to = "RT") %>%
mutate(Subject = factor(Subject)) %>%
distinct()
dim(df_long) #Dataframe dimensions
## [1] 1608 7
# Number of RT's each participant contributes to the dataframe
table(df_long$Subject)
##
## 56001 56002 56003 56004 56005 56006 56007 56008 56009 56010 56011 56012 56013
## 72 60 36 72 72 72 72 72 72 72 48 72 24
## 56014 56015 56016 56017 56018 56019 56020 56021 56022 56023 56025 56026 56027
## 36 60 72 24 24 72 72 72 48 48 72 72 72
## 56028
## 48
data.frame(table(df_long$Subject)) %>% summarise(Min = min(Freq), Max = max(Freq))
## Min Max
## 1 24 72
-DV: Opioid Mean Bias
-DV: Pain Mean Bias
-DV: Opioid Mean Away Bias
-DV: Pain Mean Away Bias
-DV: Opioid Mean Toward Bias
-DV: Pain Mean Toward Bias
-DV: Opioid Peak Away Bias
-DV: Pain Peak Away Bias
-DV: Opioid Peak Toward Bias
-DV: Pain Peak Toward Bias
-DV: Opioid Variability Bias
-DV: Pain Variability 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
emmeans::emmeans(MLM_O_MB_LD, specs = c("Session", "Condition"))
## Session Condition emmean SE df lower.CL upper.CL
## Pre A -5.89 9.56 38.7 -25.2 13.4
## Post A 2.14 7.96 52.4 -13.8 18.1
## Pre B 4.64 8.99 34.8 -13.6 22.9
## Post B -2.23 7.13 50.2 -16.5 12.1
## Pre C -8.76 9.27 36.5 -27.6 10.0
## Post C 4.48 7.96 52.4 -11.5 20.5
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
emmeans::emmeans(MLM_O_MB_HD, specs = c("Session", "Condition"))
## Session Condition emmean SE df lower.CL upper.CL
## Pre A 2.21 10.72 31.2 -19.6 24.06
## Post A 11.88 11.19 27.1 -11.1 34.83
## Pre B 5.72 8.51 29.6 -11.7 23.11
## Post B 6.27 10.52 25.1 -15.4 27.94
## Pre C -10.23 8.02 29.1 -26.6 6.18
## Post C -7.19 9.42 22.1 -26.7 12.35
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
#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
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
-DV: Opioid Mean Away Bias
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-Freedome 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
emmeans::emmeans(MLM_O_MA_HD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 115 18.2 Inf 79.0 150
## Post A 104 19.3 Inf 66.6 142
## Pre B 110 16.5 Inf 77.8 142
## Post B 111 18.8 Inf 74.6 148
## Pre C 115 16.1 Inf 84.0 147
## Post C 111 18.0 Inf 75.9 146
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
#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
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-Freedome 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
emmeans::emmeans(MLM_P_MA_HD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 109 18.6 Inf 72.4 145
## Post A 137 25.0 Inf 88.2 186
## Pre B 113 17.3 Inf 78.9 147
## Post B 109 24.7 Inf 60.2 157
## Pre C 108 17.1 Inf 74.9 142
## Post C 118 24.1 Inf 70.2 165
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
#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)
-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"))
MLM_O_MT_3_Way <- lmer(RT ~ Session*Condition*Dose + (1 + Session |Subject), data = df_long_opioid_mean_toward,
control = lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))
## boundary (singular) fit: see help('isSingular')
isSingular(MLM_O_MT_3_Way)
## [1] TRUE
#Multiple Degree-of-Freedome 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
emmeans::emmeans(MLM_O_MT_HD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 98.7 14.7 Inf 69.9 128
## Post A 122.8 16.9 Inf 89.6 156
## Pre B 115.9 14.0 Inf 88.4 143
## Post B 113.9 16.7 Inf 81.1 147
## Pre C 113.6 13.9 Inf 86.4 141
## Post C 106.8 16.5 Inf 74.5 139
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
#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
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-Freedome 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
emmeans::emmeans(MLM_P_MT_LD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 112 11.7 Inf 89.5 135
## Post A 105 15.0 Inf 75.6 134
## Pre B 105 11.3 Inf 83.4 128
## Post B 117 14.5 Inf 88.2 145
## Pre C 110 11.5 Inf 87.8 133
## Post C 125 15.0 Inf 95.7 155
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
#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)
-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-Freedome 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.
emmeans::emmeans(MLM_O_PA_HD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 320 54.4 Inf 213 427
## Post A 277 56.0 Inf 167 387
## Pre B 392 49.1 Inf 296 488
## Post B 337 54.4 Inf 230 444
## Pre C 340 47.9 Inf 246 434
## Post C 310 51.8 Inf 208 411
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
#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-Freedome 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.
emmeans::emmeans(MLM_P_PA_LD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 369 44.4 Inf 282 456
## Post A 378 46.0 Inf 288 468
## Pre B 358 43.0 Inf 274 442
## Post B 387 44.1 Inf 301 474
## Pre C 369 43.7 Inf 284 455
## Post C 352 46.0 Inf 262 442
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
emmeans::emmeans(MLM_P_PA_HD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 303 61.0 Inf 184 423
## Post A 400 67.5 Inf 268 533
## Pre B 330 55.5 Inf 221 438
## Post B 313 65.8 Inf 184 442
## Pre C 355 54.3 Inf 248 461
## Post C 364 63.3 Inf 240 488
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
#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)
-DV: Opioid Peak Toward Bias
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
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-Freedome 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.
emmeans::emmeans(MLM_O_PT_LD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 328 43.5 Inf 243 413
## Post A 375 49.5 Inf 278 472
## Pre B 348 41.8 Inf 266 430
## Post B 382 47.3 Inf 289 474
## Pre C 374 42.7 Inf 291 458
## Post C 392 49.5 Inf 294 489
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
#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)
-DV: Opioid Variability Bias
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-Freedome 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
emmeans::emmeans(MLM_O_V_HD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 91.2 12.3 Inf 67.0 115
## Post A 93.8 13.9 Inf 66.6 121
## Pre B 96.4 11.6 Inf 73.6 119
## Post B 94.3 13.7 Inf 67.5 121
## Pre C 99.6 11.4 Inf 77.2 122
## Post C 96.2 13.3 Inf 70.0 122
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
#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-Freedome 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
emmeans::emmeans(MLM_P_V_LD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 98.1 11.4 Inf 75.8 120
## Post A 98.1 12.8 Inf 73.0 123
## Pre B 96.3 11.1 Inf 74.6 118
## Post B 101.5 12.4 Inf 77.1 126
## Pre C 101.6 11.2 Inf 79.7 124
## Post C 106.9 12.8 Inf 81.7 132
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
emmeans::emmeans(MLM_P_V_HD, specs = c("Session", "Condition"), lmer.df = "asymp")
## Session Condition emmean SE df asymp.LCL asymp.UCL
## Pre A 89.8 13.9 Inf 62.5 117
## Post A 103.3 16.6 Inf 70.8 136
## Pre B 91.5 13.4 Inf 65.3 118
## Post B 99.3 16.4 Inf 67.1 131
## Pre C 98.8 13.3 Inf 72.8 125
## Post C 101.8 16.2 Inf 70.0 134
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
#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)