4
$\begingroup$

Consider the following linear regressions on two sets of data x and y (of same length)

  • y=ax
  • x=by

As you know, the usual optimisation by OLS is usually not giving (at all!) b=1/a

This is because the optimisation algorithm is not symmetric.

My question: is there coded somewhere in R the algorithm that fits symmetrically? (using as error the shortest distance to the line - for those who follow me here..)

Edit: http://en.wikipedia.org/wiki/Total_least_squares

$\endgroup$
0

2 Answers 2

7
$\begingroup$

The reason regression is not symmetrical is because it specifically is minimizing the error between the regression line and the response variable, i.e. in the direction of the y-axis for y=ax and in the direction of the x axis for x=by. for a "symmetric" fit, you want to minimize errors orthogonal to the fit line. PCA does this. The fit line you are looking for well be the first principal component. Check out the built in R functions prcomp and princomp.

PCA will give you a vector that passes through your data with the symmetry property you are looking for and therefore you are getting the slope component of a simple linear regression, but it won't give you intercept term (because PCA is not typically used for this purpose). But you should be able to determine the intercept easily with the knowledge that the "regression" line will pass through $(\bar{x},\bar{y})$.

$\endgroup$
0
1
$\begingroup$

Package MethComp has a function Deming which is performing this regression

http://cran.r-project.org/web/packages/MethComp/MethComp.pdf

The Deming regression is a special example of the total least square http://en.wikipedia.org/wiki/Deming_regression

$\endgroup$
1
  • $\begingroup$ problem is, this Deming function doesn't support fixing the intercept at 0 $\endgroup$ Nov 21, 2013 at 3:19

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.