Hello Everyone
I am running a mixed effect model using the LMER from the lmerTest package.
I have a 4 ( "Reward", "Punishment", "Control", "Neutral" ) by 3 ("High", "Middle", "Low") design, where aesthetic ratings are my independent variable.
Then I used contrast to determine specific effect. When I add specific contrast contrast comparing "Reward" with each other level. I get a non significant effect for the contrast Reward vs Control.
However, when I add contrasts comparing Control with each other level I get a significant effect of Control vs Reward.
Reward Contrasts
How is is it possible to get a significant effect in one case but not the other when I am comparing the same effects? Did I code something wrong???
Example code below
""""""""""""""""""""""""""""""""""""
library(dplyr)
library(ggpubr)
library(lmerTest)
library(emmeans)
library(broom)
library(ggplot2)
library(forcats)
import and arrange data
data <- read.csv('/Volumes/Projects/2021-0310-aesth-reward/Behaviorual_section/Statistical_analysis_R/Data/all_task-RatingBoth_beh.csv')
reorder factors
initial base order Reinforcement: Con, Aesthetic: High
data$Reinforcement =factor(data$Reinforcement, levels= c( "Rewa", "Pun", "Con", "Neu" ))
data$Aesthetic =factor(data$Aesthetic, levels= c( "Low", "Middle", "High"))
frequency data
table(data$Reinforcement)
table(data$Aesthetic, data$Reinforcement )
contrast
##Reward vs each
#reinContrast <- cbind(RewaVsPun = c(1, -1, 0, 0), RewaVsCon = c( 1, 0, -1, 0), RewaVsNeu =c(1, 0, 0, -1))
##Punishment vs each
#reinContrast <- cbind(PunVsRewa = c(-1, 1, 0, 0), PunVsCon = c( 0, 1, -1, 0), PunVsNeu =c(0, 1, 0, -1))
##Contorl vs each
reinContrast <- cbind(ConVsRewa = c(1, 0, -1, 0), ConVsPun = c( 0, -1, 1, 0), ConVsNeu =c(0, 0, 1, -1))
##Neutral vs each
#reinContrast <- cbind(NeuVsRewa = c(-1, 0, 0, 1), NeuVsPun = c( 0, -1, 0, 1), NeuVsCon =c(0, 0, -1, 1))
contrasts(data$Reinforcement) <- reinContrast
aestContrast <- cbind(LowVsHigh = c(-1, 0, 1), MiddelVsAll = c( 0.5, -1, 0.5)) #trying a different version
contrasts(data$Aesthetic) <- aestContrast
data_model = lmer(data$ScoreFinal ~ data$Aesthetic * data$Reinforcement + (1|data$Subject), data=data, REML=T)
#boxplot(data$ScoreFinal ~ data$Aesthetic * data$Reinforcement)
summary(data_model)
""""""""""""""""""""""""""""""""""""