Module: Num4TstStatisticLib

Defined in:
lib/num4tststatistic.rb

Overview

検定統計量を計算

(Apache commoms math3使用)

Class Method Summary collapse

Class 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]
Num4TstStatisticLib.df4welch(xi1, xi2)
=> 11

Returns 自由度.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (int)

    自由度



104
105
106
107
108
# File 'lib/num4tststatistic.rb', line 104

def df4welch(xi1, xi2)
    return TstStatistic.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]
Num4TstStatisticLib.diffPopulationMean(xi1, xi2)
=> 2.283

Returns 検定統計量.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (double)

    検定統計量



122
123
124
125
126
# File 'lib/num4tststatistic.rb', line 122

def diffPopulationMean(xi1, xi2)
    return TstStatistic.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]
Num4TstStatisticLib.diffPopulationMean2EquVar(xi1, xi2)
=> -1.765

Returns 検定統計量.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (double)

    検定統計量



70
71
72
73
74
# File 'lib/num4tststatistic.rb', line 70

def diffPopulationMean2EquVar(xi1, xi2)
    return TstStatistic.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]
Num4TstStatisticLib.diffPopulationMean2UnEquVar(xi1, xi2)
=> -1.636

Returns 検定統計量.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (double)

    検定統計量



89
90
91
92
93
# File 'lib/num4tststatistic.rb', line 89

def diffPopulationMean2UnEquVar(xi1, xi2)
    return TstStatistic.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:

Num4TstStatisticLib.diffPopulationRatio(469, 1200, 308, 900)
=> 2.283

Returns 検定統計量.

Parameters:

  • m1 (int)

    m1値

  • n1 (int)

    N1値

  • m2 (int)

    m2値

  • n2 (int)

    N2値

Returns:

  • (double)

    検定統計量



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

def diffPopulationRatio(m1, n1, m2, n2)
    return TstStatistic.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]
Num4TstStatisticLib.diffPopulationVar(xi1, xi2)
=> 0.4727

Returns 検定統計量.

Parameters:

  • xi1 (Array)

    x1のデータ(double[])

  • xi2 (Array)

    x2のデータ(double[])

Returns:

  • (double)

    検定統計量



140
141
142
143
144
# File 'lib/num4tststatistic.rb', line 140

def diffPopulationVar(xi1, xi2)
    return TstStatistic.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]
Num4TstStatisticLib.fidelity(fi, pi)
=> 0.5389

Returns 検定統計量.

Parameters:

  • fi (Array)

    実測度数(double[])

  • pi (Array)

    比率(double[])

Returns:

  • (double)

    検定統計量



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

def fidelity(fi, pi)
    return TstStatistic.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],
]
Num4TstStatisticLib.independency(fij)
=> 8.5711

Returns 検定統計量.

Parameters:

  • fij (Array)

    実測度数(double[])

Returns:

  • (double)

    検定統計量



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

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

.populationCorre(x, y, rth0) ⇒ double

Note:

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

母相関係数の検定量

Examples:

x = [2750, 2956, 2675, 3198, 1816, 2233, 2375, 2288, 1932, 2036, 2183, 2882]
y = [249, 713, 1136, 575, 5654, 2107, 915, 4193, 7225, 3730, 472, 291]
Num4TstStatisticLib.populationCorre(x, y, -0.3)
=> -2.107168

Returns 検定統計量.

Parameters:

  • x (Array)

    xのデータ(double[])

  • y (Array)

    yのデータ(double[])

  • rth0 (double)

    母相関係数

Returns:

  • (double)

    検定統計量



193
194
195
196
197
# File 'lib/num4tststatistic.rb', line 193

def populationCorre(x, y, rth0)
    return TstStatistic.populationCorre(
        x.to_java(Java::double), y.to_java(Java::double), rth0
    )
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]
Num4TstStatisticLib.populationMean(xi, 15.4)
=> 2.683

Returns 検定統計量.

Parameters:

  • xi (Array)

    データ(double[])

  • m0 (double)

    母平均

Returns:

  • (double)

    検定統計量



23
24
25
# File 'lib/num4tststatistic.rb', line 23

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

.populationRatio(m, n, p0) ⇒ double

Note:

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

母比率の検定量

Examples:

Num4TstStatisticLib.populationRatio(29, 346, 0.12)
=> -2.071

Returns 検定統計量.

Parameters:

  • m (int)

    m値

  • n (int)

    N値

  • p0 (double)

    母比率

Returns:

  • (double)

    検定統計量



53
54
55
# File 'lib/num4tststatistic.rb', line 53

def populationRatio(m, n, p0)
    return TstStatistic.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
Num4TstStatisticLib.populationVar(xi, sd*sd)
=> 2.906

Returns 検定統計量.

Parameters:

  • xi (Array)

    データ(double[])

  • sig0 (double)

    母分散

Returns:

  • (double)

    検定統計量



39
40
41
# File 'lib/num4tststatistic.rb', line 39

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

.unCorrelation(x, y) ⇒ double

Note:

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

無相関の検定量

Examples:

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

Returns 検定統計量.

Parameters:

  • x (Array)

    xのデータ(double[])

  • y (Array)

    yのデータ(double[])

Returns:

  • (double)

    検定統計量



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

def unCorrelation(x, y)
    return TstStatistic.unCorrelation(
        x.to_java(Java::double), y.to_java(Java::double)
    )
end