简体   繁体   English

从所有回归变量组合中可视化所有可能的线性回归预测

[英]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. 所以我有一组8个变量,我正在对一个因变量进行回归。 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. 显然我想避免过度拟合所以我想从视觉角度看看我的8个变量的所有组合是什么样的,看看它们是否是真实模型的相关性。 Is there an R function or package that can help me do this? 是否有R功能或包可以帮助我这样做? So far I've been using the "MuMin" package and the dredge() function to run all combinations of variables. 到目前为止,我一直在使用“MuMin”包和dredge()函数来运行所有变量组合。 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. 你要做的事情叫做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. ggpairs函数中的columns选项允许您只选择特定的列。 If you want to automatically use every column in the pairs plot, omit the columns option: 如果要自动使用对图中的每一列,请省略columns选项:

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

This is an example of a Pairs Plot: 这是对情节的一个例子:

对情节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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