home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / MCAD254.ZIP / STAT / ANOVA.MCD next >
Encoding:
Text File  |  1988-11-21  |  4.1 KB  |  190 lines

  1. .MCD 20000 0
  2. .CMD PLOTFORMAT logs=0,0 subdivs=1,1 size=5,15 type=l
  3. .CMD FORMAT  rd=d ct=10 im=i et=3 zt=15 pr=3 mass length time charge
  4. .CMD SET ORIGIN 0
  5. .CMD SET TOL 0.001000
  6. .CMD MARGIN 0
  7. .CMD LINELENGTH 78
  8. .CMD SET PRNCOLWIDTH 8
  9. .CMD SET PRNPRECISION 4
  10. .TXT 0 39 1 39 
  11. a1,38,39,37
  12. Copyright (c) 1988 by MathSoft, Inc.
  13. .TXT 1 43 1 41 
  14. a1,40,78,39
  15. /EQUATIONS FOR BUILDING VARIANCE TABLE
  16. .TXT 1 -57 1 31 
  17. a1,30,78,29
  18. ONE-WAY ANALYSIS OF VARIANCE
  19. .TXT 2 -23 2 74 
  20. a2,73,76,117
  21. This application calculates within and among group sums of squares for 
  22. carrying out a one-way analysis of variance.
  23. .TXT 3 -1 1 16 
  24. a1,15,78,14
  25. read in data:
  26. .EQN 0 16 1 20 
  27. D~READPRN(VDATA)
  28. .TXT 0 43 1 8 
  29. a1,7,26,6
  30. group
  31. .TXT 0 8 1 13 
  32. a1,12,17,11
  33. group mean
  34. .EQN 0 15 1 13 
  35. N~cols(D)
  36. .EQN 0 18 1 13 
  37. M~rows(D)
  38. .EQN 0 18 1 15 
  39. n~0;N-1
  40. .EQN 0 20 1 15 
  41. m~0;M-1
  42. .EQN 1 -70 2 8 
  43. µ[n=
  44. .TXT 1 -68 1 20 
  45. a1,19,78,18
  46. number of groups:
  47. .EQN 0 20 1 9 
  48. N=?
  49. .TXT 0 10 1 14 
  50. a1,13,78,12
  51. group size:
  52. .EQN 0 14 1 9 
  53. M=?
  54. .EQN 0 16 1 7 
  55. n=
  56. .TXT 0 22 1 18 
  57. a1,17,78,16
  58. sum of elements
  59. .TXT 0 31 1 14 
  60. a1,13,78,12
  61. group means
  62. .TXT 0 24 1 21 
  63. a1,20,78,19
  64. degrees of freedom
  65. .TXT 2 -117 1 29 
  66. a1,28,63,27
  67. analysis of variance table
  68. .EQN 0 62 4 20 
  69. s~m$n$D[(m,n)
  70. .EQN 0 31 3 17 
  71. µ[n~mean(D{52}n)
  72. .EQN 0 24 3 18 
  73. df~({3,1}÷M*N-1÷N*(M-1)÷N-1)
  74. .TXT 1 -120 1 35 
  75. a1,34,58,33
  76. --------------------------------
  77. .TXT 1 0 2 14 
  78. a2,13,61,20
  79. degrees of
  80. freedom
  81. .TXT 0 13 2 11 
  82. a2,10,47,17
  83. sum of 
  84. squares
  85. .TXT 0 11 2 11 
  86. a2,10,35,16
  87. mean   
  88. square
  89. .EQN 2 -22 2 9 
  90. df[i=
  91. .EQN 0 10 2 9 
  92. ss[i=
  93. .EQN 0 12 2 9 
  94. ms[j=
  95. .TXT 1 41 1 17 
  96. a1,16,78,15
  97. sum of squares
  98. .TXT 0 30 1 23 
  99. a1,22,78,21
  100. sum of group squares
  101. .TXT 0 26 1 16 
  102. a1,15,78,14
  103. table indices
  104. .TXT 1 -136 3 18 
  105. a3,17,76,38
  106. among groups  
  107. within groups
  108. totals
  109. .EQN 0 110 5 23 
  110. g~n$(m$D[(m,n))^2
  111. .EQN 1 -29 4 20 
  112. q~m$n$D[(m,n)^2
  113. .EQN 0 56 1 11 
  114. i~0;2
  115. .TXT 1 -77 1 11 
  116. a1,10,25,9
  117. F ratio:
  118. .EQN 2 0 1 9 
  119. F={18994}?
  120. .TXT 1 -60 1 15 
  121. a1,14,75,13
  122. [Ctrl][PgDn]
  123. .TXT 1 79 1 15 
  124. a1,14,78,13
  125. [Ctrl][PgDn]
  126. .TXT 2 -80 1 12 
  127. a1,11,77,10
  128. choose α:
  129. .EQN 0 12 1 10 
  130. α~.025
  131. .TXT 0 47 2 18 
  132. a2,17,17,29
  133. approximate 
  134. critical value:
  135. .TXT 0 20 1 63 
  136. a1,62,78,61
  137. These equations calculate the table entries and the F ratio.
  138. .TXT 2 -79 2 52 
  139. a2,51,53,88
  140. If F > CV then there is a significant difference 
  141. among the group means at the α level.
  142. .EQN 0 79 1 11 
  143. j~0;1
  144. .EQN 1 -19 1 10 
  145. CV={18994}?
  146. .EQN 1 22 11 16 
  147. ss~({3,1}÷q-s^2/(M*N)÷q-(g/M)÷g/M-s^2/(M*N))
  148. .TXT 1 -82 5 79 
  149. a5,78,76,371
  150. The data used in the example above are contained in the matrix B.  You can 
  151. change the data by redefining B and pressing F9 to write it to the file 
  152. VDATA.   To use data from a different file, first delete the following two 
  153. equations, so that your data will not be overwritten.  Then use the filename 
  154. command to assign the name of your file to the file variable VDATA.
  155. .EQN 0 106 8 18 
  156. ms~({2,1}÷ss[1/(N*(M-1))÷ss[0/(N-1))
  157. .EQN 2 26 5 9 
  158. F~ms[0/ms[1
  159. .EQN 4 -133 5 27 
  160. B:({5,4}÷5.9÷5.8÷6.0÷6.1÷5.3÷4.5÷5.4÷4.2÷5.2÷3.9÷6.8÷6.5÷7.1÷6.3÷5.2÷3.9÷4.7÷4.7÷3.2÷3.1)
  161. .TXT 5 80 1 15 
  162. a1,14,78,13
  163. [Ctrl][PgDn]
  164. .EQN 1 -80 1 22 
  165. WRITEPRN(VDATA):B
  166. .TXT 1 81 2 74 
  167. a2,73,78,125
  168. Approximation for incomplete beta function (see Abramowitz and Stegun, 
  169. Handbook of Mathematical Functions, number 26.5.21):
  170. .EQN 4 1 13 65 
  171. I(a,b,x)~cnorm((3*((b*x)^(1/3)*(1-1/(9*b))-(a*(1-x))^(1/3)*(1-1/(9*a))))/\((b*x)^(2/3)/b+(a*(1-x))^(2/3)/a))
  172. .TXT 14 -1 1 15 
  173. a1,14,78,13
  174. [Ctrl][PgDn]
  175. .TXT 2 0 5 79 
  176. a5,78,76,369
  177. These equations calculate CV, an approximation for the critical F value 
  178. corresponding to α.  For α between .01 and .1, CV is within 1% of the true 
  179. value for three or more groups with four or more observations in each group, 
  180. and within 2.5% of the true value for two groups with six or more 
  181. observations in each.   For α = .005, CV is within 2.5% of the true value.
  182. .EQN 7 0 1 14 
  183. TOL~.00001
  184. .EQN 2 0 5 17 
  185. x~df[1/(df[1+2*df[0)
  186. .EQN 0 22 4 30 
  187. y~root(I(df[1/2,df[0/2,x)-α,x)
  188. .EQN 0 33 5 18 
  189. CV~(df[1*(1-y))/(df[0*y)
  190.