(Created page with "== Paired ttest == This variation of ttest is used for Paired Data === Paired Data === Two set of observations are ''paired'' if each observation in one set has exactly...") 
(No difference)

This variation of ttest is used for Paired Data
Two set of observations are paired if each observation in one set has exactly one corresponding observation is another set.
Examples:
library(openintro) data(textbooks) t.test(textbooks$diff, mu=x.bar.nul, alternative='two.sided')
or
t.test(textbooks$uclaNew, textbooks$amazNew, paired=T, alternative='two.sided')
Test
Calculations
library(openintro) data(textbooks) hist(textbooks$diff, col='yellow') n = length(textbooks$diff) s = sd(textbooks$diff) se = s / sqrt(n) x.bar.nul = 0 x.bar.dif = mean(textbooks$diff) t = (x.bar.dif  x.bar.nul) / se t p = pt(t, df=n1, lower.tail=F) * 2 p
or
t.test(textbooks$diff, mu=x.bar.nul, alternative='two.sided')
Let $\mu_d = \mu_0  \mu_1$ be the difference between two methods
Our test:
Say, we have:
Test statistics:
Then we compare it with $t_{397}$
And we conclude that the difference between the two methods is not 0