lib/glm/linear.rb in glm-0.0.1 vs lib/glm/linear.rb in glm-0.0.2
- old
+ new
@@ -11,17 +11,18 @@
# Canonical response function
# It's identity function here, obviously
def self.g(eta)
return eta
end
-
+
+ #Normal equation estimation
def ne_est(x)
@theta = ne_fit
- [@theta, x * Matrix.column_vector(@theta)]
+ [@theta, x * @theta]
end
#Normal equation fit
def ne_fit
- (( @x.t * @x ).inverse * @x.t * @y).to_a.flatten
+ ( @x.transpose * @x ).invert * @x.transpose * @y
end
end