Class: Num4DiffTestLib::NonParametrixTestLib

Inherits:
Object
  • Object
show all
Defined in:
lib/num4difftest.rb

Overview

ノンパラメトリック検定

Instance Method Summary collapse

Constructor Details

#initialize(hypothTest3) ⇒ NonParametrixTestLib

Returns a new instance of NonParametrixTestLib.



177
178
179
180
181
182
# File 'lib/num4difftest.rb', line 177

def initialize(hypothTest3)
    @hypothTest3 = hypothTest3
    @nonParaTest = Num4TstStatistic2Lib::NonParametrixTestLib.new(@hypothTest3)
    @oneWay      = Num4AnovaLib::OneWayLayoutLib.new
    @twoWay      = Num4AnovaLib::TwoWayLayoutLib.new
end

Instance Method Details

#mult2_diff_test(xij, a) ⇒ Array

3群以上の母平均の差の検定(2元配置)

Examples:

xij = [
     [13.6, 15.6, 9.2],
     [22.3, 23.3, 13.3],
     [26.7, 28.8, 15.0],
     [28.0, 31.2, 15.8],
]
hypothTest2 = Num4HypothTestLib::TwoSideTestLib.new
nonParaTest = Num4DiffTestLib::NonParametrixTestLib.new(hypothTest2)
nonParaTest.mult2_diff_test(xij, a)
=> true

Returns 検定結果(boolean[] true:棄却域内 false:棄却域外).

Parameters:

Returns:

  • (Array)

    検定結果(boolean[] true:棄却域内 false:棄却域外)

Raises:

  • (TypeError)


244
245
246
247
248
# File 'lib/num4difftest.rb', line 244

def mult2_diff_test(xij, a)
    raise TypeError unless @hypothTest3.kind_of?(HypothTest3IF)

    return @twoWay.friedman_test(xij, a)
end

#mult_diff_test(xi1, a) ⇒ boolean

3群以上の母平均の差の検定(1元配置)

Examples:

xi = [
     [12.2, 18.8, 18.2],
     [22.2, 20.5, 14.6, 20.8, 19.5, 26.3],
     [26.4, 32.5, 31.3, 24.5, 21.2, 22.4],
]
hypothTest2 = Num4HypothTestLib::TwoSideTestLib.new
nonParaTest = Num4DiffTestLib::NonParametrixTestLib.new(hypothTest2)
nonParaTest.mult_diff_test(xi, 0.05)
=> false

Returns 検定結果(true:棄却域内 false:棄却域外).

Parameters:

Returns:

  • (boolean)

    検定結果(true:棄却域内 false:棄却域外)

Raises:

  • (TypeError)


222
223
224
225
226
# File 'lib/num4difftest.rb', line 222

def mult_diff_test(xi1, a)
    raise TypeError unless @hypothTest3.kind_of?(HypothTest3IF)

    return @oneWay.kruskalwallis_test(xi1, a)
end

#smple_diff_test(xi1, xi2, a) ⇒ boolean

2群の母平均の差の検定

Examples:

xi1 = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
xi2 = [180, 180, 235, 270, 240, 285, 164, 152]
hypothTest2 = Num4HypothTestLib::TwoSideTestLib.new
nonParaTest = Num4DiffTestLib::NonParametrixTestLib.new(hypothTest2)
nonParaTest.smple_diff_test(xi1, xi2, 0.05)
=> false

Returns 検定結果(true:棄却域内 false:棄却域外).

Parameters:

  • xi1 (Array)

    データ(double[])

  • xi2 (Array)

    データ(double[])

  • a (double)

    有意水準

Returns:

  • (boolean)

    検定結果(true:棄却域内 false:棄却域外)

Raises:

  • (TypeError)


197
198
199
200
201
202
203
204
205
# File 'lib/num4difftest.rb', line 197

def smple_diff_test(xi1, xi2, a)
    raise TypeError unless @hypothTest3.kind_of?(HypothTest3IF)

    if xi1.size == xi2.size then
        return @nonParaTest.wilcoxon(xi1, xi2, a)
    else
        return @nonParaTest.utest(xi1, xi2, a)
    end
end