# weighted statistics

Hi,
is there any way to calculate in Knime descriptive statistics (f.i. mean, percentiles) when data to analyse contains for each row its frequency/weight? Don’t answer please using R, Pyton…
Thanks,
Alfredo

Hi @alfroc,

for simple statistics (min, max, mean, variance) over one column, use the Statistics node or the GroupBy node (which can also do counting, correlation, p^th percentile etc.).

I think in your case you need the Math Formula node which computes row-wise but can also compute Means over columns. If you have a table with a column of values (1, 2, 3) and one column of occurences (2, 2, 2), then you could calculate the global mean by multiplying these columns with a Math formula (2, 4, 6). Then you use another Math Formula to add these values up (2+4+6=12) and divide them by the sum of all occurences (2+2+2=6).

In this thread is an example workflow how you can calculate percentiles with a Rank node: Percentile Rank Calculation
Hope that helped.
Cheers,
Johannes

1 Like