Page 1 of 1
inverse matrix and NA value
Posted: Wed Aug 19, 2020 11:15 am
by superjocker
Hi, I am trying to take the inverse of a matrix with one value which is an NA. I want the inverse of this matrix to be an NA as well but it gives me an error. Anyone knows how to do this?
NA found in matrix in ""
Thanks
Re: inverse matrix and NA value
Posted: Wed Aug 19, 2020 11:45 am
by EViews Gareth
There isn't an easy way to do this. But something like:
Code: Select all
Matrix b = matrix a
b = na
setmaxerrs 2
b = @inverse(a)
Where a is the matrix you're inverting.
Re: inverse matrix and NA value
Posted: Wed Aug 19, 2020 12:11 pm
by superjocker
Hi Gareth, yes it worked but the thing is I am running a loop when sometimes the inverse of the matrix is a number (because the matrix to inverse is a number matrix) and sometimes the inverse of the matrix gives me an error (because the matrix to inverse is a na matrix). I was trying to use your code with a @recode, but dindt work.
Re: inverse matrix and NA value
Posted: Wed Aug 19, 2020 1:41 pm
by EViews Gareth
Should still work. Just increase allowed errors
Re: inverse matrix and NA value
Posted: Thu Aug 20, 2020 11:15 am
by superjocker
Yes, it is working, thanks Gareth.