Returns a vector whose observations are the weighted
moving average of the observations of the vector.
Namespace:
Extreme.DataAnalysis
Assembly:
Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.1
public static Vector<double> WeightedMovingAverage(
this Vector<double> vector,
double[] weights,
int currentWeightIndex
)
<ExtensionAttribute>
Public Shared Function WeightedMovingAverage (
vector As Vector(Of Double),
weights As Double(),
currentWeightIndex As Integer
) As Vector(Of Double)
public:
[ExtensionAttribute]
static Vector<double>^ WeightedMovingAverage(
Vector<double>^ vector,
array<double>^ weights,
int currentWeightIndex
)
[<ExtensionAttribute>]
static member WeightedMovingAverage :
vector : Vector<float> *
weights : float[] *
currentWeightIndex : int -> Vector<float>
Parameters
- vector
- Type: Extreme.MathematicsVectorDouble
The vector to transform. - weights
- Type: SystemDouble
A Double array containing the weights. - currentWeightIndex
- Type: SystemInt32
An integer specifying the index in weights
that corresponds to the current observation.
Return Value
Type:
VectorDoubleA vector.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
VectorDouble. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
The weights are applied backwards. If currentWeightIndex is zero, then
the first component of weights gives the weight for the
current observation, the second component gives the weight for the previous
observation, and so on.
The new vector gets the name WMA<n>(<name>), where
<name> is the name of the original vector and <n> .
is the length of weights.
Reference