Class: Num4GLMRegAnaLib::ProBitRegAnaLib

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

Overview

プロビット回帰分析

Instance Method Summary collapse

Constructor Details

#initializeProBitRegAnaLib

Returns a new instance of ProBitRegAnaLib.



181
182
183
# File 'lib/num4glmregana.rb', line 181

def initialize
    @multana = ProBitRegAna.getInstance()
end

Instance Method Details

#get_aic(regcoe, xij) ⇒ Object

AIC

Examples:

reg = {
     :intercept=>  -5.0497,    # 定数項
     :slope=>      [2.2379, 0.2973],     # 回帰係数
}
xij = [
     [1, 24],
     [1, 18],
     [0, 15],
     [1, 16],
     [0, 10],
     [1, 26],
     [1, 2],
     [0, 24],
     [1, 18],
     [1, 22],
     [1, 3],
     [1, 6],
     [0, 15],
     [0, 12],
     [1, 6],
     [0, 6],
     [1, 12],
     [0, 12],
     [1, 18],
     [1, 3],
     [1, 8],
     [0, 9],
     [0, 12],
     [0, 6],
     [0, 8],
     [1, 12],
]
regana = Num4RegAnaLib::ProBitRegAnaLib.new
regana.get_aic(reg, xij)
=> 119.674

Returns double AIC値.

Parameters:

  • regcoe (Hash)

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

  • xij (Array)

Returns:

  • double AIC値



277
278
279
280
281
282
# File 'lib/num4glmregana.rb', line 277

def get_aic(regcoe, xij)
    o = HashMap.new
    o["intercept"] = regcoe[:intercept]
    o["slope"]     = regcoe[:slope].to_java(Java::double)
    @multana.getAIC(o, xij.to_java(Java::double[]))
end

#non_line_reg_ana(yi, xij) ⇒ Hash

プロビット回帰分析

Examples:

glsyi = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
glsxij = [
     [1, 24],
     [1, 18],
     [0, 15],
     [1, 16],
     [0, 10],
     [1, 26],
     [1, 2],
     [0, 24],
     [1, 18],
     [1, 22],
     [1, 3],
     [1, 6],
     [0, 15],
     [0, 12],
     [1, 6],
     [0, 6],
     [1, 12],
     [0, 12],
     [1, 18],
     [1, 3],
     [1, 8],
     [0, 9],
     [0, 12],
     [0, 6],
     [0, 8],
     [1, 12],
]
regana = Num4RegAnaLib::ProBitRegAnaLib.new
regana.non_line_reg_ana(glsyi, glsxij)
=> 
  {
     "intercept":  -5.0497,    # 定数項
     "slope":      [2.2379, 0.2973],     # 回帰係数
  }

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

Parameters:

Returns:

  • (Hash)

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



227
228
229
230
231
232
233
234
# File 'lib/num4glmregana.rb', line 227

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