首页 > 解决方案 > 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.

标签: rlinear-regressionprediction

解决方案


您正在尝试做的事情称为配对图。以下是如何实现它:

library(GGally)
library(ggplot2)

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

函数中的columns选项ggpairs允许您仅选择特定列。如果要自动使用对图中的每一列,请省略该columns选项:

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

这是一个配对图的例子:

配对图


推荐阅读