
SHIFTName:
For example, to shift the contents of the variable Y that contains 5 elements up (or right) by one element into the output vector Y2, we mean
Y(2) => Y2(3) Y(3) => Y2(4) Y(4) => Y2(5) Y(5) => Y2(6) To shift the contents of Y down (or left) by one element, we mean
Y(3) => Y2(2) Y(4) => Y2(3) Y(5) => Y2(4) One question is how do we define the endpoint values for Y2 (i.e., Y2(1) for the up shift and Y2(5) for the down shift)? Dataplot handles this by first doing
for all elements. So for the up shift, Y2(1) = Y1(1) and for the down shift Y2(5) = Y(5).
where <x> is a response variable; <nshift> is a number or parameter that specifies how how many elements to shift; and <y> is a variable that contains the shifted values. The sign of NSHIFT specifies the direction. If NSHIFT is negative, the shift is down (or left) and if NSHIFT is positive the shift is up (or right). If NSHIFT is zero, then Y = X.
LET AVAL = 0 LET Y2 = SHIFT Y NSHIFT LET Y2 = AVAL FOR I = 1 1 NSHIFT
let y = normal random numbers for i = 1 1 10 let nshift = 3 let y2 = shift y nshift let nshift = 3 let y3 = shift y nshift set write decimals 3 print y y2 y3The following output is generated.  Y Y2 Y3  1.073 1.073 0.233 0.573 0.573 0.455 0.873 0.873 0.525 0.233 1.073 0.705 0.455 0.573 0.032 0.525 0.873 1.190 0.705 0.233 0.269 0.032 0.455 0.032 1.190 0.525 1.190 0.269 0.705 0.269 0.000 0.032 0.000 0.000 1.190 0.000 0.000 0.269 0.000
Date created: 4/27/2009 