Interaction
dta_inter <- subset(dtalong,dtalong$Condition %in% c("ZY","nZ"))
dta_inter$Condition <- as.factor(dta_inter$Condition)
dta_ZY7_H <- subset(dta_inter,dta_inter$ZY7 >= mean(dta_inter$ZY7))
dta_ZY7_L <- subset(dta_inter,dta_inter$ZY7 < mean(dta_inter$ZY7))
dta_Neg_H <- subset(dta_inter,dta_inter$Negative >= mean(dta_inter$Negative))
dta_Neg_L <- subset(dta_inter,dta_inter$Negative < mean(dta_inter$Negative))
# dta_ZY7_H
t.test(value~Condition,paired = T,
data=subset(dta_ZY7_H,
dta_ZY7_H$Channel == "Ch1"))
Paired t-test
data: value by Condition
t = -1.4585, df = 10, p-value = 0.1754
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-8.408629 1.755512
sample estimates:
mean of the differences
-3.326558
t.test(value~Condition,paired=T,
data=subset(dta_ZY7_H,
dta_ZY7_H$Channel == "Ch2"))
Paired t-test
data: value by Condition
t = -1.0941, df = 10, p-value = 0.2996
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-5.276285 1.801087
sample estimates:
mean of the differences
-1.737599
t.test(value~Condition,paired=T,
data=subset(dta_ZY7_H,
dta_ZY7_H$Channel == "Ch3"))
Paired t-test
data: value by Condition
t = -0.72366, df = 10, p-value = 0.4859
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-4.292213 2.187675
sample estimates:
mean of the differences
-1.052269
t.test(value~Condition,paired=T,
data=subset(dta_ZY7_H,
dta_ZY7_H$Channel == "Ch4"))
Paired t-test
data: value by Condition
t = 0.37846, df = 9, p-value = 0.7139
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-3.501021 4.907832
sample estimates:
mean of the differences
0.7034052
# dta_ZY7_L
t.test(value~Condition,paired=T,
data=subset(dta_ZY7_L,
dta_ZY7_L$Channel == "Ch1"))
Paired t-test
data: value by Condition
t = -1.551, df = 8, p-value = 0.1595
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-3.7455292 0.7331806
sample estimates:
mean of the differences
-1.506174
t.test(value~Condition,paired=T,
data=subset(dta_ZY7_L,
dta_ZY7_L$Channel == "Ch2"))
Paired t-test
data: value by Condition
t = -0.53079, df = 8, p-value = 0.61
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-2.331368 1.458921
sample estimates:
mean of the differences
-0.4362235
t.test(value~Condition,paired=T,
data=subset(dta_ZY7_L,
dta_ZY7_L$Channel == "Ch3"))
Paired t-test
data: value by Condition
t = 0.055566, df = 8, p-value = 0.9571
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-2.431774 2.551861
sample estimates:
mean of the differences
0.06004345
t.test(value~Condition,paired=T,
data=subset(dta_ZY7_L,
dta_ZY7_L$Channel == "Ch4"))
Paired t-test
data: value by Condition
t = -2.4361, df = 7, p-value = 0.04502
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-5.39808263 -0.08036339
sample estimates:
mean of the differences
-2.739223
#dta_Neg_H
t.test(value~Condition,paired=T,
data=subset(dta_Neg_H,
dta_Neg_H$Channel == "Ch1"))
Paired t-test
data: value by Condition
t = -2.1752, df = 8, p-value = 0.06132
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-10.7116982 0.3126604
sample estimates:
mean of the differences
-5.199519
t.test(value~Condition,paired=T,
data=subset(dta_Neg_H,
dta_Neg_H$Channel == "Ch2"))
Paired t-test
data: value by Condition
t = -2.671, df = 8, p-value = 0.02832
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-7.0360105 -0.5159602
sample estimates:
mean of the differences
-3.775985
t.test(value~Condition,paired=T,
data=subset(dta_Neg_H,
dta_Neg_H$Channel == "Ch3"))
Paired t-test
data: value by Condition
t = -2.0632, df = 8, p-value = 0.073
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-4.7962622 0.2665823
sample estimates:
mean of the differences
-2.26484
t.test(value~Condition,paired=T,
data=subset(dta_Neg_H,
dta_Neg_H$Channel == "Ch4"))
Paired t-test
data: value by Condition
t = -2.0869, df = 6, p-value = 0.08195
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-8.7220719 0.6926218
sample estimates:
mean of the differences
-4.014725
#dta_Neg_L
t.test(value~Condition,paired=T,
data=subset(dta_Neg_L,
dta_Neg_L$Channel == "Ch1"))
Paired t-test
data: value by Condition
t = -0.28409, df = 10, p-value = 0.7821
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-2.694755 2.085293
sample estimates:
mean of the differences
-0.3047309
t.test(value~Condition,paired=T,
data=subset(dta_Neg_L,
dta_Neg_L$Channel == "Ch2"))
Paired t-test
data: value by Condition
t = 1.1823, df = 10, p-value = 0.2644
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.880113 2.869980
sample estimates:
mean of the differences
0.9949334
t.test(value~Condition,paired=T,
data=subset(dta_Neg_L,
dta_Neg_L$Channel == "Ch3"))
Paired t-test
data: value by Condition
t = 0.65013, df = 10, p-value = 0.5303
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-2.062935 3.762751
sample estimates:
mean of the differences
0.849908
t.test(value~Condition,paired=T,
data=subset(dta_Neg_L,
dta_Neg_L$Channel == "Ch4"))
Paired t-test
data: value by Condition
t = 0.98903, df = 10, p-value = 0.346
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-1.506091 3.910336
sample estimates:
mean of the differences
1.202122
dta_inter$Neg <- ifelse(dta_inter$Negative >= mean(dta_inter$Negative),"H","L")
dtaplot <- summarySE(dta_inter,measurevar = "value",
groupvars=c("variable","Channel","Condition","Neg"),na.rm=T)
dtaplot$Condition <- factor(dtaplot$Condition,levels=c("ZY","nZ"))
ggplot(dtaplot, aes(x=Neg, y=value,fill=Condition)) +
geom_bar(position=position_dodge(), stat="identity",width=.3) +
geom_errorbar(aes(ymin= value-se, ymax= value+se),
width=.1, # Width of the error bars
position=position_dodge(.3))+
#theme(axis.title.y = element_text(size = rel(2), angle = 90),
# axis.title.x = element_blank(),
# axis.text = element_text(size = rel(2)),
# legend.text = element_text(size = rel(2)),
# legend.title = element_text(size = rel(2)))+
facet_wrap(~Channel)+
theme_bw()+
labs(list(x="Negative Feeling",y = "Signal"))+
scale_fill_manual(values = c("grey30","grey"),labels=c("non-ZY","ZY"))
