# How does adjusting the axes of a graph change the geometric angle of a regression line?

I know that you can adjust the scale of the x and y axes to change the geometric angle of a regression line. For example, if you plotted a regression line with slope of b=0.3, perhaps the default settings of axes length etc. would create a regression angle of 35 degrees. If you adjust the axes, you will change the angle the regression line makes with the x-axis so that it is greater or less than 35 degrees-WITHOUT changing the mathematical value of the slope--it will still stay as b=0.3. What systematic equation/set of equations is there that allows me to know how the geometric angle of the regression line will be changed as I change the axes of the graph itself?

The equation relating the angle of a line to the slope (angle = arctan(m)) seems 'oversimplified' because it doesn't take into account the dimensions of the axes. If you zscore a set of datapoints and plot the original data points in one graph and the zscore data points in another graph (in Matlab or Excel), the geometric angle of the two graphs will LOOK identical even though the slope of the line (the b from the regression) is different. According to the equation above (angle = arctan(m)), the angle should be different since the slope of the lines is different, but it's not. Clearly, excel or matlab is changing something about the scales to accommodate and make the angles appear the same, when in fact they should not be.

-
The equation $\theta = \arctan(m)$ is not oversimplified. Note that when you change your axes, the slope of the linear function, defined as $\frac{\Delta y}{\Delta x}$, stays the same. The angle we are talking about does not care about how you look at the function, it only cares about the function. –  Olivier Jan 18 '14 at 22:10
In Matlab, you might want to try set(gca, 'DataAspectRatio', [1 1 1]);  after each of your plot commands. That will make sure that one unit on the X-axis is the same (on screen) as one unit on the Y-axis. And then you'll see that the angles to the X-axis, as measured by a protractor help up to your screen, are actually different. The answers you've gotten are mathematically correct. How software behaves is not really something that can be explained by the axioms of mathematics without a formalization of the software itself; you're not going to get that for Excel or Matlab. –  John Hughes Jan 18 '14 at 23:07
Thank you John! That was precisely what I needed to understand and the Matlab code was a huge help. –  user101601 Jan 20 '14 at 16:50

If I understand your question, you're saying "If I stretch the $x$-axis of my graph paper, but leave the labels the same, then the calculated slope of the line will change, but the angle on the stretched page will change. How can I know by how much it'll change?"

Well, this is then a problem that has nothing to do with regression. You're really asking "If, on axes with equal 'unit lengths' on the two axes, I have a line of slope $m$, and I scale the $x$-axis unit so that it becomes $c$ times the $y$-axis unit, what will the slope of the transformed line be?"

Solution: let's look at a particularly simple line, namely $$y = m x$$ which passes through $(0,0)$ and $(1, m)$. The angle it makes with the $x$-axis is $$\theta = \tan^{-1}(m)$$.

When you scale the $x$-axis, the origin remains fixed, but the point $(1, m)$ moves to a location that, on the old graph paper, would be $(c, m)$. The resulting angle to the $x$-axis (which we have to compute using the same units on both axes, i.e., using something like the old graph paper) is therefore $$\theta' = \tan^{-1}(m/c)$$.

In general, to find $\theta'$ from $\theta$, you do this: $$\theta' = \tan^{-1}(\frac{\tan(\theta)}{c} ),$$ or $$\theta' = \arctan(\frac{\tan(\theta)}{c} ),$$ which is the same thing using a different notation for the inverse tangent function.

-

You should notice that transformations of axis can be expressed in this form:

$$ay = f \left ( bx \right )$$

Note that this will change the mathematical value of the slope, and that this is exactly what you want in order to find the angle between the line and the x-axis. If the slope is $m$, you get the angle as $$\theta = \arctan(m)$$

You can think of $a$ and $b$ as factors of contraction of the axis.

Now, let's call the plot of your function plot 1. What you want to do is to make a new function and a new plot, call it plot 2, which has proportional axes and a function called function 2, at first equal to function 1. You have to find the relation between the axes of plot 1 and plot 2, and apply those transformations to your the second function, function 2. Your second function will now look exactly like the first one, but with proportionnal axes.

Then, if you find the angle between the second function and its x-axis, it will be exactly the same as the geometric angle between your first function and its axes. Do this using the formula above.

-