Please let us know if you notice any error at Celine.Coutrix (at) imag.fr
Data corresponding to this code
geom_mean <- function(x, na.rm=TRUE){
return(10^mean(log10(x), na.rm=TRUE))
}
ci <- function(x) {
nb = length(x)
icp = mean(x, na.rm=TRUE) + 1.96 * sd(x) / sqrt(nb)
icm = mean(x, na.rm=TRUE) - 1.96 * sd(x) / sqrt(nb)
return(c(icm, icp))
}
data <- data.frame()
p <- "../data/SizeOrientationLogs/"
files <- list.files(path=p, pattern="*.csv")
for(file in files)
{
df <- read.csv(paste(p, file, sep='/'), sep=";")
data <- rbind(data, df)
}
We assign now the right type to variables, make naming more explicit, splitting LengthOrientation into two column – one for each variable
data$Participant <- as.factor(data$Participant)
data$Overshoot <- as.numeric(data$Overshoot)
data$MovementTime <- as.numeric(data$MovementTime)
levels(data$Position) <- c("Down", "Up")
data <- within(data, {
Length <- substr(LengthOrientation, 1, 5)
Orientation <- substr(LengthOrientation, 7, 499)
})
data$Length <- as.factor(data$Length)
data$Orientation <- as.factor(data$Orientation)
table(data$Participant, data$Grasp)
##
## 1H 2H
## 1 64 64
## 2 64 64
## 3 64 64
## 4 64 64
## 5 64 64
## 6 64 64
## 7 64 64
## 8 64 64
## 9 64 64
## 10 64 64
table(data$Participant, data$LengthOrientation)
##
## large-tilted large-vertical small-tilted small-vertical
## 1 32 32 32 32
## 2 32 32 32 32
## 3 32 32 32 32
## 4 32 32 32 32
## 5 32 32 32 32
## 6 32 32 32 32
## 7 32 32 32 32
## 8 32 32 32 32
## 9 32 32 32 32
## 10 32 32 32 32
table(data$Participant, data$Position)
##
## Down Up
## 1 64 64
## 2 64 64
## 3 64 64
## 4 64 64
## 5 64 64
## 6 64 64
## 7 64 64
## 8 64 64
## 9 64 64
## 10 64 64
table(data$Participant, data$Repetition)
##
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## 1 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
## 2 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
## 3 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
## 4 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
## 5 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
## 6 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
## 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
## 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
## 9 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
## 10 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
dataAggMT <- aggregate(data$MovementTime,
by=list(data$Participant, data$Length, data$Orientation, data$Grasp, data$Position),
FUN=geom_mean)
colnames(dataAggMT) <- c("Participant", "Length", "Orientation", "Grasp", "Position", "MovementTime")
dataAggO <- aggregate(data$Overshoot,
by=list(data$Participant, data$Length, data$Orientation, data$Grasp, data$Position),
FUN=sum)
colnames(dataAggO) <- c("Participant", "Length", "Orientation", "Grasp", "Position", "Overshoot")
dataAggMT$Mixed <- paste(dataAggMT$Length, dataAggMT$Orientation, sep="-")
library("sciplot")
p <- lineplot.CI(x.factor = dataAggMT$Mixed,
dataAggMT$MovementTime,
group=dataAggMT$Grasp,
type="p",
err.width=0,
ci.fun= ci,
xlab="Conditions",
ylab="Mean Movement Time (s)",
pch = c(18,16,15),
ylim=range(0,2.5))
grid (NA, NULL, lty = 6, col = "cornsilk2")
p
## $vals
## 1H 2H
## large-tilted 1.305188 1.274173
## large-vertical 1.343233 1.306857
## small-tilted 1.867981 1.591435
## small-vertical 1.773250 1.438768
##
## $CI
## 1H 2H
## large-tilted Numeric,2 Numeric,2
## large-vertical Numeric,2 Numeric,2
## small-tilted Numeric,2 Numeric,2
## small-vertical Numeric,2 Numeric,2
library("sciplot")
dataAggO$Mixed <- paste(dataAggO$Length, dataAggO$Orientation, sep="-")
p <- lineplot.CI(x.factor = dataAggO$Mixed,
dataAggO$Overshoot,
group=dataAggO$Grasp,
type="p",
err.width=0,
ci.fun= ci,
xlab="Conditions",
ylab="Number of overshoots",
pch = c(18,16,15),
ylim=range(0,15))
grid (NA, NULL, lty = 6, col = "cornsilk2")
p
## $vals
## 1H 2H
## large-tilted 0.80 1.25
## large-vertical 0.35 0.60
## small-tilted 4.80 3.50
## small-vertical 3.95 3.70
##
## $CI
## 1H 2H
## large-tilted Numeric,2 Numeric,2
## large-vertical Numeric,2 Numeric,2
## small-tilted Numeric,2 Numeric,2
## small-vertical Numeric,2 Numeric,2
hist(dataAggMT$MovementTime, breaks=seq(0,max(dataAggMT$MovementTime)+1,0.5))
qqnorm(dataAggMT$MovementTime)
qqline(dataAggMT$MovementTime)
shapiro.test(dataAggMT$MovementTime)
##
## Shapiro-Wilk normality test
##
## data: dataAggMT$MovementTime
## W = 0.97024, p-value = 0.00158
Normality of Movement Time cannot be assumed.
For each independant variable
bartlett.test(MovementTime~Length, dataAggMT)
##
## Bartlett test of homogeneity of variances
##
## data: MovementTime by Length
## Bartlett's K-squared = 13.323, df = 1, p-value = 0.0002622
bartlett.test(MovementTime~Orientation, dataAggMT)
##
## Bartlett test of homogeneity of variances
##
## data: MovementTime by Orientation
## Bartlett's K-squared = 0.012641, df = 1, p-value = 0.9105
bartlett.test(MovementTime~Grasp, dataAggMT)
##
## Bartlett test of homogeneity of variances
##
## data: MovementTime by Grasp
## Bartlett's K-squared = 0.0069136, df = 1, p-value = 0.9337
Variances cannot be considered equal for Length, but it can for Orientation and Grasp.
We further analyze Length, as it seems to cause an important difference in the previous graphs.
dataTest <- aggregate(data$MovementTime,
by=list(data$Participant, data$Length),
FUN=geom_mean)
colnames(dataTest) <- c("Participant", "Length", "MovementTime")
dataTest <- cbind(dataTest[dataTest$Length=='small',]$MovementTime, dataTest[dataTest$Length=='large',]$MovementTime)
friedman.test(dataTest)
##
## Friedman rank sum test
##
## data: dataTest
## Friedman chi-squared = 10, df = 1, p-value = 0.001565
There is indeed a significant impact of Length on Movement Time.
From the graph, it seems that there is an interaction between Length and Orientation. We first analyze movement time for small sliders, and then for large sliders.
dataTest <- aggregate(data[data$Length=='small',]$MovementTime,
by=list(data[data$Length=='small',]$Participant, data[data$Length=='small',]$Orientation),
FUN=geom_mean)
colnames(dataTest) <- c("Participant", "Orientation", "MovementTime")
pairwise.wilcox.test(dataTest$MovementTime, dataTest$Orientation, p.adj="bonferroni", exact=F, paired=T)
##
## Pairwise comparisons using Wilcoxon signed rank test
##
## data: dataTest$MovementTime and dataTest$Orientation
##
## tilted
## vertical 0.041
##
## P value adjustment method: bonferroni
There is a significant impact of orientation on movement time for small sldiers.
dataTest <- aggregate(data[data$Length=='large',]$MovementTime,
by=list(data[data$Length=='large',]$Participant, data[data$Length=='large',]$Orientation),
FUN=geom_mean)
colnames(dataTest) <- c("Participant", "Orientation", "MovementTime")
pairwise.wilcox.test(dataTest$MovementTime, dataTest$Orientation, p.adj="bonferroni", exact=F, paired=T)
##
## Pairwise comparisons using Wilcoxon signed rank test
##
## data: dataTest$MovementTime and dataTest$Orientation
##
## tilted
## vertical 0.54
##
## P value adjustment method: bonferroni
There is no significant impact of orientation on movement time for large sliders.