[英]How to interpret multicollinearity in a correlation plot?
Perhaps one way is through a qgraph.也许一种方法是通过 qgraph。 First I'll load the Holzinger data from the
lavaan
package, the correlation function from the correlation
package, and the qgraph function with the qgraph
package with the following libraries:首先,我将从
lavaan
package 加载 Holzinger 数据,从correlation
性 package 加载相关性 function,并使用以下库加载 qgraph function 和qgraph
package:
library(correlation)
library(qgraph)
library(lavaan)
Create the correlation matrix from the Holzinger data:从 Holzinger 数据创建相关矩阵:
cor_holz <- HolzingerSwineford1939 %>%
correlation()
Then make the qgraph of all the correlations together.然后一起制作所有相关性的qgraph。 The thicker lines are stronger correlations, with green indicating positives and red for negatives.
较粗的线表示相关性更强,绿色表示正,红色表示负。 You can see in this graph for example that x4-x6 are highly correlated in the thick green triangle:
例如,您可以在此图中看到 x4-x6 在粗绿色三角形中高度相关:
qgraph(cor_holz)
Which makes this:这使得:
You can fancy it up a bit by establishing cutoffs for correlation values (helpful if you want to pinpoint which have the strongest correlations), add a title, and change the dimensions:您可以通过为相关值建立截止值(如果您想查明哪些具有最强相关性会很有用)、添加标题并更改维度来使它更有趣:
qgraph(cor_holz, # correlation
cut=.30, # cutoff value for correlations
details = T, # shows details
mar = c(6,10,6,10), # size of graph
vsize = 8, # size of nodes
title = "Q Graph of All Correlations") # title
A more clear cut example is with the FacialBurns
data in the same lavaan package, which shows much more obvious multicollinearity and lack thereof in the respective variables:一个更清晰的示例是同一 lavaan package 中的
FacialBurns
数据,它显示了更明显的多重共线性,并且在各个变量中缺乏多重共线性:
face_cor <- FacialBurns %>%
correlation()
qgraph(face_cor)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.