Time intervals

This macro displays the frequency of date/time observations that fall into user-specified time intervals. For example, say you have failure times in a column and wish to know how many failures occurred within 15 minute intervals.

Download the Macro

Be sure that Minitab knows where to find your downloaded macro. Choose File > Options > General. Under Macro location browse to the location where you save macro files.

Important

If you use an older web browser, when you click the Download button, the file may open in Quicktime, which shares the .mac file extension with Minitab macros. To save the macro, right-click the Download button and choose Save target as.

Required Inputs

  • A column of date/time data

Running the Macro

Suppose your raw date/time data are in C1 and you wish to determine how many observations occurred in 15 minute intervals, beginning at 8:00 AM on 1/1/2009 and ending at 4:00 PM of the same day. As well, say you wish to store the intervals in column C3 and the frequencies of observations in those intervals in column C4.To run the macro, choose View > Command Line/History and type:

%TIMEINTS C1 "1/1/2009 8:00 AM" "1/1/2009 3:00 PM" 15 C3 C4

Click Run.

The first argument after the %TIMEINTS command is the column containing the date/time data. The second argument is the starting time of the first interval, enclosed in double-quotes. Use the format used in the date/time data. The third argument is the end time of the last interval, enclosed in double-quotes. The fourth argument is the length of the intervals, in minutes. The fifth argument is the column you wish to store the intervals in and the sixth argument is the column you wish to store the frequencies.

Note

As with Minitab's histogram algorithm, observations that fall on interval boundaries are placed into the interval to the right, with one exception: observations on the boundary of the interval that is farthest to the right are placed in the final interval.