# Posts Tagged ‘ Matrix Computations ’

## Singular parameterizations, generalized inverses, and regression estimates

November 28, 2018
By

I remember the first time I used PROC GLM in SAS to include a classification effect in a regression model. I thought I had done something wrong because the parameter estimates table was followed by a scary-looking note: Note: The X'X matrix has been found to be singular, and a

Tags: , ,
Posted in SAS | Comments Off on Singular parameterizations, generalized inverses, and regression estimates

## Generalized inverses for matrices

November 21, 2018
By

A data analyst asked how to compute parameter estimates in a linear regression model when the underlying data matrix is rank deficient. This situation can occur if one of the variables in the regression is a linear combination of other variables. It also occurs when you use the GLM parameterization

Tags: , ,
Posted in SAS | Comments Off on Generalized inverses for matrices

## Transpose blocks to reshape data

October 22, 2018
By

A SAS programmer asked how to rearrange elements of a matrix. The rearrangement he wanted was rather complicated: certain blocks of data needed to move relative to other blocks, but the values within each block were to remain unchanged. It turned out that the mathematical operation he needed is called

Tags: , ,
Posted in SAS | Comments Off on Transpose blocks to reshape data

## Fast simulation of multivariate normal data with an AR(1) correlation structure

October 3, 2018
By

It is sometimes necessary for researchers to simulate data with thousands of variables. It is easy to simulate thousands of uncorrelated variables, but more difficult to simulate thousands of correlated variables. For that, you can generate a correlation matrix that has special properties, such as a Toeplitz matrix or a

Tags: , , ,
Posted in SAS | Comments Off on Fast simulation of multivariate normal data with an AR(1) correlation structure

## The intersection of two line segments

July 9, 2018
By

Back in high school, you probably learned to find the intersection of two lines in the plane. The intersection requires solving a system of two linear equations. There are three cases: (1) the lines intersect in a unique point, (2) the lines are parallel and do not intersect, or (3)

Tags: , ,
Posted in SAS | Comments Off on The intersection of two line segments

## The sweep operator: A fundamental operation in regression

April 18, 2018
By

The sweep operator performs elementary row operations on a system of linear equations. The sweep operator enables you to build regression models by "sweeping in" or "sweeping out" particular rows of the X`X matrix. As you do so, the estimates for the regression coefficients, the error sum of squares, and

Tags: , ,
Posted in SAS | Comments Off on The sweep operator: A fundamental operation in regression

## Find the unique rows of a numeric matrix

April 11, 2018
By

Sometimes it is important to ensure that a matrix has unique rows. When the data are all numeric, there is an easy way to detect (and delete!) duplicate rows in a matrix. The main idea is to subtract one row from another. Start with the first row and subtract it

Tags: ,
Posted in SAS | Comments Off on Find the unique rows of a numeric matrix

March 21, 2018
By

I often claim that the "natural syntax" of the SAS/IML language makes it easy to implement an algorithm or statistical formula as it appears in a textbook or journal. The other day I had an opportunity to test the truth of that statement. A SAS programmer wanted to implement the

Tags: ,

## 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.