Using Stata 14.1 MP under Win 7E. I think this is more of a mata question, so I'll try posting here. If not, let me know and I'll put it on the general board. I've run a model with svy:logit. Now I want to recover the SEs. This means getting the square roots of the diagonals of the covariance matrix. I typically use the following to process a covariance matrix :
However, that seems not to work for a GLM, presumably due to the zero row and column for the intercept term (I have two IVs). Thus, I need to delete those rows/columns first.
Assume v=e(V). In mata, I could use something along the lines of:
But that leaves unanswered how to get the covariance matrix into mata and then back out. Plus, I think it's missing an argument for that purpose.
Here's what I'm envisioning (just not syntactically correct):
I need a way to translate the matrix v into mata and then x back out. Any tips appreciated.
Code:
matrix se=vecdiag(cholesky(diag(vecdiag(v))))'
Assume v=e(V). In mata, I could use something along the lines of:
Code:
x= select(select(v, rowsum(abs(v))),colsum(abs(v)))
Here's what I'm envisioning (just not syntactically correct):
Code:
matrix v=e(V) //save covariance matrix from svylogit mata: x= select(select(v, rowsum(abs(v))),colsum(abs(v))) //select the non-zero rows and columns, this needs an additional argument after the first parenthesis matrix se=vecdiag(cholesky(diag(vecdiag(x))))' //compute SEs
Comment