【发布时间】:2023-03-23 23:47:01
【问题描述】:
我正在使用 R 执行 SVD 分析,但我有一个具有结构 NA 值的矩阵。在这种情况下是否可以获得 SVD 分解?有替代解决方案吗?提前致谢
【问题讨论】:
我正在使用 R 执行 SVD 分析,但我有一个具有结构 NA 值的矩阵。在这种情况下是否可以获得 SVD 分解?有替代解决方案吗?提前致谢
【问题讨论】:
您可能想尝试 SpaatioTemporal 包中的 SVDmiss 函数,该函数执行缺失值插补以及计算插补矩阵上的 SVD。检查此链接SVDmiss Function
但是,您可能需要警惕数据的性质以及缺失值插补在您的情况下是否有意义。
【讨论】:
我尝试在 R 中使用具有 NA 值的 SVM,但没有成功。 有时它们在分析中很重要,所以我通常按如下方式转换我的数据:
像这样转换剩余的预测变量:
- 对于定量变量:
- 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*
现在,您有了一个完整的虚拟变量数据库,并有机会执行 SVM、神经网络、LASSO 等......
【讨论】: