Created
August 17, 2013 16:52
-
-
Save omphalos/6257772 to your computer and use it in GitHub Desktop.
multiple regression with sylvester
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var sylvester = require('sylvester') | |
| function multipleRegression(x, y) { | |
| var X = $M(x) | |
| , Y = $M(y) | |
| , Xt = X.transpose() | |
| , regression = Xt.multiply(X).inverse().multiply(Xt).multiply(Y) | |
| return regression | |
| } | |
| var x = [ | |
| [8,3,9], | |
| [2,0,7], | |
| [1,9,3] | |
| ] | |
| var y = [[10,1], [21,2], [31,3]] | |
| console.log('result', multipleRegression(x, y)) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://luna.cas.usf.edu/~mbrannic/files/regression/regma.htm for more detail