Returns a NumericalVariable whose observations are the weighted
moving average of the observations of the variable.
Namespace: Extreme.Statistics
Assembly: Extreme.Numerics (Extreme.Numerics)
Syntax
| Visual Basic (Declaration) |
|---|
Public Function GetWeightedMovingAverage ( _ length As Integer, _ weights As NumericalVariable _ ) As NumericalVariable |
| C# |
|---|
public NumericalVariable GetWeightedMovingAverage ( int length, NumericalVariable weights ) |
| C++ |
|---|
public: NumericalVariable^ GetWeightedMovingAverage ( int length, NumericalVariable^ weights ) |
Parameters
- length (System.Int32)
- The length of the window over which the average should be computed.
- weights (Extreme.Statistics.NumericalVariable)
- A NumericalVariable of the same length containing the weights.
Return Value
A NumericalVariable.
Remarks
Each observation is weighted by the corresponding observation in the weight variable.
The new variable gets the name WMA<n>(<name>,<weight>), where <name> is the name of the original variable, <weight> is the name of the weight vector, and <n>. is the length.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | weights is nullNothingnullptr. |
| ArgumentOutOfRangeException | length is less than or equal to zero or greater than or equal to the length of weights. |
| DimensionMismatchException | The length of weights does not equal the number of observations in the variable. |