Vector Extensions.Weighted Moving Average Method
Definition
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
Overload List
Weighted | Returns a vector whose observations are the weighted moving average of the observations of the vector. |
Weighted | Returns a vector whose observations are the weighted moving average of the observations of the vector. |
Weighted | Returns a vector whose observations are the weighted moving average of the observations of the vector. |
Weighted | Returns a vector whose observations are the weighted moving average of the observations of the vector. |
Weighted | Returns a vector whose observations are the weighted moving average of the observations of the vector. |
WeightedMovingAverage(Vector<Double>, Vector<Double>)
public static Vector<double> WeightedMovingAverage(
this Vector<double> vector,
Vector<double> weights
)
Parameters
Return Value
Vector<Double>A vector.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. 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).Remarks
The weights are applied backwards. 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.
Exceptions
Argument | weights is null. |
WeightedMovingAverage(Vector<Double>, Double[])
public static Vector<double> WeightedMovingAverage(
this Vector<double> vector,
double[] weights
)
Parameters
Return Value
Vector<Double>A vector.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. 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).Remarks
The weights are applied backwards. 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.
Exceptions
Argument | weights is null. |
WeightedMovingAverage(Vector<Double>, Vector<Double>, Int32)
public static Vector<double> WeightedMovingAverage(
this Vector<double> vector,
Vector<double> weights,
int currentWeightIndex
)
Parameters
- vector Vector<Double>
- The vector to transform.
- weights Vector<Double>
- A Vector array containing the weights.
- currentWeightIndex Int32
- An integer specifying the index in weights that corresponds to the current observation.
Return Value
Vector<Double>A vector.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. 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).Remarks
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.
Exceptions
Argument | weights is null. |
Argument | currentWeightIndex is less than zero or greater than or equal to the length of weights. |
Insufficient | The length of the vector is less than the length of weights. |
WeightedMovingAverage(Vector<Double>, Double[], Int32)
public static Vector<double> WeightedMovingAverage(
this Vector<double> vector,
double[] weights,
int currentWeightIndex
)
Parameters
- vector Vector<Double>
- The vector to transform.
- weights Double[]
- A Double array containing the weights.
- currentWeightIndex Int32
- An integer specifying the index in weights that corresponds to the current observation.
Return Value
Vector<Double>A vector.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. 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).Remarks
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.
Exceptions
Argument | weights is null. |
Argument | currentWeightIndex is less than zero or greater than or equal to the length of weights. |
Insufficient |
The length of the vector is less than the length of weights.
-or- The length of weights is zero. |
WeightedMovingAverage(Vector<Double>, Int32, Vector<Double>)
public static Vector<double> WeightedMovingAverage(
this Vector<double> vector,
int length,
Vector<double> weights
)
Parameters
- vector Vector<Double>
- The vector to transform.
- length Int32
- The length of the window over which the average should be computed.
- weights Vector<Double>
- A vector of the same length containing the weights.
Return Value
Vector<Double>A vector.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. 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).Remarks
Each observation is weighted by the corresponding observation in the weight vector.
The new vector gets the name WMA<n>(<name>,<weight>), where <name> is the name of the original vector, <weight> is the name of the weight vector, and <n>. is the length.
Exceptions
Argument | weights is null. |
Argument | length is less than or equal to zero or greater than or equal to the length of weights. |
Dimension | The length of weights does not equal the number of observations in the vector. |