# Average Waves Panel to do a weighted average?

Wed, 07/29/2020 - 05:35 pm

I have a set of scaled waves with different scaling. Each wave has its characteristic standard uncertainty wave.

I was very pleased to find the Average Waves panel to calculate an average on the waves even with different x scalings. I got the standard uncertainty out as well. Cool stuff!

So, now to the next step. Has anyone written a routine that allows one to calculate a *weighted* average and *weighted* standard uncertainty of waves *when their x scalings are different*?

Basically, I am looking for the Average Waves panel calculation equivalent of

weight_ j = 1 / stdev_j^2

w_average = SUM (weight_j*value_j) / SUM (weight_j)

w_stdev = sqrt (1 / SUM (weight_j))

It is more a hypothetical wish at this point. I already see that the uncertainty bounds due to variations from experiment to experiment are at least as great if not greater than the uncertainties per point.

I have only this:

https://www.wavemetrics.com/code-snippet/weighted-average-and-its-uncer…

but it's not clear to me how the x-scaling has influence on the weighted average of the data.

July 29, 2020 at 11:52 pm - Permalink

The Waves Average panel does the averaging with differing X scaling by interpolation. Should your weights be interpolated also?

July 30, 2020 at 09:22 am - Permalink

I want to play around a bit more with the theoretical approach that should be taken. There might be a principled way to switch how between applying the weighting values of each wave k at points j and doing the interpolation around each x ± dx for each wave k. I suspect that must should be interpolated is (w_j * V_j), the weighted values rather than V_j the actual values, as well as w_j, the weightings themselves.

July 30, 2020 at 04:34 pm - Permalink