File: anova.pcm

package info (click to toggle)
extrema 4.3.6-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 19,212 kB
  • ctags: 6,452
  • sloc: cpp: 86,428; sh: 8,229; makefile: 814
file content (42 lines) | stat: -rw-r--r-- 1,245 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
!
! one-way analysis of variance test
!
nameList = ?1
!
@splitString nameList numberOfPopulations names error
if (error) then goto ASK_AGAIN
!
k = numberOfPopulations
df = k-1
dfe = 0
do i = [1:k]
 T[i] = sum(names[i])
 n[i] = len(names[i])
 dfe = dfe + n[i] - 1
enddo
dft = df + dfe
TT = sum(T)
SSTr = sum(T^2/n)-TT^2/sum(n)
SST = 0
do i = [1:k]
 do j = [1:n[i]]
   SST = SST + (names[i])[j]^2
 enddo
enddo
SST = SST - TT^2/sum(n)
MSTr = SSTr/df
SSE = SST - SSTr
MSE = SSE/dfe
F = MSTr/MSE
='Source of        Degrees of    Sum of          Mean              F'
='Variation         Freedom      Squares         Square'
='--------------------------------------------------------------------'
='Treatments'//rchar(df,'%12.0f')//rchar(SSTr,'%15.1f')//rchar(MSTr,'%15.1f')//rchar(F,'%15.1f')
='Error     '//rchar(dfe,'%12.0f')//rchar(SSE,'%15.1f')//rchar(MSE,'%15.1f')
='Total     '//rchar(dft,'%12.0f')//rchar(SST,'%15.1f')
=' '
criticalValue = 1-fisher(df,dfe,F)
='Null hypothesis: the differences among the sample means can be atributed to chance'
='Accept the null hypothesis at a significance level of '//rchar(criticalValue*100)//'%'
=' '
destroy error k n df dfe dft i j T TT SST SSTr MSTr SSE MSE F nameList names rowLen numberOfPopulations