Plotting linear regression for multiple predictors using ggplot

147 views
Skip to first unread message

Anil kumar E S

unread,
Dec 20, 2017, 6:44:57 PM12/20/17
to ggplot2
Hello,

How to plot the multi-variable linear regression line using the ggplot?
I tried adding interaction terms to x value, it doesn't seem to work!

Thank you!

Best regards
Anil

Roman Luštrik

unread,
Dec 21, 2017, 4:01:32 AM12/21/17
to Anil kumar E S, ggplot2
Plotting more than a few variables is quite hard. You could get away plotting a 3D plot (if applicable) and map 4-5th variable to color and shape. But 3D plots are not ideal and currently not supported by ggplot2.

Try playing with `facet_wrap` or `facet_grid` to slice through non-continuous variables.

Cheers,
Roman

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
In God we trust, all others bring data.

Anil kumar E S

unread,
Dec 21, 2017, 11:32:53 AM12/21/17
to Roman Luštrik, ggplot2
Cool, thanks!

On Thu, 21 Dec 2017 at 10:01, Roman Luštrik <roman....@gmail.com> wrote:
Plotting more than a few variables is quite hard. You could get away plotting a 3D plot (if applicable) and map 4-5th variable to color and shape. But 3D plots are not ideal and currently not supported by ggplot2.

Try playing with `facet_wrap` or `facet_grid` to slice through non-continuous variables.

Cheers,
Roman
On Thu, Dec 21, 2017 at 12:00 AM, Anil kumar E S <anil...@gmail.com> wrote:
Hello,

How to plot the multi-variable linear regression line using the ggplot?
I tried adding interaction terms to x value, it doesn't seem to work!

Thank you!

Best regards
Anil

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com

More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Kieron Scully

unread,
Dec 22, 2017, 9:06:48 AM12/22/17
to ggplot2
Interaction terms transform one model into another model depending on group/level, so really you want to look at multiple lines/graphs with that approach. The advice already given should help you with that. You could also look at whether you need that level of complexity in your model i.e removing variables.
Reply all
Reply to author
Forward
0 new messages