# I have two sets of data, what is the best way to fit one set of data so it most closely matches the other

I have taken two sets of data with two different instruments. We know data set A taken with instrument A is very accurate and precise and that set B, while precise, is not accurate. Thus my data sets might look like this:

Set A: {10, 10.2, 9.9, 10, 10, 9.1}
Set B: {6, 7, 6.5, 5.5, 6, 7}


I want to figure out the best way to "translate" set B so it is comparable to set A. My initial thought is to simply shift set B by some delta (maybe 3.0) but I am unsure as to what the best way to define this delta is. Can I just take the averages of the sets and find the difference? Should I be looking at the mean square error? Should I make a linear fit for both sets and compare the difference values along the lines? I am trying to perform this in excel.

Please let me know if something is not clear, thanks!

You seem to be attempting to identify a calibration curve. This is related to inverse regression (which terms if you want to search for, you'll need to add -sliced -topic).

However, plotting your two sets of numbers seems to suggest you have an odd notion of 'precise'. For example at A=10, B is 5.5,6,6 ... almost a 10% range. Similarly at B=7, A is 9.1 and 10.2 ... again about a 10% range. So at least one of the two is not very precise at all.

If you had two precise sets of numbers where one was shifted by a constant, the sort of thing you should see is the grey points (points close to a line with slope 1):

while what you actually have is the blue points, which don't seem to have any relationship at all. This is what makes me question the notion 'precise' in relation to these measurements.

While the difference in means is about 3.5, from the information here there's no more reason to shift B up by 3.5 than there is to just always take adjusted-B=9.87, say -- the A and B are unrelated here, so there's no point shifting B, since it doesn't tell you anything about what A would give; might as well just take the average of all the A's.

• thanks for the insight, I will look into these topics. Regarding the data sets, I simply made them up as an example and thought they seemed more precise than they turned out to be :). My real data set contains about ~80 data points. All the data in set A for my case is contained within 72-75 degrees and then total possible range is 0-180. Aug 7, 2015 at 5:00
• Most people are terrible at making up data. If your data are sensitive/private it should be possible to make up data (with different location or scale if need be) that have a similar appearance. It's hard to give suitable advice about whether mean-shifting would be suitable without seeing something that looks very much like the data you have. Aug 7, 2015 at 11:41