VectorExtensions.MovingAverage Method

Definition

Namespace: Numerics.NET.DataAnalysis
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

MovingAverage(Vector<Double>, Int32) Returns a vector whose observations are the simple moving average of the observations of the vector.
MovingAverage(Vector<Double>, Int32, Boolean) Returns a vector whose observations are the simple moving average of the observations of the vector.

MovingAverage(Vector<Double>, Int32)

Returns a vector whose observations are the simple moving average of the observations of the vector.
C#
public static Vector<double> MovingAverage(
	this Vector<double> vector,
	int length
)

Parameters

vector  Vector<Double>
The vector to transform.
length  Int32
The number of observations to be used in the average.

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 new vector gets the name SMA<n>(<name>), where <name> is the name of the original vector and <n> . is the length.

Exceptions

ArgumentOutOfRangeException

length is less than or equal to zero.

MovingAverage(Vector<Double>, Int32, Boolean)

Returns a vector whose observations are the simple moving average of the observations of the vector.
C#
public static Vector<double> MovingAverage(
	this Vector<double> vector,
	int length,
	bool allowPartialWindows
)

Parameters

vector  Vector<Double>
The vector to transform.
length  Int32
The number of observations to be used in the average.
allowPartialWindows  Boolean
Specifies whether averages are computed for windows with missing values.

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 new vector gets the name SMA<n>(<name>), where <name> is the name of the original vector and <n> . is the length.

Exceptions

ArgumentOutOfRangeException

length is less than or equal to zero.

See Also