Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在R中使用qgraph包时删除图中具有非有限边权重的节点_R_R Qgraph - Fatal编程技术网

在R中使用qgraph包时删除图中具有非有限边权重的节点

在R中使用qgraph包时删除图中具有非有限边权重的节点,r,r-qgraph,R,R Qgraph,我想在网络上查看我的数据中的关系,并使用了qgraph软件包,使用了我的数据,组合。数据。作为输入传递的数据的相关性有很多NA值。我用来获取网络图的命令是 qgraph(cor(combined.data, method="spearman"),layout="spring", groups=gr, labels=nm, label.scale=FALSE, label.cex=1) # I chose spearman because the data variables

我想在网络上查看我的数据中的关系,并使用了qgraph软件包,使用了我的数据,组合。数据。作为输入传递的数据的相关性有很多NA值。我用来获取网络图的命令是

   qgraph(cor(combined.data, method="spearman"),layout="spring", groups=gr, labels=nm, 
   label.scale=FALSE, label.cex=1) 
   # I chose spearman because the data variables are on ordinal scale
gr是组列表,nm是包含节点标签的向量。 该命令运行良好,但附带警告

  Warning message:
  In qgraph(cor(combined.data, method = "spearman"), layout = "spring",  :
  Non-finite weights are omitted

网络有很多空边(非有限权重),我想移除具有非有限权重的节点。我尝试设置最小值最大值参数,但仍然会出现那些冗余节点。如果您对如何实现这一点有任何建议,我们将不胜感激。

您可能缺少相关矩阵中导致
NA
的数据?我总是使用
cor(combined.data,method=“spearman”,use=“pairwise.complete.obs”)
,它不提供
NA
相关性

或者,最简单的方法是更改输入:

foo <- cor(combined.data, method="spearman")
foo[!is.finite(foo)] <- 0
qgraph(foo)

foo我使用了你的建议,发展是在没有警告的情况下出现图形,但我想去掉那些没有连接边的节点。如何消除(有很多)这些冗余节点?qgraph中没有省略节点的参数。最简单的方法是更改输入。e、 例如,删除相关矩阵中非对角单元格中只有零的所有行和列。