本征(x)中的错误:robumeta中的“ x”>中的值无限或缺失

时间:2019-06-28 12:59:42

标签: r

当我尝试在robumeta中使用层次权重执行元分析时,我得到

  

特征(x)中的错误:'x'中的值无限或缺失

使用不会在相关权重上产生任何错误的相同数据。 我的数据矩阵没有任何NA或缺少值。群集包含1到4之间的整数。

有人知道为什么我会收到Eigen(x)错误吗? 重现错误所需的代码:

#load data, you need to adjust read.table depending on where the file is saved.
mydata <- read.table ("H:/Desktop/Max_R_Dataset_Meta_Analysis.csv", header = TRUE, sep = ",")

#install & load packages
library (robumeta)
library (devtools)
install_github("jepusto/clubSandwich")
library (clubSandwich)

#fit moderator model with CORR
res_2 <- robu (formula = effect_size ~ pathway, var.eff.size = effect_size_variance, studynum = Study_ID, modelweights = "CORR", rho = 0.8, small = TRUE, data = mydata)
print (res_2)

#fit moderator model with HIER
hier1 <- robu (formula = effect_size ~ pathway, var.eff.size = effect_size_variance, studynum = cluster, modelweights = "HIER", small = TRUE, data = mydata)
print (hier1)

dput (head(mydata,35))
structure(list(Study_ID = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 
4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 1L, 1L, 1L, 2L, 
2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L), effect_size = c(-0.05, 
-0.09, -4.44, 0.28, 0.25, 0.91, 0.31, 0.31, 0.33, 0.27, 0.13, 
0.71, -0.1, -0.09, -0.28, 0.2, 0.23, 1.23, 0.21, 0.22, 0.29, 
-0.18, -0.16, -0.75, 0.2, 0.24, 2.47, 0.37, 0.36, 2.34, 0.17, 
0.15, 0.85, 0.04, 0), effect_size_variance = c(0.010737802, 0.008056791, 
30.135452, 0.010478163, 0.011260784, 0.093962475, 0.006933061, 
0.008891908, 0.007840352, 0.006092875, 0.007411207, 0.040583305, 
0.021610499, 0.019590468, 0.104406625, 0.012783255, 0.011467534, 
0.333023923, 0.004151044, 0.008464275, 0.006936499, 0.012797742, 
0.007904113, 0.307592997, 0.001625522, 0.002084078, 0.230050467, 
0.009038613, 0.00895868, 0.34524772, 0.004019923, 0.002854116, 
0.078314231, 0.007680706, 0), pathway = c(2L, 4L, 6L, 2L, 4L, 
6L, 2L, 4L, 6L, 2L, 4L, 6L, 2L, 4L, 6L, 2L, 4L, 6L, 2L, 4L, 6L, 
1L, 3L, 5L, 1L, 3L, 5L, 1L, 3L, 5L, 1L, 3L, 5L, 1L, 3L), cluster = c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
2L, 2L), Study_Name = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 
3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 1L, 1L, 
1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L), .Label = c("Desiree Thesis Arab", 
"Desiree Thesis White", "Gijs Direct Replication", "Gijs Indirect Replication", 
"Irina Africa Black", "Irina Africa White", "Irina Thesis", "Max Thesis", 
"Stein Race", "Yuan Exp1"), class = "factor")), row.names = c(NA, 
35L), class = "data.frame")

HIER版本适用于robumeta作者提供的示例数据。

1 个答案:

答案 0 :(得分:1)

感谢NelsonGon,我得到了一个答案: 我的数据集的效果大小为0,这在层次模型中产生了无限的特征值。

这似乎是由于CORR和HIER模型的计算差异造成的:

CORR使用:dframe $ weights <-1 /(dframe $ k * dframe $ avg.var.eff.size),而HIER使用dframe $ weights <-1 / dframe $ var.eff.size。尽管理论上两者都可以产生0,但是您可以在此处进行检查:github.com/zackfisher/robumeta/blob/master/R/robu.R 实际上,本征值实际上是在源代码“内部矩阵”部分中稍后计算的。

由于HIER除以var.eff.size,所以var.eff.size为0会产生错误。