|Title||Obtaining the correlation matrix|
|Author||William Gould, StataCorp|
The correlate command will report the correlation matrix of the data, but there are occasions when you need the matrix stored as a Stata matrix so you can further manipulate it. You can obtain it by typing
. matrix accum R = varlist, nocons dev . matrix R = corr(R)
The first line places the cross-product matrix of the data in R. The second line converts that to a correlation matrix.
Classroom & web training
Teaching with Stata
Statalist: The Stata Forum
Last updated: 16 November 2022
StataCorp LLC (StataCorp) strives to provide our users with exceptional products and services. To do so, we must collect personal information from you. This information is necessary to conduct business with our existing and potential customers. We collect and use this information only where we may legally do so. This policy explains what personal information we collect, how we use it, and what rights you have to that information.
These cookies are essential for our website to function and do not store any personally identifiable information. These cookies cannot be disabled.
Please note: Clearing your browser cookies at any time will undo preferences saved here. The option selected here will apply only to the device you are currently using.