# Differences function

To use this function, choose Calc > Calculator.

Calculates row-by-row differences between numeric values in a column. You specify the lag (number of rows); Minitab subtracts the value in current row from the value in the lag row.

## Syntax

DIFFERENCES(number, [lag])

In number, specify the column. Minitab subtracts from each row the element lag rows above, and stores the differences in a new column. If you don't specify a value for lag, the differences are calculated between consecutive rows (lag = 1). The first lag rows of the new column will contain the missing value symbol *.

## Example

A store manager records the number of customer complaints each month. To monitor monthly variation the manager wants to determine the row-by-row differences in the number of complaints. In Calc > Calculator, the manager enters the expression DIFFERENCES(C1,1) and stores the results in C2.

C1 C2
Complaints Variation
55 *
45 −10
51 6
38 −13
59 21
47 −12
60 13
49 −11
35 −14
28 −7

## Other uses

Calculating differences can also be an important step in finding trends or seasonality that may affect the data. For example, a toy store company wants to use a times series (ARIMA model) to predict monthly sales. However, they suspect a strong seasonal impact on monthly sales; toy sales in December are always higher than other months due to the holiday season.

To make the data more stationary and help reveal any underlying seasonal pattern before choosing a model, they first calculate differences in monthly sales using a lag of 12. Then they assess autocorrelation of the differences using Stat > Time Series > Autocorrelation.