require 'glm/base' class GLM::Linear < GLM::Base def hi return "Hi, this is #{self.class}" end # Canonical response function # It's identity function here, obviously def self.g(eta) return eta end def ne_est(x) @theta = ne_fit [@theta, x * Matrix.column_vector(@theta)] end #Normal equation fit def ne_fit (( @x.t * @x ).inverse * @x.t * @y).to_a.flatten end end