Posts Tagged ‘ Matrix Computations ’

When is a correlation matrix not a correlation matrix?

September 12, 2012
By
When is a correlation matrix not a correlation matrix?

This article is an excerpt from my forthcoming book Simulating Data with SAS. Not every matrix with 1 on the diagonal and off-diagonal elements in the range is a valid correlation matrix. A correlation matrix has a special property known as positive semidefiniteness. All correlation matrices are positive
Read more »

Tags: , ,
Posted in SAS | Comments Off

Construct a magic square of any size

August 29, 2012
By
Construct a magic square of any size

Magic squares are cool. Algorithms that create magic squares are even cooler. You probably remember magic squares from your childhood: they are n x n matrices that contain the numbers 1,2,...,n2 and for which the row sum, column sum, and the sum of both diagonals are the same value. There are many
Read more »

Tags: , ,
Posted in SAS | Comments Off

Extract the lower triangular elements of a matrix

August 16, 2012
By
Extract the lower triangular elements of a matrix

It is common to want to extract the lower or upper triangular elements of a matrix. For example, if you have a correlation matrix, the lower triangular elements are the nontrivial correlations between variables in your data. As I've written before, you can use the VECH function to extract the
Read more »

Tags: , , ,
Posted in SAS | Comments Off

The power operators: Powers of matrices and matrix elements

July 30, 2012
By
The power operators: Powers of matrices and matrix elements

I received the following question: In the DATA step I always use the ** operator to raise a values to a power, like this: x**2. But on your blog I you use the ## operator to raise values to a power in SAS/IML programs. Does SAS/IML not support the **
Read more »

Tags: , ,
Posted in SAS | Comments Off

Compute the multivariate normal denstity in SAS

July 5, 2012
By
Compute the multivariate normal denstity in SAS

I've been working on a new book about Simulating Data with SAS. In researching the chapter on simulation of multivariate data, I've noticed that the probability density function (PDF) of multivariate distributions is often specified in a matrix form. Consequently, the multivariate density can usually be computed by using the
Read more »

Tags: , , ,
Posted in SAS | Comments Off

The curious case of random eigenvalues

May 16, 2012
By
The curious case of random eigenvalues

I've been a fan of statistical simulation and other kinds of computer experimentation for many years. For me, simulation is a good way to understand how the world of statistics works, and to formulate and test conjectures. Last week, while investigating the efficiency of the power method for finding dominant
Read more »

Tags: , , ,
Posted in SAS | Comments Off

The power method: compute only the largest eigenvalue of a matrix

May 9, 2012
By
The power method: compute only the largest eigenvalue of a matrix

When I was at SAS Global Forum last week, a SAS user asked my advice regarding a SAS/IML program that he wrote. One step of the program was taking too long to run and he wondered if I could suggest a way to speed it up. The long-running step was
Read more »

Tags: , , ,
Posted in SAS | Comments Off

Generate a random matrix with specified eigenvalues

March 30, 2012
By
Generate a random matrix with specified eigenvalues

In a previous post I showed how to implement Stewart's (1980) algorithm for generating random orthogonal matrices in SAS/IML software. By using the algorithm, it is easy to generate a random matrix that contains a specified set of eigenvalues. If D = diag(λ1, ..., λp) is a diagonal matrix and
Read more »

Tags: , , ,
Posted in SAS | Comments Off

Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.