简体   繁体   中英

Visualizing All Possible Linear Regression Predictions from all Combinations of Regression Variables

So I have a set of 8 variables that I'm regressing against a dependent variable. Obviously I want to avoid over fitting so I want to see what all combinations of my 8 variables look like from a visual perspective to see if their is a correlation around the true model. Is there an R function or package that can help me do this? So far I've been using the "MuMin" package and the dredge() function to run all combinations of variables. What I'd like to do now is visualize all of them too. Any recommendations are appreciated.

What you are trying to do is called a Pairs Plot. Here is how you can implement it:

library(GGally)
library(ggplot2)

ggpairs(data = your_data,
        columns = c('column name 1', 'column name 2', 'column name 3'),
        title = 'Pairs Plot')

The columns option within the ggpairs function allows you to only choose specific columns. If you want to automatically use every column in the pairs plot, omit the columns option:

ggpairs(data=your_data, title='Pairs Plot')

This is an example of a Pairs Plot:

对情节

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM