Close
Close window
MovingStatistic - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

Statistics

MovingStatistic

compute moving statistics for a data set

Calling Sequence

MovingStatistic(X, m, f, options)

Parameters

X

-

data set

m

-

bandwidth

f

-

statistic

options

-

additional parameters to be passed to the procedure f.

Description

The MovingStatistic function computes moving statistics for a set of observations.

The first parameter X is a single data sample - given as e.g. a Vector . Each value represents an individual observation.

The second parameter m is the size of the moving window.

The third argument f is the statistic; can be any of the DescriptiveStatistics routines or a maple procedure which accepts a Vector and returns a floating point number.

Note that after f has been called on one subsample, the same Vector is reused for the next subsample, for efficiency reasons. All the builtin DescriptiveStatistics routines can handle this, but if you specify a custom maple procedure for f, you may need to copy its input Vector if you will need access to it after returning. See the example below for an explanation.

Examples

>

withStatistics:

>

Aseqsini,i=1..20:

>

UMovingStatisticA,5,Mean

U0.0352323299444757−0.188944966656889−0.239407132278267−0.06975948456556430.1640247115443730.2470053442991260.102890402628771−0.135821500715074−0.249659742674422−0.13396196858379916 element Vector[column]

(1)
>

VMovingStatisticA,5,tFivePointSummaryt,output=maximum

V0.9092974268256820.9092974268256820.6569865987187890.9893582466233820.9893582466233820.9893582466233820.9893582466233820.9893582466233820.4201670368266410.99060735569487016 element Vector[column]

(2)
>

f := proc(A, q)
Statistics[Quantile](A, q);
end proc:

>

WMovingStatisticA,5,f,0.3

W−0.770277280598276−0.770277280598276−0.770277280598276−0.770277280598276−0.324716083296540−0.297055872378289−0.574419050600125−0.574419050600125−0.574419050600125−0.57441905060012516 element Vector[column]

(3)
>

LineChartA,U,V,W,color=red..blue,thickness=3,legend=original,mean,maximum,quantile

The following command will fail to apply the unassigned name g to the two correct sub-Vectors, because the same Vector is reused internally, as described above:

>

MovingStatistic1,2,3,2,g

g23g23

(4)

This command, however, will make a copy for every sub-Vector and thus get the correct answer.

>

MovingStatistic1,2,3,2,vgcopyv

g12g23

(5)


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /