# Which mean value should I use

I am to test the transformational shifts in three different directions for 3 different imaging techniques in a group of 30 patients. I am trying to prove one is not statistically different to the gold standard. Should I get the mean shift values in each direction for the 270 images OR should I get the mean shift per patient, then the mean of those 30 patients?VERY confused.

If I use the 270 figures I get very good normal distribution on histograms and pp plot, however when finding the average per patient and getting the average of that I am getting the mean of 30 mean figures, and the distribution is no longer normal!

• The question is not clear. It will be helpful if you can show a sample of your data in table format. Will it be like this: PtID, x_modality1, y_mod1, z_mod1, x_mod2, y_mod2, z_mod2, x_mod3, y_mod3, z_mod3. And you want to check if modality1 and modality2 are not inferior to modality3, which is the gold standard? – rnso Nov 25 '14 at 12:57
• yes exactly! do you think i should compare each image in each modality and get the mean of that or get the mean for each patient using each modality and then the mean of the patients mean?! – Zoe Campbell Nov 25 '14 at 13:07
• x,y and z are the three different directions (ant post, left right and sup inf) the value of x in the new modality is hopefully similar to that of the gold standard. the first modality is doing a simple match on a cone beam ct, the second one is adding an additional step to this match and the third is having a doctor match from the simple match, this being the gold standard – Zoe Campbell Nov 25 '14 at 13:59
• Sorry, but your question and your replies in comments are difficult to follow because of lack of detail and lack of attention to grammar, spelling and punctuation. (You are not texting to friends who can decode easily.) – Nick Cox Nov 25 '14 at 16:41
• See advice at meta.stats.stackexchange.com/questions/1479/… – Nick Cox Nov 25 '14 at 16:48

In R, following can be done:

For one direction (x):

dd = data.frame(ptid=1:len, mod=sample(1:2, len, replace=T), x=sample(10:20, len, replace=T))
ptid mod  x
1    1   1 20
2    2   2 12
3    3   2 19
4    4   1 13
5    5   1 14
6    6   1 19


Code for plotting boxplot:

library(ggplot2)
ggplot(dd, aes(factor(mod), x))+geom_boxplot()


Image:

Paired t.test etc can be applied after rearranging data as follows:

head(dd2)
ptid x_mod1 x_mod2
1    1    315    311
2    2    288    225
3    3    341    459
4    4    322    272
5    5    223    461
6    6    445    178

t.test(dd2[,2], dd2[,3], paired=T)

Paired t-test

data:  dd2[, 2] and dd2[, 3]
t = 0.7188, df = 49, p-value = 0.4757
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-27.976  59.136
sample estimates:
mean of the differences
15.58

wilcox.test(dd2[,2], dd2[,3], paired=T)

Wilcoxon signed rank test with continuity correction

data:  dd2[, 2] and dd2[, 3]
V = 712.5, p-value = 0.472
alternative hypothesis: true location shift is not equal to 0


A paired line plot can also be plotted to see how x values of 2 modalities compare with each other: