Class: Num4GLMRegAnaLib::PoissonRegAnaLib

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

Overview

ポアソン回帰分析

Instance Method Summary collapse

Constructor Details

#initializePoissonRegAnaLib

Returns a new instance of PoissonRegAnaLib.



120
121
122
# File 'lib/num4glmregana.rb', line 120

def initialize
    @multana = PoissonRegAna.getInstance()
end

Instance Method Details

#get_aic(regcoe, xij) ⇒ Object

AIC

Examples:

reg = {
     :intercept => 1.3138,    # 定数項
     :slope    =>  [0.3173],  # 回帰係数
}
xij = [
    [1],
    [2],
    [3],
    [4],
]
regana = Num4RegAnaLib::PoissonRegAnaLib.new
regana.get_aic(reg, xij)
=> -12.856

Returns double AIC値.

Parameters:

  • regcoe (Hash)

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

  • xij (Array)

Returns:

  • double AIC値



172
173
174
175
176
177
# File 'lib/num4glmregana.rb', line 172

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 = [4, 10, 7, 14]
glsxij = [
    [1],
    [2],
    [3],
    [4],
]
regana = Num4RegAnaLib::PoissonRegAnaLib.new
regana.non_line_reg_ana(glsyi, glsxij)
=> 
  {
     "intercept":  1.3138,    # 定数項
     "slope":      [0.3173],  # 回帰係数
  }

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

Parameters:

Returns:

  • (Hash)

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



144
145
146
147
148
149
150
151
# File 'lib/num4glmregana.rb', line 144

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