4
One of the ways to find the estimator using the method of least ordinary squares is by generating random matrices, given by the formula:
B = (X’ X)^-1 X’Y
Where Y = a+bx+cw+u
, being x
and w
random vectors of size 1000 and distribution N(1,2)
.
The matrix X
has 3 columns, the first 1 being the second x
and the third w
, and 1000 lines. After the generation of this random matrix it is necessary to perform one for this procedure to be repeated 1000 times.
However, as I did not guarantee that the product (X' X)
generated an invertible matrix, the for gave me 1000 equal results, thus changing the x
, the w
and the y
.
I am trying to realize this condition by the if but am not succeeding. I wonder if there are any commands that assure me that the matrix has inverse.
Livia, Voce could put what you did? It would be very difficult for the matrix not to have inverse using random numbers.
– Carlos Cinelli