Statistical programming, matrix languages, and more

Matrix Correlation

Reply
Occasional Contributor
Posts: 13

Matrix Correlation

I have this data set here were the first x is sales, x2=profits, and x3=assets. Measurements are in millions of dollars.

 

Company                   X1        X2         X3

General Motors    126,974  4,224  173,297
Ford                       96,933  3,835  160,893
Exxon                    86,656  3,510    83,219
IBM                        63,438  3,758   77,734
General Electric    55,264  3,939  128,344
Mobil                     50,976  1,809    39,080
Philip Morris          39,069  2,946    38,528
Chrysler                36,156     359    51,038
Du Pont                35,209   2,480    34,715

 

I need to import the data manually and then I am asked to manually find correlation matrix using only matrix manipulation. I assume I somehow I use proc IML. If so, I'd have to create 3 matrices, correct? I don't know where to start.

 

Super User
Posts: 24,012

Re: Matrix Correlation

You should review how correlation is calculated in your textbook. Then start by searching using ‘SAS IML Correlation’.  The answer is fully in the documentation.  http://support.sas.com/documentation/cdl/en/imlug/66845/HTML/default/viewer.htm#imlug_genstatexpls_s... As to separating the data into 3 matrices, if you review how to calculate correlation that should answer your question. 

trash wrote:

I have this data set here were the first x is sales, x2=profits, and x3=assets. Measurements are in millions of dollars.

 

Company                   X1        X2         X3

General Motors    126,974  4,224  173,297
Ford                       96,933  3,835  160,893
Exxon                    86,656  3,510    83,219
IBM                        63,438  3,758   77,734
General Electric    55,264  3,939  128,344
Mobil                     50,976  1,809    39,080
Philip Morris          39,069  2,946    38,528
Chrysler                36,156     359    51,038
Du Pont                35,209   2,480    34,715

 

I need to import the data manually and then I am asked to manually find correlation matrix using only matrix manipulation. I assume I somehow I use proc IML. If so, I'd have to create 3 matrices, correct? I don't know where to start.

 


SAS Super FREQ
Posts: 4,275

Re: Matrix Correlation

See the article "Compute covariance and correlation matrices," which shows the four steps that you need to perform to compute a correlation matrix from a data matrix. In particular, you do not need to form three matrices. The three variables become three columns in a single data matrix.

Ask a Question
Discussion stats
  • 2 replies
  • 308 views
  • 0 likes
  • 3 in conversation