t-tests Dr Bryan Mills
Why?
When 2 sets of data with normal distributions
A difference is considered significant if the probability of getting that difference by random chance is very small. P value: The probability of making an error by chance Historically we use p < 0.05
The magnitude of the effect How Different?
The Spread of Data
n
Hypothesis Tests Hypothesis: A statement which can be proven false Null hypothesis HO: “ There is no difference”  Alternative hypothesis (HA): “ There is a difference…” Try to “reject the null hypothesis” If the null hypothesis is false, it is likely that our alternative hypothesis is true “ False” – there is only a small probability that the results we observed could have occurred by chance
Yes Significant 1 in 20 P  <  0.05 No Not significant P > 0.05 Reject Null Hypothesis Alpha Level
Types of Error Correct Decision Type II Error Beta Null is False (true difference) Type I Error Alpha  Correct Decision Null is True Reject Null (assume difference) Accept Null
Paired Two-Sample For Means   I have two sets of data, one before an experiment (change effect) one after.  Are the means significantly different (2-tailed), is the first greater (1-tailed) or is there no difference (null hypothesis). i.e. is there greater variation between the two samples than within the samples For example - have students tests scores improved after a revision session, have average wages improved after a government initiative has been put in place?
Two-Sample Assuming Equal Variances analysis tool homoscedastic t-test - has same variance I have two sets of data from two different settings (Grades for women v grades for men, mean profit Cornish firms v mean profit Devon firms).  Do they share a common parent population (are all three means the same, population, men, women).  Are the means significantly different (2-tailed), is the first greater (1-tailed) or is there no difference (null hypothesis).
Two-Sample Assuming Unequal Variances   heteroscedastic t-test - has different variances
Tails NOTE: It is always more difficult to demonstrate 2-tails as the part of distribution you are looking for is reduced (0.05/2). 1-Tail 0.05 2 -Tail 0.025 * two
Excel Output 2.006 t Critical two-tail 0.051 P(T<=t) two-tail 1.674 t Critical one-tail  You need this ! 0.026 P(T<=t) one-tail 1.995 t Stat 53.000 df 0.000 Hypothesised Mean Diff 30.000 30.000 Observations 156.742 83.381 Variance 17.597 23.241 Mean sample 2 sample 1 t-Test: Two-Sample Assuming  Unequal Variances
Old Way T-stat is above One tailed critical - retain (reject Ho) Two tailed is below - reject (retain Ho) t Stat 1.995 t Critical one-tail 1.674 t Critical two-tail 2.006
  2.027 t Critical two-tail   2.02 t Critical two-tail 0.14 P(T<=t) two-tail 0.00 P(T<=t) two-tail not significant  1.69 t Critical one-tail significant difference 1.69 t Critical one-tail p>0.05 0.071 P(T<=t) one-tail p<0.05 0.001 P(T<=t) one-tail -1.50 t Stat 3.28 t Stat 37 df 38 df 0 Hypothesized Mean Difference 0 Hypothesized Mean Difference 20 20 Observations 20 20 Observations 89.34 63.78 Variance 3.84 4.77 Variance 64.53 60.38 Mean 60.12 62.27 Mean Women 2 Men 2   Men Women   60  65 60  62
The difference in [whatever the data represents] between sample 1 ( M  = 23.241 ,  VAR  = 83.381 ) and sample 2 ( M  = 17.597,  VAR  = 156.742) was statistically significant,  t  (29) = 1.962,  p  < .05, one-tailed. 2.045 t Critical two-tail 0.059 P(T<=t) two-tail 1.699 t Critical one-tail 0.030 P(T<=t) one-tail 1.962 t Stat 29.000 df 0.000 Hypothesised Mean Difference -0.036 Pearson Correlation 30.000 30.000 Observations 156.742 83.381 Variance 17.597 23.241 Mean sample 2 sample 1 t-Test: Paired Two Sample for Means
Non-parametric alternatives Mann-Whitney U test
U = n 1 n 2  +  n 1 (n 1 +1)  – R 1 2 U=(7)(5) +  (7)(8)  – 30 2 U = 35 + 28 – 30 U = 33 Which is then compared to a table of critical values http://www.umes.edu/sciences/MEESProgram/ExperimentalDesign/Parametric%20versus%20Nonparametric%20Statistics.ppt R 2  = 48 R 1  = 30 n 2  = 5 n 1  = 7 9 170 6 178 12 5 163 180 11 4 165 183 10 3 168 185 8 2 173 188 7 1 175 193  Ranks of female heights Ranks of male heights Heights of females (cm) Heights of males (cm)

Introduction to t-tests (statistics)

  • 1.
  • 2.
  • 3.
    When 2 setsof data with normal distributions
  • 4.
    A difference isconsidered significant if the probability of getting that difference by random chance is very small. P value: The probability of making an error by chance Historically we use p < 0.05
  • 5.
    The magnitude ofthe effect How Different?
  • 6.
  • 7.
  • 8.
    Hypothesis Tests Hypothesis:A statement which can be proven false Null hypothesis HO: “ There is no difference” Alternative hypothesis (HA): “ There is a difference…” Try to “reject the null hypothesis” If the null hypothesis is false, it is likely that our alternative hypothesis is true “ False” – there is only a small probability that the results we observed could have occurred by chance
  • 9.
    Yes Significant 1in 20 P < 0.05 No Not significant P > 0.05 Reject Null Hypothesis Alpha Level
  • 10.
    Types of ErrorCorrect Decision Type II Error Beta Null is False (true difference) Type I Error Alpha Correct Decision Null is True Reject Null (assume difference) Accept Null
  • 11.
    Paired Two-Sample ForMeans I have two sets of data, one before an experiment (change effect) one after. Are the means significantly different (2-tailed), is the first greater (1-tailed) or is there no difference (null hypothesis). i.e. is there greater variation between the two samples than within the samples For example - have students tests scores improved after a revision session, have average wages improved after a government initiative has been put in place?
  • 12.
    Two-Sample Assuming EqualVariances analysis tool homoscedastic t-test - has same variance I have two sets of data from two different settings (Grades for women v grades for men, mean profit Cornish firms v mean profit Devon firms). Do they share a common parent population (are all three means the same, population, men, women). Are the means significantly different (2-tailed), is the first greater (1-tailed) or is there no difference (null hypothesis).
  • 13.
    Two-Sample Assuming UnequalVariances heteroscedastic t-test - has different variances
  • 14.
    Tails NOTE: Itis always more difficult to demonstrate 2-tails as the part of distribution you are looking for is reduced (0.05/2). 1-Tail 0.05 2 -Tail 0.025 * two
  • 15.
    Excel Output 2.006t Critical two-tail 0.051 P(T<=t) two-tail 1.674 t Critical one-tail  You need this ! 0.026 P(T<=t) one-tail 1.995 t Stat 53.000 df 0.000 Hypothesised Mean Diff 30.000 30.000 Observations 156.742 83.381 Variance 17.597 23.241 Mean sample 2 sample 1 t-Test: Two-Sample Assuming Unequal Variances
  • 16.
    Old Way T-statis above One tailed critical - retain (reject Ho) Two tailed is below - reject (retain Ho) t Stat 1.995 t Critical one-tail 1.674 t Critical two-tail 2.006
  • 17.
      2.027 tCritical two-tail   2.02 t Critical two-tail 0.14 P(T<=t) two-tail 0.00 P(T<=t) two-tail not significant 1.69 t Critical one-tail significant difference 1.69 t Critical one-tail p>0.05 0.071 P(T<=t) one-tail p<0.05 0.001 P(T<=t) one-tail -1.50 t Stat 3.28 t Stat 37 df 38 df 0 Hypothesized Mean Difference 0 Hypothesized Mean Difference 20 20 Observations 20 20 Observations 89.34 63.78 Variance 3.84 4.77 Variance 64.53 60.38 Mean 60.12 62.27 Mean Women 2 Men 2   Men Women   60 65 60 62
  • 18.
    The difference in[whatever the data represents] between sample 1 ( M = 23.241 , VAR = 83.381 ) and sample 2 ( M = 17.597, VAR = 156.742) was statistically significant, t (29) = 1.962, p < .05, one-tailed. 2.045 t Critical two-tail 0.059 P(T<=t) two-tail 1.699 t Critical one-tail 0.030 P(T<=t) one-tail 1.962 t Stat 29.000 df 0.000 Hypothesised Mean Difference -0.036 Pearson Correlation 30.000 30.000 Observations 156.742 83.381 Variance 17.597 23.241 Mean sample 2 sample 1 t-Test: Paired Two Sample for Means
  • 19.
  • 20.
    U = n1 n 2 + n 1 (n 1 +1) – R 1 2 U=(7)(5) + (7)(8) – 30 2 U = 35 + 28 – 30 U = 33 Which is then compared to a table of critical values http://www.umes.edu/sciences/MEESProgram/ExperimentalDesign/Parametric%20versus%20Nonparametric%20Statistics.ppt R 2 = 48 R 1 = 30 n 2 = 5 n 1 = 7 9 170 6 178 12 5 163 180 11 4 165 183 10 3 168 185 8 2 173 188 7 1 175 193 Ranks of female heights Ranks of male heights Heights of females (cm) Heights of males (cm)