# Posts Tagged ‘ Efficiency ’

## 6 tips for timing the performance of algorithms

August 21, 2017
By

When you implement a statistical algorithm in a vector-matrix language such as SAS/IML, R, or MATLAB, you should measure the performance of your implementation, which means that you should time how long a program takes to analyze data of varying sizes and characteristics. There are some general tips that can [...] The post 6 tips for timing the performance of algorithms appeared first on The DO Loop.

## what does more efficient Monte Carlo mean?

March 16, 2017
By

“I was just thinking that there might be a magic trick to simulate directly from this distribution without having to go for less efficient methods.” In a simple question on X validated a few days ago [about simulating from x²φ(x)] popped up the remark that the person asking the question wanted a direct simulation method […]

## Compare the performance of algorithms in SAS

July 13, 2015
By

As my colleague Margaret Crevar recently wrote, it is useful to know how long SAS programs take to run. Margaret and others have written about how to use the SAS FULLSTIMER option to monitor the performance of the SAS system. In fact, SAS distributes a macro that enables you to […] The post Compare the performance of algorithms in SAS appeared first on The DO Loop.

## Finding observations that match a target value

March 18, 2015
By

Imagine that you have one million rows of numerical data and you want to determine if a particular "target" value occurs. How might you find where the value occurs? For univariate data, this is an easy problem. In the SAS DATA step you can use a WHERE clause or a […]

## An easy way to approximate a cumulative distribution function

March 4, 2015
By

Evaluating a cumulative distribution function (CDF) can be an expensive operation. Each time you evaluate the CDF for a continuous probability distribution, the software has to perform a numerical integration. (Recall that the CDF at a point x is the integral under the probability density function (PDF) where x is […] The post An easy way to approximate a cumulative distribution function appeared first on The DO Loop.

## Friends don’t let friends concatenate results inside a loop

February 16, 2015
By

Friends have to look out for each other. Sometimes this can be slightly embarrassing. At lunch you might need to tell a friend that he has some tomato sauce on his chin. Or that she has a little spinach stuck between her teeth. Or you might need to tell your […]

## Finding matrix elements that satisfy a logical expression

January 20, 2015
By

A common task in SAS/IML programming is finding elements of a SAS/IML matrix that satisfy a logical expression. For example, you might need to know which matrix elements are missing, are negative, or are divisible by 2. In the DATA step, you can use the WHERE clause to subset data. […]

## Pairwise comparisons of a data vector

July 2, 2014
By

A SAS customer showed me a SAS/IML program that he had obtained from a book. The program was taking a long time to run on his data, which was somewhat large. He was wondering if I could identify any inefficiencies in the program. The first thing I did was to […]

## Simulate many samples from a logistic regression model

June 27, 2014
By

My last blog post showed how to simulate data for a logistic regression model with two continuous variables. To keep the discussion simple, I simulated a single sample with N observations. However, to obtain the sampling distribution of statistics, you need to generate many samples from the same logistic model. […]

## Simulating data for a logistic regression model

June 25, 2014
By

In my book Simulating Data with SAS, I show how to use the SAS DATA step to simulate data from a logistic regression model. Recently there have been discussions on the SAS/IML Support Community about simulating logistic data by using the SAS/IML language. This article describes how to efficiently simulate […]