SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 2 Vol 1

MOVING (LET)

Name:
    MOVING (LET)
Type:
    Let Subcommand
Purpose:
    Compute a "moving" statistic for a variable.
Description:
    It is sometimes useful to a compute a statistic over a "local" region of a variable rather than the entire variable. The most common example would be to compute a moving average for a variable.

    Although this command is most commonly used for a location statistic, it can in fact be used for any supported statistic (enter HELP STATISTIC for a list of supported statistics).

    The "local" area is defined by the FILTER WIDTH command. For example,

      FILTER WIDTH 5

    says that 5 points will be used to compute the specified statistic.

    The command

      SET MOVING DIRECTION <CENTER/LEFT/RIGHT>

    defines the direction of the local region:

      CENTER = the current row plus an equal number of rows above and below the current row. For example, if the FILTER WIDTH is set to 5, the local area for row i will be rows i - 2 to i + 2.
      LEFT = the current row plus the specified number of rows above the current row. For example, if the FILTER WIDTH is set to 5, the local area for row i will be rows i to i + 4.
      RIGHT = the current row minus the specified number of rows below the current row. For example, if the FILTER WIDTH is set to 5, the local area for row i will be rows i - 4 to i.

    The other issue is how the "end points" will be handled. This is specified with the command

      SET MOVING END POINT <SKIP/SYMMETRIC/PARTIAL>

    where

      SKIP = if the local region extends beyond the start or end point, no output value will be generated for that row.
      PARTIAL = if the local region extends beyond the start or end point, the statistic will be computed for the subset of rows that are within range.
      SYMMETRIC = if the local region extends beyond the start or end point, the statistic will be computed for the largest subset of rows that maintains an equal number of rows above and below the current row. This option is only supported if the MOVING DIRECTION is CENTER.

    The default is a FILTER WIDTH of 3, MOVING DIRECTION of CENTER, and a MOVING END POINT of SKIP.

Syntax:
    LET <yout> = MOVING <stat> <y1> ... <yk>
                            <SUBSET/EXCEPT/FOR qualification>
    where <y1> ... <yk> is a list of one to three response variables (depending on what <stat> is);
                <stat> is one of the supported statistics (HELP STATISTICS for a list);
                <yout> is a variable where the computed values are stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET Y2 = MOVING MEAN Y
    LET Y2 = MOVING MEDIAN Y
    LET Y2 = MOVING MINIMUM Y
    LET Y2 = MOVING SD Y
Note:
    The SMOOTH command can generate smooths based on a number of different moving statistics. Enter HELP SMOOTH for details.
Default:
    None
Synonyms:
    None
Related Commands: Applications:
    Data Analysis
Implementation Date:
    2010/10
Program:
     
    skip 25
    read mavro.dat y
    .
    let n = size y
    let x = sequence 1 1 n
    set write decimals 6
    filter width
    .
    set moving end point skip
    let yskip = moving average y
    .
    set moving end point symmetric
    let ysymm = moving average y
    .
    set moving end point partial
    let ypart = moving average y
    .
    print x y yskip ysymm ypart
        
    The following values are generated:
     
    ---------------------------------------------------------------------------
                  X              Y          YSKIP          YSYMM          YPART
    ---------------------------------------------------------------------------
           1.000000       2.001799       2.001766       2.001799       2.001749
           2.000000       2.001700       2.001799       2.001766       2.001766
           3.000000       2.001799       2.001833       2.001799       2.001799
           4.000000       2.001900       2.001799       2.001833       2.001833
           5.000000       2.001799       2.001666       2.001799       2.001799
           6.000000       2.001700       2.001533       2.001666       2.001666
           7.000000       2.001500       2.001466       2.001533       2.001533
           8.000000       2.001399       2.001466       2.001466       2.001466
           9.000000       2.001500       2.001566       2.001466       2.001466
          10.000000       2.001500       2.001666       2.001566       2.001566
          11.000000       2.001700       2.001766       2.001666       2.001666
          12.000000       2.001799       2.001833       2.001766       2.001766
          13.000000       2.001799       2.001866       2.001833       2.001833
          14.000000       2.001900       2.001966       2.001866       2.001866
          15.000000       2.001900       2.001999       2.001966       2.001966
          16.000000       2.002099       2.001899       2.001999       2.001999
          17.000000       2.001999       2.001666       2.001899       2.001899
          18.000000       2.001599       2.001433       2.001666       2.001666
          19.000000       2.001399       2.001333       2.001433       2.001433
          20.000000       2.001300       2.001366       2.001333       2.001333
          21.000000       2.001300       2.001433       2.001366       2.001366
          22.000000       2.001500       2.001533       2.001433       2.001433
          23.000000       2.001500       2.001533       2.001533       2.001533
          24.000000       2.001599       2.001500       2.001533       2.001533
          25.000000       2.001500       2.001400       2.001500       2.001500
          26.000000       2.001399       2.001366       2.001400       2.001400
          27.000000       2.001300       2.001399       2.001366       2.001366
          28.000000       2.001399       2.001433       2.001399       2.001399
          29.000000       2.001500       2.001466       2.001433       2.001433
          30.000000       2.001399       2.001500       2.001466       2.001466
          31.000000       2.001500       2.001533       2.001500       2.001500
          32.000000       2.001599       2.001566       2.001533       2.001533
          33.000000       2.001500       2.001666       2.001566       2.001566
          34.000000       2.001599       2.001833       2.001666       2.001666
          35.000000       2.001900       2.001966       2.001833       2.001833
          36.000000       2.001999       2.002033       2.001966       2.001966
          37.000000       2.001999       2.002099       2.002033       2.002033
          38.000000       2.002099       2.002200       2.002099       2.002099
          39.000000       2.002200       2.002299       2.002200       2.002200
          40.000000       2.002299       2.002399       2.002299       2.002299
          41.000000       2.002400       2.002533       2.002399       2.002399
          42.000000       2.002499       2.002600       2.002533       2.002533
          43.000000       2.002699       2.002633       2.002600       2.002600
          44.000000       2.002600       2.002600       2.002633       2.002633
          45.000000       2.002600       2.002633       2.002600       2.002600
          46.000000       2.002600       2.002633       2.002633       2.002633
          47.000000       2.002699       2.002599       2.002633       2.002633
          48.000000       2.002600       2.002499       2.002599       2.002599
          49.000000       2.002499       0.000000       2.002499       2.002499
          50.000000       2.002400       0.000000       2.002400       2.002450
        

Date created: 10/5/2010
Last updated: 10/5/2010
Please email comments on this WWW page to alan.heckert@nist.gov.