R中具有虚拟变量的多项式Lo​​gistic回归

时间:2019-12-06 00:11:03

标签: r logistic-regression multinomial nnet

我的数据看起来像这样:

Disease.1   Disease.2   Disease.3   Id  DrugA   DrugB   DrugC
1           1           0           1   1       0       1
1           0           1           2   0       0       1
0           1           0           3   1       0       0
0           0           1           4   1       1       0
1           1           1           5   0       0       1

我的目标是利用药物A,B或C的存在来预测Type.1,Type.2和Type.3

如上所示,一个人可以使用任何药物组合,也可以患有任何疾病组合。我不能只将所有疾病都放在一个专栏中,因为有些人可能患有多种疾病。另外我还有大约15列疾病和大约60列药物,因此它必须采用这种虚拟变量格式

我尝试过nnet软件包

multinom.fit <-multinom(Disease.1 + Disease.2 + Disease.3〜DrugA + DrugB + DrugC,数据=数据),但是疾病存在于单独的列中

任何解决方案?

0 个答案:

没有答案
相关问题