Class: Num4GLMRegAnaLib::LogitRegAnaLib

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

Overview

(2項)ロジスティック回帰分析

Instance Method Summary collapse

Constructor Details

#initializeLogitRegAnaLib

Returns a new instance of LogitRegAnaLib.



13
14
15
# File 'lib/num4glmregana.rb', line 13

def initialize
    @multana = LogitRegAna.getInstance()
end

Instance Method Details

#non_line_reg_ana(yi, xij) ⇒ Hash

(2項)ロジスティック回帰分析

Examples:

glsyi = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
glsxij = [
    [95],
    [90],
    [85],
    [80],
    [80],
    [75],
    [70],
    [70],
    [65],
    [50],
    [60],
    [55],
    [45],
    [65],
    [40],
    [35],
    [55],
    [50],
    [50],
    [45],
]
regana = Num4RegAnaLib::LogitRegAnaLib.new
regana.non_line_reg_ana(glsyi, glsxij)
=> 
  {
    "intercept":  -17.81,    # 定数項
    "slope":      [0.16],    # 回帰係数
  }

Returns (intercept:定数項 slope:回帰係数).

Parameters:

Returns:

  • (Hash)

    (intercept:定数項 slope:回帰係数)



53
54
55
56
57
58
59
60
# File 'lib/num4glmregana.rb', line 53

def non_line_reg_ana(yi, xij)
    multRet = @multana.nonLineRegAna(yi.to_java(Java::double), xij.to_java(Java::double[]))
    retRb = {
        "intercept":  multRet.getIntercept(), # 定数項
        "slope":      multRet.getSlope().to_a,     # 回帰係数
    }
    return retRb
end