我的对比似乎没有坚持......?

时间:2016-05-15 18:49:10

标签: r anova

我前一段时间问了一个问题,但是我试图修改它以便稍微简洁一些。我试图运行一些对比,但每当我尝试运行对比时,它似乎没有坚持。我想知道这是否与我的conditionfactor有关?有人能帮助我吗?

connection <- "C:/Users/Aiden/Downloads/FinalData.csv"

rawdat <- read.csv(connection, skip=2, header=F, sep=",")

# rawdat2 <- read.csv(connection) #not run; read_csv() is faster
rawdat3 <- read_csv(connection) 
#some variable names might contain brackets or plus signs. replace with dots
names(rawdat3) <- gsub("\\(|\\)|\\+", "\\.", names(rawdat3))
names(rawdat) <- names(rawdat3); rm(rawdat3) 
data <- rawdat #original dataset without reversing reverse coded items

###########################################################################
#Beginning analysis
#Finding those who passed the manipulation check and creating groups
#happy
happy <- filter(data, condition == 'happy', Q1_1 > 3)

#sadness
sadness <- filter(data, condition == 'sad', Q1_2 > 3)

#angry
angry <- filter(data, condition == 'angry', Q1_7 > 3)


#neutral 
neutral <- filter(data, condition == 'neutral', Q1_6 > 3)

data <- rbind(happy,sadness,angry,neutral)
conditionfactor <- as.factor(data$condition)
data <- cbind(data, conditionfactor)

#########################################################################

model <- aov(Competent ~ condition, data =data)
c1 <- c(0,-1,0,1)
c2 <- c(-1,0,0,1)
c3 <- c(0,0,-1,1)
comps <- cbind(c1,c2,c3)
contrasts(data$conditionfactor)= comps
summary(model)

结果:

             Df Sum Sq Mean Sq F value  Pr(>F)   
condition     3  15.34   5.115   4.754 0.00353 **
Residuals   130 139.88   1.076    

正如您所看到的,虽然不会导致任何错误,但对比似乎没有效果?

0 个答案:

没有答案