Class: Num4TstStatisticLib::ParametrixTestLib

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

Instance Method Summary collapse

Constructor Details

#initializeParametrixTestLib

Returns a new instance of ParametrixTestLib.



14
15
16
# File 'lib/num4tststatistic.rb', line 14

def initialize
    @paramTest = ParametrixTest.getInstance()
end

Instance Method Details

#df4welch(xi1, xi2) ⇒ int

ウェルチ検定の為の自由度

Examples:

xi1 = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
xi2 = [180, 180, 235, 270, 240, 285, 164, 152]
paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.df4welch(xi1, xi2)
=> 11

Returns 自由度.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (int)

    自由度



118
119
120
121
122
# File 'lib/num4tststatistic.rb', line 118

def df4welch(xi1, xi2)
    return @paramTest.df4welch(
        xi1.to_java(Java::double), xi2.to_java(Java::double)
    )
end

#diffPopulationMean(xi1, xi2) ⇒ double

Note:

自由度(N-1)のt分布に従う

対応のある2つの母平均の差の検定量

Examples:

xi1 = [37.1, 36.2, 36.6, 37.4, 36.8, 36.7, 36.9, 37.4, 36.6, 36.7]
xi2 = [36.8, 36.6, 36.5, 37.0, 36.0, 36.5, 36.6, 37.1, 36.4, 36.7]
paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.diffPopulationMean(xi1, xi2)
=> 2.283

Returns 検定統計量.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (double)

    検定統計量



137
138
139
140
141
# File 'lib/num4tststatistic.rb', line 137

def diffPopulationMean(xi1, xi2)
    return @paramTest.diffPopulationMean(
        xi1.to_java(Java::double), xi2.to_java(Java::double)
    )
end

#diffPopulationMean2EquVar(xi1, xi2) ⇒ double

Note:

N1+N2-2のt分布に従う

2つの母平均の差の検定量 (等分散性を仮定)

Examples:

xi1 = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
xi2 = [180, 180, 235, 270, 240, 285, 164, 152]
paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.diffPopulationMean2EquVar(xi1, xi2)
=> -1.765

Returns 検定統計量.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (double)

    検定統計量



81
82
83
84
85
# File 'lib/num4tststatistic.rb', line 81

def diffPopulationMean2EquVar(xi1, xi2)
    return @paramTest.diffPopulationMean2EquVar(
        xi1.to_java(Java::double), xi2.to_java(Java::double)
    )
end

#diffPopulationMean2UnEquVar(xi1, xi2) ⇒ double

Note:

df4welch関数で求めた自由度のt分布に従う

2つの母平均の差の検定量 (不等分散性を仮定)

Examples:

xi1 = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
xi2 = [180, 180, 235, 270, 240, 285, 164, 152]
paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.diffPopulationMean2UnEquVar(xi1, xi2)
=> -1.636

Returns 検定統計量.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (double)

    検定統計量



101
102
103
104
105
# File 'lib/num4tststatistic.rb', line 101

def diffPopulationMean2UnEquVar(xi1, xi2)
    return @paramTest.diffPopulationMean2UnEquVar(
        xi1.to_java(Java::double), xi2.to_java(Java::double)
    )
end

#diffPopulationRatio(m1, n1, m2, n2) ⇒ double

Note:

標準正規分布 N(0,1*1)に従う

2つの母比率の差の検定量

Examples:

paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.diffPopulationRatio(469, 1200, 308, 900)
=> 2.283

Returns 検定統計量.

Parameters:

  • m1 (int)

    m1値

  • n1 (int)

    N1値

  • m2 (int)

    m2値

  • n2 (int)

    N2値

Returns:

  • (double)

    検定統計量



175
176
177
# File 'lib/num4tststatistic.rb', line 175

def diffPopulationRatio(m1, n1, m2, n2)
    return @paramTest.diffPopulationRatio(m1, n1, m2, n2)
end

#diffPopulationVar(xi1, xi2) ⇒ double

Note:

自由度(N1-1,N2-1)のF分布に従う

2つの母分散の差の検定量

Examples:

xi1 = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
xi2 = [180, 180, 235, 270, 240, 285, 164, 152]
paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.diffPopulationVar(xi1, xi2)
=> 0.4727

Returns 検定統計量.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (double)

    検定統計量



156
157
158
159
160
# File 'lib/num4tststatistic.rb', line 156

def diffPopulationVar(xi1, xi2)
    return @paramTest.diffPopulationVar(
        xi1.to_java(Java::double), xi2.to_java(Java::double)
    )
end

#fidelity(fi, pi) ⇒ double

Note:

自由度(n-1)の階2乗分布に従う

適合度の検定量

Examples:

fi = [57, 33, 46, 14]
pi = [0.4, 0.2, 0.3, 0.1]
paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.fidelity(fi, pi)
=> 0.5389

Returns 検定統計量.

Parameters:

  • fi (Array)

    実測度数(double[])

  • pi (Array)

    比率(double[])

Returns:

  • (double)

    検定統計量



210
211
212
# File 'lib/num4tststatistic.rb', line 210

def fidelity(fi, pi)
    return @paramTest.fidelity(fi.to_java(Java::double), pi.to_java(Java::double))
end

#independency(fij) ⇒ double

Note:

自由度(m-1)(n-1)の階2乗分布に従う

独立性の検定量

Examples:

fij = [
  [57, 33, 46, 14],
  [89, 24, 75, 12],
]
paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.independency(fij)
=> 8.5711

Returns 検定統計量.

Parameters:

Returns:

  • (double)

    検定統計量



228
229
230
# File 'lib/num4tststatistic.rb', line 228

def independency(fij)
    return @paramTest.independency(fij.to_java(Java::double[]))
end

#pearsoCorrelation(x, y) ⇒ double

ピアソン相関係数

(相関係数の検定)

Examples:

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

Returns 相関係数.

Parameters:

  • x (Array)

    xのデータ(double[])

  • y (Array)

    yのデータ(double[])

Returns:

  • (double)

    相関係数



191
192
193
194
195
# File 'lib/num4tststatistic.rb', line 191

def pearsoCorrelation(x, y)
    return @paramTest.pearsoCorrelation(
        x.to_java(Java::double), y.to_java(Java::double)
    )
end

#populationMean(xi, m0) ⇒ double

Note:

自由度(N-1)のt分布に従う

正規母集団の母平均の検定量

Examples:

xi = [15.5, 15.7, 15.4, 15.4, 15.6, 15.4, 15.6, 15.5, 15.4]
paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.populationMean(xi, 15.4)
=> 2.683

Returns 検定統計量.

Parameters:

  • xi (Array)

    データ(double[])

  • m0 (double)

    母平均

Returns:

  • (double)

    検定統計量



30
31
32
# File 'lib/num4tststatistic.rb', line 30

def populationMean(xi, m0)
    return @paramTest.populationMean(xi.to_java(Java::double), m0)
end

#populationRatio(m, n, p0) ⇒ double

Note:

標準正規分布 N(0,1*1)に従う

母比率の検定量

Examples:

paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.populationRatio(29, 346, 0.12)
=> -2.071

Returns 検定統計量.

Parameters:

  • m (int)

    m値

  • n (int)

    N値

  • p0 (double)

    母比率

Returns:

  • (double)

    検定統計量



63
64
65
# File 'lib/num4tststatistic.rb', line 63

def populationRatio(m, n, p0)
    return @paramTest.populationRatio(m, n, p0)
end

#populationVar(xi, sig0) ⇒ double

Note:

自由度(N-1)の階2乗分布に従う

正規母集団の母分散の検定量

Examples:

xi = xi = [35.2, 34.5, 34.9, 35.2, 34.8, 35.1, 34.9, 35.2, 34.9, 34.8]
sd = 0.4
paraTest = Num4TstStatisticLib::ParametrixTestLib.new
paraTest.populationVar(xi, sd*sd)
=> 2.906

Returns 検定統計量.

Parameters:

  • xi (Array)

    データ(double[])

  • sig0 (double)

    母分散

Returns:

  • (double)

    検定統計量



47
48
49
# File 'lib/num4tststatistic.rb', line 47

def populationVar(xi, sig0)
    return @paramTest.populationVar(xi.to_java(Java::double), sig0)
end