Class: Num4GLMMRegAnaLib::PoissonBayesRegAnaLib

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

Overview

ベイズポアソン回帰分析

Instance Method Summary collapse

Constructor Details

#initializePoissonBayesRegAnaLib

Returns a new instance of PoissonBayesRegAnaLib.



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

def initialize
    @multana = PoissonBayesRegAna.getInstance()
end

Instance Method Details

#get_bic(regcoe, xij) ⇒ Object

BIC

Examples:

reg = {
     :intercept=>0.4341885635221602, # 定数項
     :slope=>[0.5703137378188881]    # 回帰係数
}
xij = [
    [1],
    [2],
    [3],
    [4],
]
regana = Num4GLMMRegAnaLib::BayesPoissonRegAnaLib.new
regana.get_bic(reg, xij)
=> -13.157

Returns double BIC値.

Parameters:

  • regcoe (Hash)

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

  • xij (Array)

Returns:

  • double BIC値



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

def get_bic(regcoe, xij)
    o = HashMap.new
    o["intercept"] = regcoe[:intercept]
    o["slope"]     = regcoe[:slope].to_java(Java::double)
    @multana.getBIC(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 = Num4GLMMRegAnaLib::PoissonBayesRegAnaLib.new
regana.non_line_reg_ana(glsyi, glsxij)
=> 
  {
     :intercept=>0.4341885635221602, # 定数項
     :slope=>[0.5703137378188881]    # 回帰係数
  }

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

Parameters:

Returns:

  • (Hash)

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



144
145
146
147
148
149
150
151
# File 'lib/num4glmmregana.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