Hello, good afternoon,
I’m facing issues to solve least squares in julia using qr decomposition.
numcourses = [13,4,12,3,14,13,12,9,11,7,13,11,9,2,5,7,10,0,9,7]
happiness = [70,25,54,21,80,68,84,62,57,40,60,64,45,38,51,52,58,21,75,70]
X = [ones(length(numcourses)) numcourses]
F = qr(X)
beta = inv(F.R) * (F.Q' * happiness)
The inv(F.R) is 2x2 matrix anf fails to multiply the result of F.Q * happiness.
Same code in python works as expected and I had checked vector and matrices sizes. Hadamard and broadcast cant be used also
beta = np.linalg.inv(R) @ (Q.T@happiness)