Due to a bug (perhaps in the numpy distribution I’m using), I can’t use numpy.linalg.lstsq. And every statistics library I found didn’t install under python 3 (on Windows).
Does someone have pure python 3 code that would perform a multiple linear regression (I just need the betas)?
If not pure python, I could still try it, if maybe the code happens to not use the same C function that crashes numpy.linalg.lstsq on my machine.
Thanks!
here is the version using this matlib.py by Ernesto P. Adorio. From him you need
With these following code find coeff of linear regression
Took test data from here: Multiple Regression in Data Mining, which looks like
with sample output (NOTE: this is not my output, the example’s!!)
Multiple R-squared 0.656 Residual SS 738.900 Std. Dev. Estimate 7.539 Coefficient StdError t-statistic p-value Constant 13.182 16.746 0.787 0.445 X1 0.583 0.232 2.513 0.026 X2 -0.044 0.167 -0.263 0.797 X3 0.329 0.219 1.501 0.157 X4 -0.057 0.317 -0.180 0.860 X5 0.112 0.196 0.570 0.578 X6 -0.197 0.247 -0.798 0.439The code above printed this. Need more flipping textbook to do the stdev etc. but got the number i expected for coeffs.