RMED Function (CREATE command)

RMED produces new series based on the centered running medians of existing series.

  • The specification on RMED is the name or names of the existing series and the span to be used in finding the median, in parentheses.
  • A span must be specified; there is no default.
  • If the specified span is odd, RMED is naturally the middle term. If the specified span is even, the RMED is centered by averaging each pair of uncentered medians 1.
  • After the initial span, a second span can be specified to indicate the minimum number of values to use in finding the median when the number specified for the initial span is unavailable. This makes it possible to produce nonmissing values at or near the ends of the new series.
  • The second span must be greater than or equal to 1 and less than or equal to the first span.
  • The second span should be even (or 1) if the first span is even; it should be odd if the first span is odd. Otherwise, the next higher span value will be used.
  • If no second span is specified, the minimum span is simply the value of the first span.
  • If the number of values specified for the span or the minimum span is not available, the case in the new series is set to system-missing. Thus, unless a minimum span of 1 is specified, the endpoints of the new series will contain system-missing values.
  • When RMED encounters an imbedded missing value in the existing series, it creates two subsets, one containing cases before the missing value and one containing cases after the missing value. Each subset is treated as a separate series for computational purposes.
  • The endpoints of these subset series will have missing values according to the rules described above for the endpoints of the entire series. Thus, if the minimum span is 1, the endpoints of the subsets will be nonmissing; the only cases that will be missing in the new series are cases that were missing in the original series.

Example

CREATE TICKRMED = RMED(TICKETS,4,2). 
  • This example creates the series TICKRMED using centered running median values of the series TICKETS.
  • A span of 4 is used for computing medians. At the endpoints, where four values are not available, the median is based on the specified minimum of two values.
1 Velleman, P. F., and D. C. Hoaglin. 1981. Applications, basics, and computing of exploratory data analysis. Boston, Mass.: Duxbury Press.