library(haven) # for read_sav() function
library(tidyr) # for pivot_wider() function
<- read_sav("Full Blind Scores.sav")
d
# add subject id numbers
$id <- rep(1:11, 2)
d
# reshape "wide" so there is a column for with and without tactor shirt
<- pivot_wider(d, names_from = Group,
d_wide values_from = MentalDemand:Diagonal_Accuracy)
Multivariate Paired Hotelling T Square Test
Read in Data
First read in SPSS data and reshape to “wide” format.
Multivariate Paired Hotelling T Square Test
To analyze this data I think we should use the Multivariate Paired Hotelling T Square Test. This is a multivariate version of the paired t test. Instead of comparing one set of pairs, we compare multiple sets of pairs. This page at Penn State presents a nice overview of Multivariate Paired Hotelling T Square Test. Their example uses husband-wife pairs, but it applies to your pairs as well.
To implement this in R, we can use the Mpaired()
function on the {MVTests} package. We need to create two separate data frames:
- One with the first measures
- One with the second measures
library(MVTests)
<- d_wide[,c("Straight_Time_1", "Straight_Accuracy_1", "Side_Time_1",
X "Side_Accuracy_1", "Diagonal_Time_1", "Diagonal_Accuracy_1")]
<- d_wide[,c("Straight_Time_2", "Straight_Accuracy_2", "Side_Time_2",
Y "Side_Accuracy_2", "Diagonal_Time_2", "Diagonal_Accuracy_2")]
Then we use the Mpaired()
function on the two data frames. Save the result and use summary()
to see test result
<- Mpaired(T1 = X,T2 = Y)
result summary(result)
Multivariate Paired Hotelling T Square Test
Hotelling T Sqaure Statistic = 31.10435
F value = 2.592 , df1 = 6 , df2 = 5 , p-value: 0.158
Descriptive Statistics (The First Treatment)
Straight_Time_1 Straight_Accuracy_1 Side_Time_1 Side_Accuracy_1
Means 20.82939 5.393939 21.20788 4.712121
Sd 15.27299 4.248707 18.81130 2.623707
Diagonal_Time_1 Diagonal_Accuracy_1
Means 29.78667 4.424242
Sd 20.99498 4.274188
Descriptive Statistics (The Second Treatment)
Straight_Time_2 Straight_Accuracy_2 Side_Time_2 Side_Accuracy_2
Means 8.825758 42.01515 8.517273 44.89394
Sd 5.975533 46.25284 4.479820 45.56456
Diagonal_Time_2 Diagonal_Accuracy_2
Means 10.250606 46.92424
Sd 6.063614 44.67956
Descriptive Statistics (The Differences)
Straight_Time_2 Straight_Accuracy_2 Side_Time_2 Side_Accuracy_2
Means -12.00364 36.62121 -12.69061 40.18182
Sd 13.95356 46.18995 16.94681 44.53397
Diagonal_Time_2 Diagonal_Accuracy_2
Means -19.53606 42.50000
Sd 20.63703 43.00762
The null hypothesis is no difference in the differences. With a p-value of 0.16, we fail to find sufficient evidence to reject this hypothesis. This is not surprising given we are testing 6 sets of differences based on only 11 subjects.
How to implement in SPSS
We can implement this in SPSS using the MANOVA routine, but we need to do two things first:
- compute the differences in each set (Straight_Time_1 - Straight_Time_2, Straight_Accuracy_1 - Straight_Accuracy_2, etc)
- Manually add an intercept to the data, which is just a column of ones.
Once that’s done, open the MANOVA (Multivariate) dialog and add the differences to the Dependent variables field and add the intercept to the Covariates Field.
Next click the Model button, click the Build Terms radio button, add Intercept to the Model field, and uncheck the “Include intercept in model” box.
Click continue and click OK. The result is presented under the Multivariate Tests section as “Hotelling’s Trace.” This replicates the R output above.