Class: Num4TstStatistic2Lib::DecorrTestLib

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

Overview

無相関の検定

Instance Method Summary collapse

Constructor Details

#initializeDecorrTestLib

Returns a new instance of DecorrTestLib.



304
305
306
307
308
# File 'lib/num4tststatistic2.rb', line 304

def initialize
    @paraTest = Num4TstStatisticLib::ParametrixTestLib.new
    @nonParaTest = Num4TstStatisticLib::NonParametrixTestLib.new
    @hypothTest = Num4HypothTestLib::DecorrTestLib.new
end

Instance Method Details

#kendallscorr(x, y, a) ⇒ boolean

ケンドールの順位相関係数

Examples:

x = [113, 64, 16, 45, 28, 19, 30, 82, 76]
y = [31, 5, 2, 17, 18, 2, 9, 25, 13]
paraTest = Num4TstStatistic2Lib::DecorrTestLib.new
paraTest.kendallscorr(x, y, 0.05)
=> false

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

Parameters:

  • x (Array)

    xのデータ(double[])

  • y (Array)

    yのデータ(double[])

  • a (double)

    有意水準

Returns:

  • (boolean)

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



359
360
361
362
363
# File 'lib/num4tststatistic2.rb', line 359

def kendallscorr(x, y, a)
    df = x.size - 2
    statistic = @nonParaTest.kendallscorr(x, y)
    return @hypothTest.twoSideTest(statistic, df, a)
end

#pearsoCorrelation(x, y, a) ⇒ boolean

ピアソン相関係数

(相関係数の検定)

Examples:

x = [113, 64, 16, 45, 28, 19, 30, 82, 76]
y = [31, 5, 2, 17, 18, 2, 9, 25, 13]
paraTest = Num4TstStatistic2Lib::DecorrTestLib.new
paraTest.pearsoCorrelation(x, y, 0.05)
=> true

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

Parameters:

  • x (Array)

    xのデータ(double[])

  • y (Array)

    yのデータ(double[])

  • a (double)

    有意水準

Returns:

  • (boolean)

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



323
324
325
326
327
# File 'lib/num4tststatistic2.rb', line 323

def pearsoCorrelation(x, y, a)
    df = x.size - 2
    statistic = @paraTest.pearsoCorrelation(x, y)
    return @hypothTest.twoSideTest(statistic, df, a)
end

#spearmanscorr(x, y, a) ⇒ boolean

スピアマンの順位相関係数

Examples:

x = [113, 64, 16, 45, 28, 19, 30, 82, 76]
y = [31, 5, 2, 17, 18, 2, 9, 25, 13]
paraTest = Num4TstStatistic2Lib::DecorrTestLib.new
paraTest.spearmanscorr(x, y, 0.05)
=> true

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

Parameters:

  • x (Array)

    xのデータ(double[])

  • y (Array)

    yのデータ(double[])

  • a (double)

    有意水準

Returns:

  • (boolean)

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



341
342
343
344
345
# File 'lib/num4tststatistic2.rb', line 341

def spearmanscorr(x, y, a)
    df = x.size - 2
    statistic = @nonParaTest.spearmanscorr(x, y)
    return @hypothTest.twoSideTest(statistic, df, a)
end