Mikkel Astrup
Mikkel Astrup

Reputation: 415

TukeyHSD specific conditions

Im trying to get an TukeyHSD to run in R, my code looks like this:

#----------------------------------------------------------------------------------------#
# RING data:
#----------------------------------------------------------------------------------------#
library(doBy)
# Set working directory
setwd("")

#### Read data & Converting factors ####
dat <- read.table("afstand.txt", header =TRUE)  
str(dat)
dat$Vial <- as.factor(dat$Vial)
dat$Line <- as.factor(dat$Line)
dat$Fly <- as.factor(dat$Fly)  
dat$Temp <- as.factor(dat$Temp)
str(dat)

datSUM <- summaryBy(X0.5_sec+X1_sec+X1.5_sec+X2_sec+X2.5_sec+X3_sec~Vial_nr+Concentration+Sex+Line+Vial+Temp,data=dat, FUN=sum)
fl<-levels(datSUM$Line)
aov1 <- aov(X0.5_sec.sum ~ Concentration*Sex*Line*Temp, data=datSUM)
summary(aov1) #Overview of model 
TukeyHSD(aov1, 'Line',ordered = TRUE, conf.level = 0.95)

What I would like to do is look at interactions between Line and Temp for instance, but if I run TukeyHSD(aov1) then i get ALL the interactions, resulting in this error: [ reached getOption("max.print") -- omitted 3716 rows ] Is there a way where i can specify that i wanna test only between Line and Temp and not all combinations, or a way of showing only significant results if I just run TukeyHSD(avo1)? I have tried using TukeyHSD(aov1, 'Line,Temp',ordered = TRUE, conf.level = 0.95) , TukeyHSD(aov1, 'Line':'Temp',ordered = TRUE, conf.level = 0.95) and TukeyHSD(aov1, 'Line'&'Temp',ordered = TRUE, conf.level = 0.95) but with no luck.

structure(list(Concentration = structure(c(2L, 7L, 7L, 1L, 7L, 
1L, 2L, 1L, 7L, 1L, 4L, 2L, 2L, 1L, 2L, 4L, 7L, 2L, 2L, 1L), .Label = c("a", 
"b", "c", "d", "e", "x", "y"), class = "factor"), Sex = structure(c(1L, 
2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 
1L, 2L, 1L), .Label = c("f", "m"), class = "factor"), Line = structure(c(3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 
3L, 3L, 3L), .Label = c("20", "23", "40", "73"), class = "factor"), 
    Temp = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L), .Label = c("23", 
    "29"), class = "factor"), X0.5_sec.sum = c(107.19, 46.17, 
    58.05, 75.87, 87.75, 71.55, 46.17, 47.25, 22.41, 31.05, 27.36, 
    79.11, 87.58, 21.33, 34.29, 60.4, 85.05, 72.47, 114.21, 67.77
    )), .Names = c("Concentration", "Sex", "Line", "Temp", "X0.5_sec.sum"
), row.names = c(NA, 20L), class = "data.frame")

Upvotes: 1

Views: 418

Answers (1)

abel
abel

Reputation: 490

To only show interactions between variables Line and Temp, you can specify the argument whichas follows:

which = 'Line:Temp'

which then turns your complete function call to TukeyHSDinto:

TukeyHSD(aov1, 'Line:Temp', ordered = TRUE, conf.level = 0.95)

Upvotes: 1

Related Questions