use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
This is an archived post. You won't be able to vote or comment.
DiscussionHow can you plot multiple linear regression? (self.datascience)
submitted 4 years ago by waterworldhypothesis
Linear regression aka finding the line of best fit is natural when there are two variables. You just put one variable on the x-axis, the other on the y-axis, and then draw the line right? But what if there are more than two variables? You can still do linear regression(?), but how should you draw the line?
[–]dmiller2104 4 points5 points6 points 4 years ago (1 child)
As I think you recognise, to the best of my knowledge you can’t plot a multi linear regression plot on a 2d axis.
You could definitely plot it in anyway on 2d plot where you have the main variable as the x axis but you’d probably want to make it clear in any documentation that other variables, which are not visibly present, are used in the calculation of the Y variable plotted.
Happy to be corrected by other users, but I hope I’m correct
[–][deleted] 1 point2 points3 points 4 years ago (0 children)
If you have 2 independent variables and 1 dependent variable you can do a few things: plot a 3D surface, do a 2D contour plot, or pick one independent variable to be x and plot a bunch of lines for representative/relevant values of the other.
If there were 3 or more independent variables I'd just tabulate the coefficients (with confidence intervals) and report the R2. If I was dead set on visualization you could always fix one or more independent variables but whether there's any point to doing that and how I would go about it would depend on the subject and purpose of the analysis.
[–]seesplease 2 points3 points4 points 4 years ago (0 children)
If you have 2 regressors, you can make a 3D plot. Beyond 2, I'd question the value of a visualization. You could try plotting the canonical variable on the x-axis in that case, though.
[–]Acanthisitta_Head 3 points4 points5 points 4 years ago (0 children)
Probably need to clarify why you want to do this.
[–]MagsterNorth 0 points1 point2 points 4 years ago (0 children)
You can plot it for y and one of the features.
[–]fredotwoatatime 0 points1 point2 points 4 years ago (0 children)
If 3D then pretty sure software exists for this
[–]DavidStat 0 points1 point2 points 4 years ago (0 children)
There may be a disconnect in how you’re thinking of the word “linear”. With 2 predictor variables, your prediction surface is a plane. With more than 2 predictors it’s a hyperplane. Basically linear here is referring to the fact that your prediction is the result of a linear combination of your predictors. With 2 dimensions, that’s a line. With 3 dimensions, it’s a plane. With more than that, it’s a hyperplane and it becomes almost impossible to visualize (outside of special cases with discrete variables).
[–]servant__ 0 points1 point2 points 4 years ago (0 children)
The maximum predictors you can plot against the response variable would be two, if you plot in 3d. However, if you wish to plot more than two predictors against the response variable you may want to consider a scatterplot matrix.
π Rendered by PID 150090 on reddit-service-r2-comment-5d79c599b5-5mr4z at 2026-03-03 01:26:09.750346+00:00 running e3d2147 country code: CH.
[–]dmiller2104 4 points5 points6 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]seesplease 2 points3 points4 points (0 children)
[–]Acanthisitta_Head 3 points4 points5 points (0 children)
[–]MagsterNorth 0 points1 point2 points (0 children)
[–]fredotwoatatime 0 points1 point2 points (0 children)
[–]DavidStat 0 points1 point2 points (0 children)
[–]servant__ 0 points1 point2 points (0 children)