I am new to R and trying to figure out how you can calculate an inverse matrix that is not square. (non-square? irregular? I'm not sure of the correct terminology).
From my book and a quick Google search (see source ), I found that you can use the solve(a)inverse matrix to search if it a is square.
The matrix I created is, and from what I understand, it’s not a square:
> matX<-matrix(c(rep(1, 8),2,3,4,0,6,4,3,7,-2,-4,3,5,7,8,9,11), nrow=8, ncol=3);
> matX
[,1] [,2] [,3]
[1,] 1 2 -2
[2,] 1 3 -4
[3,] 1 4 3
[4,] 1 0 5
[5,] 1 6 7
[6,] 1 4 8
[7,] 1 3 9
[8,] 1 7 11
>
Is there a function to solve a matrix of this size or do I need to do something for each element? as the function solve()gives this error:
Error in solve.default(matX) : 'a' (8 x 3) must be square
The calculation that I am trying to achieve from the above matrix is as follows: (matX'matX)^-1
Thanks in advance.