On 16 March 2011 02:53, dileep kunjaai <dileepkunj...@gmail.com> wrote: > Dear sir, > Can we do multiple linear regression(MLR) in python.... is there any > inbuilt function for MLR
Yes, you can use np.linalg.lstsq [1] for this. Here's a quick example: import numpy as np # model is y = b0.x0 + b1.x1 + b2.x2 b = np.array([3.,2.,1.]) noise = np.random.standard_normal(size=(10,3)) * 0.1 bn = b[None] + noise x = np.random.standard_normal(size=(10,3)) y = np.sum(bn * x, axis=1) be = np.linalg.lstsq(x,y) and be[0] should be close to the original b (3,2,1.). [1] http://docs.scipy.org/doc/numpy-1.4.x/reference/generated/numpy.linalg.lstsq.html > -- > DILEEPKUMAR. R > J R F, IIT DELHI -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion