R中缺少值的SVD

时间:2014-11-26 09:45:44

标签: r matrix svd

我正在用R执行SVD分析,但我有一个结构NA值的矩阵。在这种情况下是否可以获得SVD分解?有替代解决方案吗?提前致谢

2 个答案:

答案 0 :(得分:0)

您可能想要在SpatioTemporal软件包中尝试SVDmiss函数,该软件包含缺失值插补以及计算插补矩阵上的SVD。请检查此链接SVDmiss Function

但是,您可能希望对数据的性质保持警惕,以及在您的情况下是否缺少价值估算。

答案 1 :(得分:0)

我尝试在R中使用带有NA值的SVM而没有成功。 有时它们在分析中很重要,所以我通常按如下方式转换数据:

  1. 如果你有很多变量,试着减少它们的数量(聚类,套索等......)
  2. 转换剩余的预测变量:

    - 对于定量变量:

       - calculate deciles per predictor (leaving missing obs out)
       - calculate frequency of Y per decile (assuming Y is qualitative)
       - regroup deciles on their Y freq similarity into 2/3/4 groups 
         (you can do this by looking at their plot too)
       - create for each group a new binary variable 
         (X11 = 1 if X1 takes values in the interval ...)
       - calculate Y frequency for missing obs of that predictor
       - join the missing obs category to the variable that has the closest Y freq 
    

    - 对于定性变量:

       - if you have variables with lots of levels you should do clustering by Y 
         variable
       - for variables with lesser levels, you can calculate Y freq per class
       - regroup the classes like above
       - calculate the same thing for missing obs and attach it to the most similar 
         group of non-missing
       - recode the variable as for numeric case*
    
  3. 在那里,现在你有一个完整的虚拟变量数据库,以及执行SVM,神经网络,LASSO等的机会......