就一组数据,Write a program that will construct a moving average on a given variable, given a ‘window’and store it as another variable. For example, if we have a dataset with 10 observationson a variable x, and the window is of size 3, then your program will create a new variabley, where y1 =x1+x2+x3/3, y2 =x2+x3+x4/3, etc. Of course, this will result in some missingvalues in the end.
不介意最后有几个值用不动,就比如一组数据x1,x2,x3,x4,x5,……xn,求一个命令,使求出每连续三个数的平均值。
谢谢