1

Revised question:

My fundamental question seems to be: "I have data with error both in y and x. How do I estimate a value of true x so that y evaluated at that x will be distinguished from y(0) say, 19 times of 20?"

The data is from an actual measurement. The instrument I'm characterizing gives a response y relating to true x. My method of generating x includes uncertainties. When I make some conclusion of the instrument, I want to say how it performs in relation to actual x, not in relation to my measurement setup.

Original question:

I'm having data with error both in x and y. I made a Deming regression and found out the slope, intercept and their confidence bounds (and some other statistics I don't very well understand). The Deming script I used can be found here.

How do I draw confidence bands for the regression function?

Solution I found was to use MATLAB function predint, but that requires a cfit-object which I don't have. These are the approaches I've tried so far (and reasons why they didn't work):

1a) Make a cfit-object from the parameters I have. (Couldn't figure out what I was supposed to give the cfit-constructor.)

1b) Alter an existing cfit-object. (Altering parameter values zeroed error and couldn't find out how to set them.)

2) Generate a dataset with fit parameters and then use MATLAB fit-function to obtain a cfit object with my parameters. (Didn't yield expected results.)

3) Draw the bands from scratch. (Got swamped by statistics way over my head).

Here is an example of the plot. Cyan dots are the actual measurement points, red dots are their means for each x value. Vertical error bar represents 2$\sigma$ of the cyan points and horizontal bar represents calculated uncertainty in x measurements. Regression is made only on the linear section of data. On this section the ratio of y error and x error is between 0.7e-4 and 1.4e-4, which I thought was similar enough (same magnitude). Equation for the regression line is (3.0+-0.7)e-4*x + (3+-2)e-6.

Data and fit. Equation for the line is (3.0+-0.7)e-4*x + (3+-2)e-6

Progress so far:

The thing I was trying to do, calculating CI bands based on the regression coefficients and their estimated errors seems to be impossible:

You can't calculate the bands using just the CIs of slope and intercept because the bands are generated by calculating the CIs at each x. Duncan, comment

Here is a example of how the variance of the predicted value $\hat{y}$ is calculated. The difference between $\alpha$ and $\hat{\alpha}$ is that $\alpha$ is the unknown true value and $\hat{\alpha}$ is the estimate got from the regression. Now, this equation requires both, so how it can be calculated if true coefficient is not known? Also what are E and D? If I can solve the variance as a function of x, I will get the standard deviation as its square root.

My measured x-values contain error, but I'm interested in question "what y can I expect from true x". Will this have an impact on my calculations? It also seems that I should be interested in prediction bands rather than confidence bands.

Please correct me if I had any misconceptions.

KLuuppo
  • 11
  • 4
  • 1
    Welcome to the website. It is clear that you tried to solve this problem on your own but you do not pose this question in terms of Statistics but rather simiplistcally in terms of "drawing CI bands with MATLAB". Your question has a well-defined statistical aspect (CI for Deming regression). Can you please reformulate your question in terms of Statistics? – usεr11852 Dec 21 '15 at 11:43
  • Thank you. I'm afraid that my statistics knowledge is too thin to formulate it otherwise. I tried to convey what I'm trying to accomplish, and if it's unreasonable, I would like to know that too. I figured my question would fall into categories "statistical analysis, applied" and "visualizing data". – KLuuppo Dec 21 '15 at 12:01
  • OK, you 'll see what it comes up. Do you know how to get confidence bands for a simple regression (not Deming)? There are some very good threads on this matter in CV already (eg. [here](https://stats.stackexchange.com/questions/101318/understanding-shape-and-calculation-of-confidence-bands-in-linear-regression)). – usεr11852 Dec 21 '15 at 12:17
  • (I edited the tltle please check you are OK with it.) – usεr11852 Dec 21 '15 at 12:26
  • Yes, at least in practical terms. For that I could fit the data with MATLAB fit-function, obtaining cfit-object and feeding that to the predint-function and obtain equations for the confidence bands. If you were asking if I know how these functions accomplish what they do, then no. I understand that it is not the noblest approach, but I'm perfectly fine with black-box -solutions as long as I can tell which boxes I have used. The title is fine, thank you. – KLuuppo Dec 21 '15 at 12:28
  • See this [thread](https://stats.stackexchange.com/questions/6163/what-is-the-prediction-error-while-using-deming-regression-weighted-total-least) there is some significant overlap with your own task. – usεr11852 Dec 21 '15 at 12:38
  • Do you have varying errors for each data point? If so, then I thought it's not called "Deming regression" anymore. The Matlab script that you linked to only takes `lambda` as an input parameter, which is the variance ratio; how did you deal with different errors for each point? – amoeba Dec 21 '15 at 15:17
  • @amoeba Yes, both errors are dependent of x. However, their ratio is similar throughout the measurement. – KLuuppo Dec 21 '15 at 18:43
  • I don't see that the ratio is anywhere close to being the same on your figure (it looks like for small $x$ the error in $y$ is a lot larger than the error in $x$, whereas this gets reversed for large $x$) but I assume that you used one fixed value of lambda to fit the Deming regression. Anyway, apart from that, you say that your question is: "what y can I expect from true x". Why is this question meaningful for you -- can you somehow get access to the true x? – amoeba Dec 22 '15 at 01:01
  • @amoeba, I edited my responses to the question, about the error ratio above the plot and about the true x right next to the current question – KLuuppo Dec 22 '15 at 09:50

0 Answers0