# Lecture 12: NonParametric ANOVA

We discussed the Kruskal Wallis non-parametric one-way ANOVA alternative, Mood's Median test alternative, and Welch's ANOVA using the following data:

Silver content of Byzantine coins from A Handbook of Small Data Sets by D.J. Hand, F. Daly, A.D. Lunn, K.J. McConway and E. Ostrowski, London: Chapman & Hall, 1994. Originally from: Hendy, M.F. and Charles, J.A. (1970) The production techniques, silver content and circulation history of the twelfth-century Byzantine Trachy. Archaeometry, 12, 13-21. I remembered the data set and found it discussed on the WEB here: http://renoir.vill.edu/~short/STATS/MA/materials/datasets.html

The silver content (% Ag) of a number of Byzantine coins discovered in Cyprus was determined. Nine of the coins came from the first coinage of the reign of King Manuel I, Comnenus (1143-1180); there were seven from the second coinage minted several years later and four from the third coinage (later still); another seven were from a fourth coinage. The question arose of whether there were significant differences in the silver content of coins minted early and late Manuel's reign.

```
Period_1 5.9
Period_1 6.8
Period_1 6.4
Period_1 7.0
Period_1 6.6
Period_1 7.7
Period_1 7.2
Period_1 6.9
Period_1 6.2
Period_2  6.9
Period_2 9.0
Period_2 6.6
Period_2 8.1
Period_2 9.3
Period_2 9.2
Period_2 8.6
Period_3  4.9
Period_3  5.5
Period_3  4.6
Period_3  4.5
Period_4  5.3
Period_4 5.6
Period_4 5.5
Period_4 5.1
Period_4 6.2
Period_4 5.8
Period_4 5.8
```
Macro for Welch's ANOVA:
```GMACRO
Welch

# Lables MUST be in C1
# Data MUST be in C2

Name k1 "I"
Let I = 1
Let k3 = N(c1) - 1
Do k2 = 1 : k3
If c1(k2) ~= c1(k2 + 1)
Let I = I +1
ENDIf
EndDo

Name c3 'Mean' c4 "ByVar" c5 "Variance" c6 "N"
Statistics C2;
By C1;
Mean 'Mean';
GValues 'ByVar';
Variance 'Variance';
N 'N'.

Name c7 'weights'
Let 'weights' = 'N'/'Variance'

Name c8 'WeightedMean'
Let k3 = I
Do k2 = 1:k3
Let c8(k2) = sum('weights'*'Mean')/(sum('weights'))
EndDo

Name c9 'F'
Name c10 'numerator df'
Name c11 'denominator df'

Let 'F' = sum('weights'*('Mean' - 'WeightedMean')**2)/(I - 1)
Let 'F' = 'F'/( 1 + (2*(I-2)/(I**2 - 1))*sum( (1/('N' -1))*(1 - 'weights'/sum('weights'))**2))

Let c10 = I -1
Let c11 = (I**2 -1)/(3* sum( (1/('N' -1))*(1 - 'weights'/sum('weights'))**2))

Name c12 'p-value'
Let k2 = I -1
Let k3 = Floor(c11(1), 0)
CDF 'F' 'p-value';
F k2 k3.

Let c12 = 1 - c12

ENDMACRO
```