J. Jung and Y.J. Ahn (2018). “Effects of interface on procedural skill transfer in virtual training: Lifeboat launching operation study,” Comput Anim VirtualWorlds. 2018;29:e1812..
vt <- read.csv("http://users.stat.ufl.edu/~winner/data/virtual_training.csv")
attach(vt); names(vt)
## [1] "grp.trt" "procKnow"
plot(procKnow ~ grp.trt, main="Procedure Knowledge by Training Method",
pch=16, xlim=c(0,5), ylim=c(0,10), col="darkgreen", cex=0.75)
lines(c(0.5, 4.5), c(mean(procKnow),mean(procKnow)), col="red", lwd=2)
for (i in 1:length(unique(grp.trt))) {
lines(c(i-0.2,i+0.2),
c(mean(procKnow[grp.trt==i]),mean(procKnow[grp.trt==i])),
col="blue", lwd=2)
}
grp.trt <- factor(grp.trt, levels=1:4,
labels=c("LEC/MAT","MON/KEY","HMD/JOY","HMD/WEA"))
n.trt <- as.vector(tapply(procKnow, grp.trt, length))
mean.trt <- as.vector(tapply(procKnow, grp.trt, mean))
sd.trt <- as.vector(tapply(procKnow, grp.trt, sd))
mean.all <- mean(procKnow)
summary.out <- cbind(n.trt, mean.trt, sd.trt)
colnames(summary.out) <- c("n", "Mean", "Std. Dev.")
rownames(summary.out) <- c("LEC/MAT","MON/KEY","HMD/JOY","HMD/WEA")
round(summary.out, 3)
## n Mean Std. Dev.
## LEC/MAT 16 4.931 1.94
## MON/KEY 16 7.708 1.43
## HMD/JOY 16 6.736 2.82
## HMD/WEA 16 6.875 1.99
r <- length(n.trt)
n_T <- sum(n.trt)
SSTR <- sum(n.trt * (mean.trt - mean.all)^2); dfTR <- r-1
SSE <- sum((n.trt-1) * sd.trt^2); dfE <- n_T-r
SSTO <- SSTR + SSE; dfTO <- dfTR+dfE
MSTR <- SSTR / dfTR
MSE <- SSE / dfE
F.star <- MSTR / MSE
pF <- 1 - pf(F.star, dfTR, dfE)
## Set-up output
df <- rbind(dfTR, dfE, dfTO)
SS <- rbind(SSTR, SSE, SSTO)
MS <- rbind(MSTR, MSE, NA)
F <- rbind(F.star,NA,NA)
F.95 <- rbind(qf(.95,dfTR,dfE),NA,NA)
pF <- rbind(pF,NA,NA)
anova.out <- cbind(df,SS,MS,F,F.95,pF)
colnames(anova.out) <- c("df","SS","MS","F.star","F(.95)","P(>F)")
rownames(anova.out) <- c("Treatment", "Error", "Total")
round(anova.out, 4)
## df SS MS F.star F(.95) P(>F)
## Treatment 3 65.6639 21.8880 4.9406 2.7581 0.0039
## Error 60 265.8149 4.4302 NA NA NA
## Total 63 331.4788 NA NA NA NA
### Setting up r-1 = 3 Orthogonal contrasts
## Trt 1: Lecture/Reading Materials (LEC/MAT)
## Trt 2: Monitor/Keyboard (MON/KEY)
## Trt 3: Head-Mounted Display/Joypad (HMD/JOY)
## Trt 4: Head-Mounted Display/Wearable Sensors (HMD/WEA)
## Contrast 1: Traditional (1) vs Virtual (2,3,4)
## 3*mu1 - mu2 - mu3 - mu4
a.coef <- c(3, -1, -1, -1)
L.hat_1 <- sum(a.coef * mean.trt)
SSL_1 <- L.hat_1^2 / sum(a.coef^2 / n.trt)
FL_1 <- SSL_1 / MSE
pL_1 <- 1 - pf(FL_1, 1, dfE)
F.95_1 <- qf(.95,1,dfE)
## Contrast 2: Monitor/Keyboard (2) vs Head-Mounted Display (3,4)
## 2*mu2 - mu3 - mu4
b.coef <- c(0, 2, -1, -1)
L.hat_2 <- sum(b.coef * mean.trt)
SSL_2 <- L.hat_2^2 / sum(b.coef^2 / n.trt)
FL_2 <- SSL_2 / MSE
pL_2 <- 1 - pf(FL_2, 1, dfE)
F.95_2 <- qf(.95,1,dfE)
## Contrast 3: HMD/Joypad (3) vs Head-Mounted Display/Wearables (4)
## mu3 - mu4
d.coef <- c(0, 0, 1, -1)
L.hat_3 <- sum(d.coef * mean.trt)
SSL_3 <- L.hat_3^2 / sum(d.coef^2 / n.trt)
FL_3 <- SSL_3 / MSE
pL_3 <- 1 - pf(FL_3, 1, dfE)
F.95_3 <- qf(.95,1,dfE)
## Set-up for output of results
est.con <- rbind(L.hat_1, L.hat_2, L.hat_3)
SSL <- rbind(SSL_1, SSL_2, SSL_3)
FL <- rbind(FL_1, FL_2, FL_3)
F.95 <- rbind(F.95_1, F.95_2, F.95_3)
pL <- rbind(pL_1, pL_2, pL_3)
contrast.out <- cbind(est.con, SSL, FL, F.95, pL)
colnames(contrast.out) <- c("Estimate", "Sum Sq", "F", "F(.95)", "P(>F)")
rownames(contrast.out) <- c("Contrast 1: (3,-1,-1,-1)",
"Contrast 2: (0,2,-1,-1)", "Contrast 3: (0,0,1,-1)")
round(contrast.out, 3)
## Estimate Sum Sq F F(.95) P(>F)
## Contrast 1: (3,-1,-1,-1) -6.528 56.816 12.825 4.001 0.001
## Contrast 2: (0,2,-1,-1) 1.806 8.694 1.962 4.001 0.166
## Contrast 3: (0,0,1,-1) -0.139 0.154 0.035 4.001 0.853
### Setting up r-1 = 3 Orthogonal contrasts
## Trt 1: Lecture/Reading Materials (LEC/MAT)
## Trt 2: Monitor/Keyboard (MON/KEY)
## Trt 3: Head-Mounted Display/Joypad (HMD/JOY)
## Trt 4: Head-Mounted Display/Wearable Sensors (HMD/WEA)
## Contrast 1: Traditional (1) vs Virtual (2,3,4)
## 3*mu1 - mu2 - mu3 - mu4
a.coef <- c(3, -1, -1, -1)
L.hat_1 <- sum(a.coef * mean.trt)
SE.L_1 <- sqrt(MSE * sum(a.coef^2 / n.trt))
tL_1 <- L.hat_1 / SE.L_1
pL_1 <- 2*(1 - pt(abs(tL_1), dfE))
L_LB1 <- L.hat_1 - qt(.975, dfE) * SE.L_1
L_UB1 <- L.hat_1 + qt(.975, dfE) * SE.L_1
## Contrast 2: Monitor/Keyboard (2) vs Head-Mounted Display (3,4)
## 2*mu2 - mu3 - mu4
b.coef <- c(0, 2, -1, -1)
L.hat_2 <- sum(b.coef * mean.trt)
SE.L_2 <- sqrt(MSE * sum(b.coef^2 / n.trt))
tL_2 <- L.hat_2 / SE.L_2
pL_2 <- 2*(1 - pt(abs(tL_2), dfE))
L_LB2 <- L.hat_2 - qt(.975, dfE) * SE.L_2
L_UB2 <- L.hat_2 + qt(.975, dfE) * SE.L_2
## Contrast 3: HMD/Joypad (3) vs Head-Mounted Display/Wearables (4)
## mu3 - mu4
d.coef <- c(0, 0, 1, -1)
L.hat_3 <- sum(d.coef * mean.trt)
SE.L_3 <- sqrt(MSE * sum(d.coef^2 / n.trt))
tL_3 <- L.hat_3 / SE.L_3
pL_3 <- 2*(1 - pt(abs(tL_3), dfE))
L_LB3 <- L.hat_3 - qt(.975, dfE) * SE.L_3
L_UB3 <- L.hat_3 + qt(.975, dfE) * SE.L_3
## Set-up for output of results
est.con <- rbind(L.hat_1, L.hat_2, L.hat_3)
SE.L <- rbind(SE.L_1, SE.L_2, SE.L_3)
tL <- rbind(tL_1, tL_2, tL_3)
t.975 <- rbind(qt(.975, dfE), qt(.975, dfE), qt(.975, dfE))
pL <- rbind(pL_1, pL_2, pL_3)
L_LB <- rbind(L_LB1, L_LB2, L_LB3)
L_UB <- rbind(L_UB1, L_UB2, L_UB3)
contrast.out1 <- cbind(est.con, SE.L, tL, t.975, pL, L_LB, L_UB)
colnames(contrast.out1) <- c("Estimate", "Std Err", "t*", "t(.975)", "P(>|t|)", "LB", "UB")
rownames(contrast.out1) <- c("Contrast 1: (3,-1,-1,-1)",
"Contrast 2: (0,2,-1,-1)", "Contrast 3: (0,0,1,-1)")
round(contrast.out1, 3)
## Estimate Std Err t* t(.975) P(>|t|) LB UB
## Contrast 1: (3,-1,-1,-1) -6.528 1.823 -3.581 2 0.001 -10.174 -2.882
## Contrast 2: (0,2,-1,-1) 1.806 1.289 1.401 2 0.166 -0.773 4.384
## Contrast 3: (0,0,1,-1) -0.139 0.744 -0.187 2 0.853 -1.627 1.350