VectorExtensions.PeriodToDateDifferences Method

Definition

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

Overload List

PeriodToDateDifferences(Vector<Double>, Int32[], BoundaryIntervalBehavior, BoundaryIntervalBehavior) Returns a vector whose observations are the difference between successive observations over intervals of observations.
PeriodToDateDifferences(Vector<Double>, Vector<DateTime>, Vector<DateTime>, BoundaryIntervalBehavior, BoundaryIntervalBehavior) Returns a vector whose observations are the difference between successive observations over intervals of observations.

PeriodToDateDifferences(Vector<Double>, Int32[], BoundaryIntervalBehavior, BoundaryIntervalBehavior)

Returns a vector whose observations are the difference between successive observations over intervals of observations.
C#
public static Vector<double> PeriodToDateDifferences(
	this Vector<double> vector,
	int[] bounds,
	BoundaryIntervalBehavior startBehavior,
	BoundaryIntervalBehavior endBehavior
)

Parameters

vector  Vector<Double>
The vector to transform.
bounds  Int32[]
An integer array containing the indexes of the boundaries of the intervals.
startBehavior  BoundaryIntervalBehavior
A BoundaryIntervalBehavior that specifies how to treat observations before the first entry in bounds.
endBehavior  BoundaryIntervalBehavior
A BoundaryIntervalBehavior that specifies how to treat observations after the last entry in bounds.

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

A common use for this method is to obtain data for individual periods from a period-to-date time series vector. For example, if the vector contains quarter-to-date monthly earnings, you can use this method to calculate the actual monthly earnings.

The new vector gets the name pdiff(<name>), where <name> is the name of the original vector.

Exceptions

ArgumentNullException

bounds is null.

PeriodToDateDifferences(Vector<Double>, Vector<DateTime>, Vector<DateTime>, BoundaryIntervalBehavior, BoundaryIntervalBehavior)

Returns a vector whose observations are the difference between successive observations over intervals of observations.
C#
public static Vector<double> PeriodToDateDifferences(
	this Vector<double> vector,
	Vector<DateTime> startOfPeriod,
	Vector<DateTime> startOfSummaryPeriod,
	BoundaryIntervalBehavior startBehavior,
	BoundaryIntervalBehavior endBehavior
)

Parameters

vector  Vector<Double>
The vector to transform.
startOfPeriod  Vector<DateTime>
A Vector<T> of DateTime that specifies the dates corresponding to each observation of the vector.
startOfSummaryPeriod  Vector<DateTime>
A Vector<T> of DateTime that specifies the starting point of each summary period.
startBehavior  BoundaryIntervalBehavior
A BoundaryIntervalBehavior that specifies how to treat observations before the first entry in startOfSummaryPeriod.
endBehavior  BoundaryIntervalBehavior
A BoundaryIntervalBehavior that specifies how to treat observations after the last entry in startOfSummaryPeriod.

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

A common use for this method is to obtain data for individual periods from a period-to-date time series vector. For example, if the vector contains quarter-to-date monthly earnings, you can use this method to calculate the actual monthly earnings.

The new vector gets the name pdiff(<name>), where <name> is the name of the original vector.

Exceptions

ArgumentNullException

startOfPeriod is null.

-or-

startOfSummaryPeriod is null.

DimensionMismatchException

The length of startOfPeriod does not equal the length of the numerical vector.

See Also