Posts Tagged ‘ Matrix Computations ’

Singular parameterizations, generalized inverses, and regression estimates

November 28, 2018
By
Singular parameterizations, generalized inverses, and regression estimates

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

The post Read more »

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

The post Read more »

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

Transpose blocks to reshape data

October 22, 2018
By
Transpose blocks to reshape data

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

The post Read more »

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
Fast simulation of multivariate normal data with an AR(1) correlation structure

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

The post Read more »

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
The intersection of two line segments

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)

The post Read more »

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: A fundamental operation in regression

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

The post Read more »

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
Find the unique rows of a numeric matrix

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

The post Read more »

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

The conjugate gradient method

March 21, 2018
By
The conjugate gradient method

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

The post Read more »

Tags: ,
Posted in SAS | Comments Off on The conjugate gradient method

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.

Sponsors







Dear readers, proc-x is looking for sponsors who would be willing to support the site in exchange for banner ads in the right sidebar of the site. If you are interested, please e-mail me at: tal.galili@gmail.com
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.