But it throws the error I mentioned earlier. This is real data, and it’s not synthetic. Can increasing the number of data points (by adding more rows or/and columns) solve the problem?
P.S.: Here is the result of Xₜ⁽ˡ⁾'*Xₜ⁽ˡ⁾:
In general you shouldn’t be using the normal equations. Rather than computing (Xₜ⁽ˡ⁾'*Xₜ⁽ˡ⁾)^-1, you should probably be using a linear solve with Xₜ⁽ˡ⁾ (using a factorization like Qr if you need to do multiple solves).
It might, since the problem is with the determinant of (Xₜ⁽ˡ⁾'*Xₜ⁽ˡ⁾). I’m trying to implement an algorithm that is published in a high-ranked journal. I can not believe they have not encountered this problem, since I have used real data as well. Hence, there are two possibilities:
They’ve employed the algorithm on much more data.
They might somehow handled this trough a different procedure.
so rather than computing (Xₜ⁽ˡ⁾'*Xₜ⁽ˡ⁾)^-1*(Xₜ⁽ˡ⁾'*v), you can just compute Xₜ⁽ˡ⁾\v which will automatically compute a least-squares or minimum norm solution depending on whether you are over or under-determined.