2
$\begingroup$

1st- I would like to figure out the correction factor between two sets of numbers (time series).

2nd- I want to apply that correction factor to a second set of numbers.

As an example- say I have two temperature sensors, and I place them in the same exact environment. Even though they should be reading the same temperature, I can expect a little bit of offset due to error between the sensors. Something like:

Sensor 1 Sensor 2
10            10
10             9
11            11
12            11.8
13            12.9
14            13.9

It looks like Sensor 2 consistently reads a little low (or conversely that Sensor 1 reads a little high). Since I don't know the actual temperature this is a relative problem.

So start, I'm not sure about the best way to figure out the correction factor. It's pretty easy to run a regression analysis or a correlation analysis by plotting an x y scatter plot and calculating a best fit line. But, I'm not sure if this is the way to go.

But the real question is that once I figure out this correction factor, how do I apply it to a second set of numbers in a way that will reflect the error associated with the first set of numbers (basically that sensor 2 is reading slightly lower than sensor 1).

To continue the above example, say I take the same two sensors, but now place them in different environments where they will be exposed to different temperatures. Now I have a second set of numbers (below) from the same instruments but no longer reading the same temperature. How do I relate the original correction factor to a set of numbers from different environments.

Sensor 1 Sensor 2
10            13
11            14
12            14
12            14
13            14

For the first set of numbers the regression analysis yields the equation y=1.0925x -1.3125.

My initial thoughts were that I could use the regression equation from the first set of numbers as my correction factor, and then apply that to the second set of numbers in order to adjust them to account for the inherent error of the sensors.

But since the sensors are now in two different environments, I can no longer just plug numbers into a y=mx+b type linear regression equation.

I also thought about adjusting the second set of data by just adding the y intercept value to sensor 2, but this obviously does not work as the y intercept is too large in this case. So I think I have been barking up the wrong tree.

So I'm not sure if a regression analysis is the way to go. But in the end, all I'm looking for is a way to quantify the error between the two sensors (as found in the first set of numbers) and then apply that to all future deployments.

$\endgroup$
  • $\begingroup$ I think you should start with examining how the disagreement between the sensors depend on the temperature. Plot the difference between the two readings against the sum of them. $\endgroup$ – ttnphns Aug 18 '12 at 16:39
5
$\begingroup$

I am not sure whether you are interested in estimating the temperature or whether you want to know what the value of sensor 2 would be for a given value of sensor 1.

Still, I think that the tool you need is total least squares (TLS), also known as orthogonal regression. Contrary to normal linear regression, where you assume that all the error is the $Y$ variable, in orthogonal regression, you assume there is an error on both variables. This picture from the Wikipedia link above shows the difference: the error is assumed to be orthogonal to the regression line (and not vertical). If you are familiar with Principal Component Analysis (PCA), the orthogonal regression line is the first principal component of your dataset.

There seems to be no TLS function in R, so the easiest is actually to do it by PCA. It can go like this.

X <- c(10, 10, 11, 12, 13, 14)
Y <- c(10, 9, 11, 11.8, 12.9, 13.9)
pca <- prcomp(cbind(X,Y))
# Error (residual variance).
pca[['sdev']][2]^2  # 0.05581165
PC1 <- pca[['rotation']][,1]
# Estimated temperatures.
cbind(X,Y) %*% PC1
# Y / X slope from the point (mean(X), mean(Y)).
PC1[['Y']] / PC1[['X']]  # 1.115854

This means that you can model your system as $(Y - \bar{Y}) = 1.116 \cdot (X - \bar{X})$ or $Y = 1.116 \cdot X + (\bar{Y} - 1.116 \cdot \bar{X})$ if you need $Y$ as a function of $X$.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ If the regression only involves one independent variable x then orthogonal regression assumes the error variance in both x and y are the same. Otherwise for the error in variables model the direction to minimize the squared difference is in a different direction than orthogonal to the line. $\endgroup$ – Michael R. Chernick Aug 18 '12 at 18:00
  • $\begingroup$ Thanks for the answer. And I apologize if this seems like a simplistic question, but what should I do with the answer (the 1.115854 value) should I add it to one of the columns of data? Or should I do something else with it? Thanks! $\endgroup$ – Vinterwoo Aug 27 '12 at 19:21
  • $\begingroup$ Sorry for answering late. I added the last line to clarify how you can use the result. $\endgroup$ – gui11aume Sep 27 '12 at 18:24
2
$\begingroup$

If the difference between the sensors is basically a constant plus an independent error term the regression model could be applied. What is not clear though is whether or not the difference changes in magnitude as a function of the actual temperature. This would probably show up as a change in the residual variance as a function of temperature or the slope of the line.

The fact that the slope is slightly greater than 1 indicates that the difference increases a little as the temperature increases. However even if the assumptions required for the regression approach to be valid you should use a lot more than 5 observations to fit the model and estimate the offset (correction) for sensor 2 assuming sensor 1 is correct.

| cite | improve this answer | |
$\endgroup$
2
$\begingroup$

Seems to me that the original question and the responses ignore the values of calibration sources for temperature. The data seems to come from a quality assurance check of a measurement device. I note that the temperature is reported to the nearest degree. Consider sensor 1 is the in situ probe, and sensor2 is the calibrated QA probe, calibrated, for example, with an ice bath temperature (O degC), and a boiling water temperature (100 degC). The ice bath and boiling water baths are the "calibration standards", by definition. sensor 2 is the "transfer standard". Someone has to decide what precision & accuracy is needed for the in situ sensor1 measurements, the calibration & QA procedures to use, the model, how much data, and threshold difference to use to determine if there is sufficient agreement between the two datasets to pass or fail a QA check. If it passes, then the temperature of the in situ sensor1 is treated as acceptable or valid, if not, the probe is recalibrated, repaired or replaced and calibrated, as necessary to meet the needs of the process. So does the process that probe A measure require temperature data to be accurate and precise to within 10 degrees? 1 degree? 0.01 degree? The calibration and quality assurance requirements of the process will have a direct impact on the level of effort and complexity in determining what calibration & QA procedures to use. Otherwise, the PCA approach is an interesting one, to account for the error inherent in both the in situ sensor1 and transfer standard's sensor2 measurements. But how would this take advantage of the values of the known calibration standards of 0 degC and 100 degC.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.