Class: Num4AnovaLib::OneWayLayoutLib

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

Overview

一元配置の分散分析

Instance Method Summary collapse

Constructor Details

#initializeOneWayLayoutLib

Returns a new instance of OneWayLayoutLib.



15
16
17
# File 'lib/num4anova.rb', line 15

def initialize
    @oneWay = OneWayLayout.getInstance()
end

Instance Method Details

#bartlet(xi, a) ⇒ boolean

バートレット検定

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],
]
oneWay = Num4AnovaLib::OneWayLayoutLib.new 
oneWay.bartlet(xi, 0.05)
=> true

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

Parameters:

Returns:

  • (boolean)

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



107
108
109
# File 'lib/num4anova.rb', line 107

def bartlet(xi, a)
    return @oneWay.bartletTest(xi.to_java(Java::double[]), a)
end

#boxWhiskerPlot(dname, vals) ⇒ void

Note:

グラフは、jfreechartを使用

箱ひげ図

Examples:

vals = {
      "stage51" => [12.2, 18.8, 18.2],
      "stage55" => [22.2, 20.5, 14.6],
      "stage57" => [20.8, 19.5, 26.3],
      "stage59" => [26.4, 32.5, 31.3],
      "stage61" => [24.5, 21.2, 22.4],
    }
oneWay = Num4AnovaLib::OneWayLayoutLib.new 
oneWay.boxWhiskerPlot("LDH", vals)
=> boxWhisker.jpeg

This method returns an undefined value.

Returns boxWhisker.jpegファイルを出力.

Parameters:

  • dname (String)

    データ名

  • vals (Hash)

    Hash(String, double[])



37
38
39
40
41
42
43
# File 'lib/num4anova.rb', line 37

def boxWhiskerPlot(dname, vals)
    o = HashMap.new
    vals.each{|k, v|
        o[k] = v.to_java(Java::double)
    }
    @oneWay.boxWhiskerPlot(dname, o)
end

#kruskalwallis_test(xi, a) ⇒ boolean

クラスカル・ウォリスの検定

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],
]
oneWay = Num4AnovaLib::OneWayLayoutLib.new 
oneWay.kruskalwallis_test(xi, 0.05)
=> true

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

Parameters:

Returns:

  • (boolean)

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



169
170
171
# File 'lib/num4anova.rb', line 169

def kruskalwallis_test(xi, a)
    return @oneWay.kruskalWallisTest(xi.to_java(Java::double[]), a)
end

#oneway_anova(xi, a) ⇒ boolean

一元配置分散分析

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],
]
oneWay = Num4AnovaLib::OneWayLayoutLib.new 
oneWay.oneWay.oneway_anova(xi, 0.05)
=> true

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

Parameters:

Returns:

  • (boolean)

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



87
88
89
# File 'lib/num4anova.rb', line 87

def oneway_anova(xi, a)
    return @oneWay.onewayanova(xi.to_java(Java::double[]), a)
end

#oneway_scatter_plot(dname, vals) ⇒ void

Note:

グラフは、jfreechartを使用

一元散布図

Examples:

vals = {
      "stage51" => [12.2, 18.8, 18.2],
      "stage55" => [22.2, 20.5, 14.6],
      "stage57" => [20.8, 19.5, 26.3],
      "stage59" => [26.4, 32.5, 31.3],
      "stage61" => [24.5, 21.2, 22.4],
    }
oneWay = Num4AnovaLib::OneWayLayoutLib.new 
oneWay.oneway_scatter_plot("LDH", vals)
=> scatter.jpeg

This method returns an undefined value.

Returns scatter.jpegファイルを出力.

Parameters:

  • dname (String)

    データ名

  • vals (Hash)

    Hash(String, double[])



63
64
65
66
67
68
69
# File 'lib/num4anova.rb', line 63

def oneway_scatter_plot(dname, vals)
    o = HashMap.new
    vals.each{|k, v|
        o[k] = v.to_java(Java::double)
    }
    @oneWay.oneWayScatterPlot(dname, o)
end

#replicate_plot(dname, vals) ⇒ void

Note:

グラフは、jfreechartを使用

反復測定Plot

Examples:

vals = {
     "stageA1" => [27, 52, 18, 21, 32],
     "stageA2" => [52, 72, 31, 50, 45],
     "stageA3" => [47, 54, 29, 43, 32],
     "stageA4" => [28, 50, 22, 26, 29],
    }
oneWay = Num4AnovaLib::OneWayLayoutLib.new 
oneWay.replicate_plot("LDH", vals)
=> replicate.jpeg

This method returns an undefined value.

Returns replicate.jpegファイルを出力.

Parameters:

  • dname (String)

    データ名

  • vals (Hash)

    Hash(String, double[])



128
129
130
131
132
133
134
# File 'lib/num4anova.rb', line 128

def replicate_plot(dname, vals)
    o = HashMap.new
    vals.each{|k, v|
        o[k] = v.to_java(Java::double)
    }
    return @oneWay.replicatePlot(dname, o)
end

#replicate_test(xi, a) ⇒ boolean

反復測定検定

Examples:

xi = [
    [27, 52, 18, 21, 32],
    [52, 72, 31, 50, 45],
    [47, 54, 29, 43, 32],
    [28, 50, 22, 26, 29],
]
oneWay = Num4AnovaLib::OneWayLayoutLib.new 
oneWay.replicate_test(xi, 0.05)
=> true

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

Parameters:

Returns:

  • (boolean)

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



151
152
153
# File 'lib/num4anova.rb', line 151

def replicate_test(xi, a)
    return @oneWay.replicateTest(xi.to_java(Java::double[]), a)
end