Author

RSS
Distinguished Researcher in Computational Statistics

Rick Wicklin, PhD, is a distinguished researcher in computational statistics at SAS and is a principal developer of SAS/IML software. His areas of expertise include computational statistics, simulation, statistical graphics, and modern methods in statistical data analysis. Rick is author of the books Statistical Programming with SAS/IML Software and Simulating Data with SAS.

Advanced Analytics
0
Creating a tridiagonal matrix

I was recently asked how to create a tridiagonal matrix in SAS/IML software. For example, how can you easily specify the following symmetric tridiagonal matrix without typing all of the zeros? proc iml; m = {1 6 0 0 0, 6 2 7 0 0, 0 7 3 8 0,

Advanced Analytics
0
Looping versus LOC-ing revisited

In a previous post, I discussed how to use the LOC function to eliminate loops over observations. Dale McLerran chimed in to remind me that another way to improve efficiency is to use subscript reduction operators. I ended my previous post by issuing a challenge: can you write an efficient

Advanced Analytics
0
Top Ten Government Web Sites for Downloading Data

Today is World Statistics Day, an event set up to "highlight the role of official statistics and the many achievements of the national statistical system." I want to commemorate World Statistics Day by celebrating the role of the US government in data collection and dissemination. Data analysis begins with data.

Advanced Analytics
0
What is IMLPlus?

The IMLPlus language has been available to SAS customers since 2002, but there are still many people who have never heard of it. What is IMLPlus? The documentation SAS/IML Studio for SAS/STAT Users says this about IMLPlus: The programming language in SAS/IML Studio, which is called IMLPlus, is an enhanced

Advanced Analytics
0
Solving scrambled-word puzzles

Have you ever been stuck while trying to solve a scrambled-word puzzle? You stare and stare at the letters, but no word reveals itself? You are stumped. Stymied. I hope you didn't get stumped on the word puzzle I posted as an anniversary present for my wife. She breezed through

Advanced Analytics
0
The lady tasting tea

A few people asked me to explain the significance of the cartoon in the scrambled-word puzzle that I posted as an anniversary present for my wife. The cartoon refers to a famous experiment devised by Sir Ronald A. Fisher.

Advanced Analytics
0
Generate all permutations in SAS

In a previous post, I discussed how to generate random permutations of N elements. But what if you want to systematically iterate through a list of ALL permutations of N elements? In the SAS DATA step you can use the ALLPERM subroutine in the SAS DATA step. For example, the

Advanced Analytics
0
A statistical word puzzle!

Today's post is a puzzle. Why? Well, my wife loves solving word puzzles, and today is our wedding anniversary. Last year, I bought her a Jumble® book. This year, I've created a one-of-a-kind scrambled word puzzle just for her. (But you can play, too!) I created this puzzle by using

Advanced Analytics
0
How can you reshape a matrix?

Sometimes it is convenient to reshape the data in a matrix. Suppose you have a 1 x 12 matrix. This same data can fit into several matrices with different dimensions: a 2 x 6 matrix, a 3 x 4 matrix, a 4 x 3 matrix, and so on. The SHAPE function enables you to specify the number of

Advanced Analytics
0
Scrambling (and unscrambling) words

My previous post on creating a random permutation started me thinking about word games. My wife loves to solve the daily Jumble® puzzle that runs in our local paper. The puzzle displays a string of letters like MLYBOS, and you attempt to unscramble the letters to make an ordinary word.

Advanced Analytics
0
Generating random permutations

I recently read a paper that described a SAS macro to carry out a permutation test. The permutations were generated by PROC IML. (In fact, an internet search for the terms "SAS/IML" and "permutation test" gives dozens of papers in recent years.) The PROC IML code was not as efficient

Advanced Analytics
0
Matrices, eigenvalues, Fibonacci, and the golden ratio

A previous post described a simple algorithm for generating Fibonacci numbers. It was noted that the ratio between adjacent terms in the Fibonacci sequence approaches the "Golden Ratio," 1.61803399.... This post explains why. In a discussion with my fellow blogger, David Smith, I made the comment "any two numbers (at

Advanced Analytics
0
Reading SAS data sets

Often, the first step of a SAS/IML program is to use the USE, READ, and CLOSE statements to read data from a SAS data set into a vector or matrix. There are several ways to read data: Read variables into vectors of the same name. Read one or more variables

Advanced Analytics
0
Using data to define hurricane season

In a previous blog post about hurricanes, I created a histogram of the occurrence of tropical cyclones in the Atlantic basin during the years 1988–2003. That histogram shows that the peak of hurricane activity occurs in the second week of September, but also that a majority of tropical storms occur

Learn SAS
0
Twitter and the Fibonacci Sequence

This morning I read an interesting post about the design of the new Twitter Web page. The post included some R code to generate the ratio between adjacent terms in the Fibonacci seqence. The ratio converges to the "Golden Ratio": 1.61803399.... I'm sure that many R gurus will post simpler

Advanced Analytics
0
Timing Performance: Looping versus LOC-ing

The SAS/IML language is a vector language, so statements that operate on a few long vectors run much faster than equivalent statements that involve many scalar quantities. For example, in a previous post, I asserted that the LOC function is much faster than writing a loop, for finding observations that

Advanced Analytics
0
Comparing cell phone use by age

The Junk Chart blog discusses a potential problem that can arise in grouped bar charts when the two groups have vastly different ranges. One possible solution (which is discussed at the Junk Chart sister blog, Numbers Rule Your World) is to present the data back-back in what is sometimes called

Advanced Analytics
0
Extending IML - Defining a Function Module

The SAS/IML run-time library contains hundreds of functions and subroutines that you can call to perform statistical analysis. There are also many functions in Base SAS software that you can call from SAS/IML programs. However, one day you might need to compute some quantity for which there is no prewritten

Advanced Analytics
0
When is the peak of hurricane season?

Visualizing the distribution of data is a primary task of data analysis. With all the hurricane activity in the Atlantic this year, I’ve been thinking about ways to visualize the historical distribution of hurricane activity. USA Today on Friday, August 13, 2010, announced that "the heart of hurricane season is

Advanced Analytics
0
Efficient Sampling

Recently, SAS Global Forum announced the call for papers for the 2011 conference to be held at Caesars Palace in Las Vegas. Since the conference is in Las Vegas, I’ve been thinking a lot about games of chance: blackjack, craps, roulette, and the like. You can analyze these games by

Advanced Analytics
0
Five Reasons to CLOSE Your Data Sets

My mother taught me to put things away when I'm finished using them. She doesn't use a computer, but if she did, I know that she'd approve of this tip from my book: Tip: Always close your files and data sets when you are finished reading or writing them. In

Advanced Analytics
0
A Prime Number Sieve

Today is the birthday of Bernhard Riemann, a German mathematician who made fundamental contributions to the fields of geometry, analysis, and number theory. Riemann is definitely on my list of the greatest mathematicians of all time, and his conjecture about the distribution of prime numbers is one of the great

0
Some People Are Born to Write

A friend recently asked me why I am writing a book. My answer? Some people are born to write a book and some have books thrust upon them. Mine was thrust upon me, although it is more accurate to say that I thrust it upon myself. My book, Statistical Programming

Advanced Analytics
0
Remove Observations with Missing Values

Missing values are a fact of life. Many statistical analyses, such as regression, exclude observations that contain missing values prior to forming matrix equations that are used in the analysis. This post shows how to find rows of a data matrix that contain missing values and how to remove those

Advanced Analytics
0
Never End PROC IML with a RUN Statement

Peter Flom reminded readers of his blog that you should always end a SAS procedure with a RUN statement. This is good rule. However, PROC IML is an exception to the rule. In PROC IML, the RUN statement is used to execute a built-in subroutine or a user-defined module. You

Advanced Analytics
0
Filling an Upper Triangular Matrix from a Vector

The R You Ready blog posed an interesting problem. Essentially, you have a vector that contains n(n+1)/2 elements, and you want to pack those elements into the upper left triangular portion of a matrix. For example, if your data are proc iml; /** vector v is given: ncol(v) = n(n+1)/2 for

Analytics
0
Hello, World!

When programmers begin learning a new computer language, the first program they write is often one that prints the text “Hello, World!” Successfully writing a Hello World program assures the programmer that the software is successfully installed and that all necessary features are working: parsers, compilers, linkers, and so on.

0
Close to Publication

I just returned home from Vancouver, British Columbia, where I attended the 2010 Joint Statistical Meetings (JSM). I heard that more than 5,300 statisticians attended this year, including about 40 or so from SAS. I stayed busy. I gave a presentation on techniques for visualizing time series, gave a two-hour