Explanatory vs response variable: which is x
By Jude Wallis · Published
The explanatory variable is the one used to explain or predict, and it goes on the x-axis. The response is the outcome being explained, and it goes on the y-axis. Which is which comes from the question being asked, not from the data. Swapping them changes the regression line but leaves alone.
AP Statistics: Unit 5 (topics 5.1 Graphical Representations Between Two Quantitative Variables, 5.3 Linear Regression Models). Both roles do their regression work in Unit 5, Regression Analysis, of the Fall 2026 course, which is worth 10 to 20 percent of the multiple-choice section. Topic 5.1 covers graphical representations between two quantitative variables and topic 5.3 covers linear regression models, where the explanatory variable becomes the of the fitted line. Plotting the explanatory variable on the horizontal axis is the standard scatterplot convention, not a claim traced to the framework. Which variable takes which role follows from the question being investigated, not from the data.
Explanatory vs response variable: the short answer
Take two quantitative variables measured on the same individuals. The explanatory variable is the one you use to explain or predict the other, and it supplies the values on the horizontal axis. The response variable is the outcome you are trying to account for, and it supplies the values on the vertical axis. In the fitted line , ("y-hat") is the predicted response and is the explanatory variable.
The part students miss is that neither label is a property of the numbers. A column of measurements does not arrive marked explanatory. You assign the roles when you decide which question you are asking, and that decision does real work: swap the roles and, unless every point already sits exactly on a line, you get a different least-squares line from the identical points, while the correlation does not move at all.
So cannot tell you which variable is which, and the slope cannot be reused in the other direction. Both facts are worked through with numbers below.
Explanatory vs response side by side
| Feature | Explanatory variable | Response variable |
|---|---|---|
| Also called | Independent variable, predictor | Dependent variable, outcome |
| Supplies | The values | The values |
| Axis on a scatterplot | Horizontal | Vertical |
| Role in | The input you plug in | What the model predicts |
| Units in the slope | The denominator (per one unit of ) | The numerator |
| Residuals are measured in | Not its units | Its units, vertically |
| In an experiment | The factor whose levels you impose | What you measure afterward |
| What fixes the role | The question being investigated | The question being investigated |
The last row is the one that decides the other seven.
Which one is which is a choice you make
Suppose a school records a math score and a reading score for every student. Either variable can be the explanatory one. A teacher asking "given a student's math score, what reading score should I expect?" makes math explanatory. A reading specialist asking "which math scores should I expect from the students I already screen for reading?" makes reading explanatory. Same students, same two columns, opposite assignments, and both are correct for their own question.
The same goes for arm span and height. A tailor predicts arm span from height; a clinician who cannot stand a patient upright predicts height from arm span. Neither variable is more fundamental. What differs is which quantity is already known and which one you want.
An experiment settles the roles at design time rather than at analysis time. The factor whose levels the researcher imposes is the explanatory variable, and whatever gets measured on the units afterward is the response. That is still a choice, just one made before the data exists.
Two tempting rules are not rules. Which variable you measured first does not decide anything, and neither does which one is easier to collect. The response is whichever variable the question is trying to account for. For each role on its own, see explanatory variable and response variable.
Swapping them changes the regression line
The least-squares line does not treat the two variables evenly. It minimizes the sum of squared vertical distances, the gaps in the response, and leaves horizontal distances alone. Change which variable sits on the vertical axis and you change what counts as an error, so you get a different line.
Write and for the sample standard deviations of the two variables. Predicting from gives slope . Predicting from gives slope . Multiply them and the standard deviations cancel:
If the two lines were the same line, one slope would be the reciprocal of the other and the product would be 1. It equals instead, so the lines coincide only when , meaning every point already lies exactly on a line. For any real data set with scatter, they are two different lines. They do share one point: both pass through ("x-bar, y-bar"), the mean of each variable, so the pair crosses at the center of the cloud and fans apart from there. In the worked example the two slopes are 1.6 and 2.5 on the same axes. See the least-squares regression line for how each line is built.
Swapping them leaves the correlation alone
Correlation is symmetric. It is the average product of the two standardized variables:
Every term is a product of two numbers, and multiplication does not care about order, so relabeling which variable is leaves every term and the total untouched. Standardizing also strips the units out, which is why rescaling either variable by a positive factor leaves alone as well; a negative factor keeps its size and flips its sign, as does changing units change r works through.
That symmetry has a practical consequence: carries no information about direction of explanation. A reported correlation of 0.8 tells you the points cluster near a line and nothing about which variable anyone treated as the predictor. If you need that, you need the slope, and the slope needs you to have picked a response first. The wider difference between the two summaries is set out in correlation vs regression.
The classic mix-up and how to avoid it
Three errors show up repeatedly.
- Putting the response on the horizontal axis. The plot looks fine, and then the slope gets interpreted as though the axes were the standard way round, which reverses the statement entirely. Label both axes before you fit anything.
- Rearranging the line to predict backwards. Solving for is legal algebra and the wrong statistics: it gives a slope of , while the least-squares slope for predicting is , smaller by a factor of . The second worked example shows the round trip failing by 3.6 points.
- Reading explanatory as causal. Calling a variable explanatory records which question you are asking. It is a claim about your analysis, not about the world. Only a design with random assignment supports a cause-and-effect conclusion, as covered in correlation vs causation and experiments vs observational studies.
One habit prevents all three. Before touching a calculator, finish the sentence "I want to predict ___ from ___." The first blank is the response and goes on the vertical axis, the second is the explanatory variable and goes on the horizontal one. If you cannot finish that sentence, you are not ready to fit a line.
Where this fits in AP Statistics
Both roles do their regression work in Unit 5, Regression Analysis, worth 10 to 20 percent of the multiple-choice section, and the experimental version of the explanatory variable shows up earlier, as the factor in topic 1.13, Experimental Design. Graphical representations between two quantitative variables is topic 5.1, and linear regression models is topic 5.3, where the roles turn into the and the of a fitted line. The axis convention is standard statistical practice rather than anything specific to this course: explanatory horizontal, response vertical.
The roles also decide how you word an interpretation. A slope is a predicted change in the response per one-unit increase in the explanatory variable, so naming the two backwards inverts the whole sentence; see how to interpret the slope of a regression line. To practice on real output, use the regression calculator, which takes one pair per line, and enter the same data twice, the second time with each pair written in the other order. Then compare the two slopes against the single unchanged .
Swap the roles and refit: two lines, one correlation
Five students take a math test () and a reading test (), scored out of 100: , , , , . Find the least-squares line for predicting reading from math, then the line for predicting math from reading, and compare the correlation in each direction.
Find the means. math points and reading points.
List the deviations. For : . For : .
Build the three sums. ; ; .
Get the standard deviations and the correlation. , , and .
Reading from math. Slope reading points per math point, and intercept , so .
Math from reading. Now reading is the explanatory variable, so slope math points per reading point, and intercept , giving .
Put the second line on the same axes. Solving for gives . Its slope is 2.5 against the first line's 1.6, so these are two different lines through the same five points.
Check that both still pass through the mean point : , and .
Check the correlation both ways. The sum is the same however you order the two factors, and , so in either direction.
Confirm the slope identity. , which is less than 1, so the two lines cannot be the same line.
Reading from math is . Math from reading is , which drawn on the same axes is . Those are two different lines crossing at , yet both ways and the slopes multiply to .
Why you cannot run the line backwards
Use the two lines from the previous example. Predict the reading score for a student with a math score of 85, then feed that prediction into the math-from-reading line. Explain why you do not get 85 back, and check which line predicts reading better.
Predict reading from math: reading points. Note first that 85 is above every math score in the data, which topped out at 80, so this is extrapolation: fine for showing the algebra, not a number you would report.
Feed 86 into the other line: math points, which is 3.6 points short of the 85 you started with.
See where the gap comes from. Rearranging would imply math points per reading point, but the least-squares slope for predicting math is 0.4. The two differ by exactly : .
Check what the first line actually minimizes. Its predicted reading scores at are , so the residuals are , , , , , and the squared total is .
Now use the other line, , to predict reading. Its predictions are , the residuals are , and the squared total is .
Compare: 144 against 225. The line built to predict reading wins at predicting reading, and the line built to predict math is worse at it, even though both describe the same five points.
The prediction chain gives 85 math points to 86 reading points to 81.4 math points, missing the start by 3.6. Inverting a regression line implies a slope of when the correct least-squares value is 0.4, smaller by the factor . Each line minimizes squared error in its own response only, 144 against 225 for predicting reading here, so reversing the question means fitting a new line rather than rearranging the old one.
Frequently asked questions
Which variable goes on the x-axis?
The explanatory variable. On a scatterplot of two quantitative variables the explanatory variable goes on the horizontal axis and the response on the vertical, which is also how the fitted line is written. Scatterplots are topic 5.1 in Unit 5.
Does swapping the two variables change the correlation?
No. Correlation is the average product of the two standardized variables, and reordering the factors in a product changes nothing, so is identical either way. In the worked example whichever variable is called explanatory, while the two least-squares slopes are 1.6 and 0.4.
Can I rearrange the regression line to predict x from y?
No. Solving for gives a slope of , but the least-squares slope for predicting from is . The two agree only when . To predict the other variable, refit with the roles swapped.
Does calling a variable explanatory mean it causes the response?
No. The label records which variable you are predicting from, which is a statement about your analysis rather than about the world. A cause-and-effect conclusion needs a design that randomly assigns the levels of the explanatory variable, not a well-fitting line.
Can the same variable be explanatory in one study and the response in another?
Yes, and that is the normal case for two measured quantities. Math score explains reading score for a teacher predicting reading, and reading score explains math score for a specialist working the other way. The data are identical; the question is not.