Random Stata Error Series: “diagonal elements should be 1”

If you try to use the correlation matrix from either corr or spearman  in drawnorm, Stata sometimes give you this error. The issue is the correlation matrix seems to be in float precision, but Stata logical operations work in double precision.

One way to get around this problem is to manually replace all diagonal elements with 1. By ‘manual’ I mean use a script of course.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.