Icon

20230519 Pikairos Weighted Moving Average

This workflow shows how to implement from scracth a simple Weighted Moving Average.
The size of the Weighted Moving Average is determined by the numbers of Weights in Vector stored as rows in a table.

This workflow brings a possible solution to question asked in the KNIME forum by Badger101 in topic number 67217

CreateLag Columnsbased onWeighting Vector SizeSetMissing Values = 0Loop overLagged Columnsto weight themby their correspondingWeight in VectorDummyWeighting VectorSelect Weightfor Current ColumnCreate a Columnto AssociateRow Indexto every WeightCreate a Variablewith CurrentColumn WeightMultiply CurrentLag Column byits Corresponding WeightColumn AppendWeightedLagged ColumnsKeep onlyNumeric Columns forMoving Weighted AverageCalculationAggregate bya SUM operatorall the WeightedLagged ColumnsJoin Initial Tableto CalculatedWeightedMoving Average Lag based onWeighting Vector SizeOriginal Signal& Filtered Signalusing a WeightedMoving Averaged FilterInitial Time SeriesNode 63Take onlyFirst ColumnNode 67Set to ZeroRows thathave index lessthan # of Rowsin Table of WeightsLag Column Missing Value Column ListLoop Start Table Creator Rule-basedRow Filter Math Formula Table Rowto Variable Math Formula ExtractColumn Header Loop End (ColumnAppend) Column Splitter Column Aggregator Joiner Extract TableDimension Math Formula(Variable) Line Plot Line Plot Excel Reader Column Filter Column Rename Rule Engine CreateLag Columnsbased onWeighting Vector SizeSetMissing Values = 0Loop overLagged Columnsto weight themby their correspondingWeight in VectorDummyWeighting VectorSelect Weightfor Current ColumnCreate a Columnto AssociateRow Indexto every WeightCreate a Variablewith CurrentColumn WeightMultiply CurrentLag Column byits Corresponding WeightColumn AppendWeightedLagged ColumnsKeep onlyNumeric Columns forMoving Weighted AverageCalculationAggregate bya SUM operatorall the WeightedLagged ColumnsJoin Initial Tableto CalculatedWeightedMoving Average Lag based onWeighting Vector SizeOriginal Signal& Filtered Signalusing a WeightedMoving Averaged FilterInitial Time SeriesNode 63Take onlyFirst ColumnNode 67Set to ZeroRows thathave index lessthan # of Rowsin Table of WeightsLag Column Missing Value Column ListLoop Start Table Creator Rule-basedRow Filter Math Formula Table Rowto Variable Math Formula ExtractColumn Header Loop End (ColumnAppend) Column Splitter Column Aggregator Joiner Extract TableDimension Math Formula(Variable) Line Plot Line Plot Excel Reader Column Filter Column Rename Rule Engine

Nodes

Extensions

Links