Minitab macro for jackknife test (of Sec. 5.2 of H&W)


noecho
# Macro to do
# F test,
# Levene s test,
# APF test,
# jackknife test.
# Set k91 and k92 equal to the column numbers containing the two samples.
# (Note: All of the p-values pertain to two-sided alternative hypotheses.
# For some of the tests, two values are given;
# twice the lower-tail probability,
# and twice the upper-tail probability.
# Of the two values, the one that is between 0 and 1 is the p-value.)
let c101 = ck91
let c102 = ck92
let k101 = (stdev(c101)/stdev(c102))**2
let k102 = n(c101) - 1
let k103 = n(c102) - 1
cdf k101 k104;
f k102 k103.
let k105 = 2*(1 - k104)
let k104 = 2*k104
name k101 'F' k102 'df1 F' k103 'df2 F' k104 'pv 2*l F' k105 'pv 2*u F'
print k101-k105
let c111 = (c101 - mean(c101))**2
let c112 = (c102 - mean(c102))**2
let k110 = abs( mean(c111) - mean(c112) )
let k111 = (stdev(c111)**2)/n(c101)
let k112 = (stdev(c112)**2)/n(c102)
let k110 = k110/sqrt(k111 + k112)
let k113 = ((k111+k112)**2)/(k111*k111/(n(c101)-1)+k112*k112/(n(c102)-1))
let k114 = round(k113)
let k115 = -k110
cdf k115 k116;
t k114.
let k116 = 2*k116
name k110 'Levene s' k113 'df L not' k114 'dfLround' k116 'pvLevene'
print k110 k113 k114 k116
let k121 = (sum(c111)+sum(c112))**2
let k121 = (n(c101)+n(c102))*(sum(c111*c111) + sum(c112*c112))/k121
let k122 = 1 + (k121 - 3)/2
let k122 = 1/k122
let k123 = k122*(n(c101) - 1)
let k124 = k122*(n(c102) - 1)
let k125 = round(k123)
let k126 = round(k124)
cdf k101 k127;
f k125 k126.
let k128 = 2*(1 - k127)
let k127 = 2*k127
name k121 'b_2 hat' k122 'd hat' k123 'df1 APFn' k124 'df2 APFn'
name k125 'df1 APFr' k126 'df2 APFr' k127 'pv2*lAPF' k128 'pv2*uAPF'
print k101 k121-k128
let c131 = c101**2
let c132 = c102**2
let c141 = sum(c131) - c131
let c142 = sum(c132) - c132
let c151 = sum(c101) - c101
let c152 = sum(c102) - c102
let c161 = loge((c141 - c151*c151/(n(c101)-1))/(n(c101) - 2))
let c162 = loge((c142 - c152*c152/(n(c102)-1))/(n(c102) - 2))
let k161 = loge(stdev(c101)**2)
let k162 = loge(stdev(c102)**2)
let c171 = n(c101)*k161 - (n(c101) - 1)*c161
let c172 = n(c102)*k162 - (n(c102) - 1)*c162
let k180 = abs( mean(c171) - mean(c172) )
let k280 = k180
name k280 'top of t'
let k181 = (stdev(c171)**2)/n(c101)
let k182 = (stdev(c172)**2)/n(c102)
let k180 = k180/sqrt(k181 + k182)
let k183 = ((k181+k182)**2)/(k181*k181/(n(c101)-1)+k182*k182/(n(c102)-1))
let k184 = round(k183)
let k185 = -k180
cdf k185 k186;
t k184.
let k186 = 2*k186
name k180 'jackk t' k183 'df J not' k184 'dfJround' k186 'pv jackk'
print k280 k180 k183 k184 k186
echo