在小鼠中使用 2l.norm 的“1 阶领先次要不是正定的”错误

机器算法验证 r 缺失数据 多重插补 老鼠
2022-03-25 23:03:48

我在使用2l.norm多级插补方法时遇到问题mice

不幸的是,由于我的数据大小,我无法发布可重现的示例 - 当我减小大小时,问题就消失了。

对于特定变量,mice会产生以下错误和警告:

Error in chol.default(inv.sigma2[class] * X.SS[[class]] + inv.psi) : 
  the leading minor of order 1 is not positive definite
In addition: Warning messages:
1: In rgamma(n.class, n.g/2 + 1/(2 * theta), scale = 2 * theta/(ss *  :
  NAs produced
2: In rgamma(1, n.class/(2 * theta) + 1, scale = 2 * theta * H/n.class) :
  NAs produced
3: In rgamma(1, n.class/2 - 1, scale = 2/(n.class * (sigma2.0/H - log(sigma2.0) +  :
  NAs produced

如果我使用2l.pannormpmm方法,则不会出现问题。

该变量具有以下分布: 在此处输入图像描述

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
   50.0   117.0   136.0   136.7   155.0   249.0    3124 

此外,班级规模具有以下分布:

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   3.00   50.00   80.00   88.52  111.00  350.00 
1个回答

我在 MICE 中遇到过类似的问题,请参阅我的自我讨论here出现问题的原因是您的模型过度拟合(参数、变量太多)、某些变量高度共线性或者您的案例中所有变量都缺失。

在我的情况下,模型过度拟合。解决此问题的一种方法是调整 MICE 的预测矩阵。您可以给出您的对象imp$pred在哪里,以查看预测矩阵。您可以使用impmids

new.pred <- quickpred(data)

mice(..., pred=new.pred)

根据数据中变量的二元相关性(例如 Pearson、Spearman)自动生成预测矩阵,其中 0.10 是默认截止值。这可能会解决您的问题。更一般地,明智地构建您的模型,而不仅仅是包含您可能拥有的所有变量。