基于R中的模型参数查找期望数

基于R中的模型参数查找期望数,r,statistics,R,Statistics,我一直在研究R中的癌症数据集。我必须以病理学家a-G的评分为变量,拟合两级LCA模型。下面是我的代码 library(poLCA) data("carcinoma") twoclass = poLCA(cbind(A,B,C,D,E,F,G)~1,carcinoma,nclass=2) 现在,我必须找到预期数量的病理学家,他们会根据模型参数将患者分为1类和2类癌症。我相信您必须使用cbind(uuuuuuuuuuuuuuuuuuuuu,twoclass$predclass)函数,但我不确定第一

我一直在研究R中的癌症数据集。我必须以病理学家a-G的评分为变量,拟合两级LCA模型。下面是我的代码

library(poLCA)
data("carcinoma")
twoclass = poLCA(cbind(A,B,C,D,E,F,G)~1,carcinoma,nclass=2)

现在,我必须找到预期数量的病理学家,他们会根据模型参数将患者分为1类和2类癌症。我相信您必须使用cbind(uuuuuuuuuuuuuuuuuuuuu,twoclass$predclass)函数,但我不确定第一个输入是什么。任何帮助都将不胜感激。谢谢

如果您正在查找类和预测类的人口份额,这将起作用:

pred <- cbind(round(twoclass$posterior*100,2), twoclass$predclass)
pred
pred <- cbind(round(twoclass$posterior,4), twoclass$predclass)
       [,1]   [,2] [,3]
  [1,]   0.00 100.00    2
  [2,]   0.00 100.00    2
  [3,]   0.00 100.00    2
  [4,]   0.00 100.00    2
  [5,]   0.00 100.00    2
  [6,]   0.00 100.00    2
  [7,]   0.00 100.00    2
  [8,]   0.00 100.00    2
  [9,]   0.00 100.00    2
 [10,]   0.00 100.00    2
 [11,]   0.00 100.00    2
 [12,]   0.00 100.00    2
 [13,]   0.00 100.00    2
 [14,]   0.00 100.00    2
 [15,]   0.00 100.00    2
 [16,]   0.00 100.00    2
 [17,]   0.00 100.00    2
 [18,]   0.00 100.00    2
 [19,]   0.00 100.00    2
 [20,]   0.00 100.00    2
 [21,]   0.00 100.00    2
 [22,]   0.00 100.00    2
 [23,]   0.00 100.00    2
 [24,]   0.00 100.00    2
 [25,]   0.00 100.00    2
 [26,]   0.00 100.00    2
 [27,]   0.00 100.00    2
 [28,]   0.00 100.00    2
 [29,]   0.00 100.00    2
 [30,]   0.00 100.00    2
 [31,]   0.00 100.00    2
 [32,]   0.00 100.00    2
 [33,]   0.00 100.00    2
 [34,]   0.00 100.00    2
 [35,]   0.00 100.00    2
 [36,]   0.00 100.00    2
 [37,]   0.00 100.00    2
 [38,]   0.00 100.00    2
 [39,]   0.00 100.00    2
 [40,]   0.00 100.00    2
 [41,]   0.00 100.00    2
 [42,]   0.00 100.00    2
 [43,]   0.00 100.00    2
 [44,]   0.00 100.00    2
 [45,]   0.00 100.00    2
 [46,]   0.00 100.00    2
 [47,]   0.00 100.00    2
 [48,]   0.00 100.00    2
 [49,]   0.00 100.00    2
 [50,]   0.00 100.00    2
 [51,]   0.00 100.00    2
 [52,]   0.00 100.00    2
 [53,]   0.00 100.00    2
 [54,]   0.00 100.00    2
 [55,] 100.00   0.00    1
 [56,]   0.00 100.00    2
 [57,]   0.00 100.00    2
 [58,]  26.35  73.65    2
 [59,]   0.00 100.00    2
 [60,]   0.00 100.00    2
 [61,]  98.28   1.72    1
 [62,]  98.28   1.72    1
 [63,]  98.28   1.72    1
 [64,]  98.28   1.72    1
 [65,]  98.28   1.72    1
 [66,]  98.28   1.72    1
 [67,]  98.28   1.72    1
 [68,] 100.00   0.00    1
 [69,] 100.00   0.00    1
 [70,] 100.00   0.00    1
 [71,] 100.00   0.00    1
 [72,] 100.00   0.00    1
 [73,] 100.00   0.00    1
 [74,] 100.00   0.00    1
 [75,] 100.00   0.00    1
 [76,] 100.00   0.00    1
 [77,] 100.00   0.00    1
 [78,] 100.00   0.00    1
 [79,] 100.00   0.00    1
 [80,] 100.00   0.00    1
 [81,] 100.00   0.00    1
 [82,] 100.00   0.00    1
 [83,] 100.00   0.00    1
 [84,] 100.00   0.00    1
 [85,] 100.00   0.00    1
 [86,] 100.00   0.00    1
 [87,] 100.00   0.00    1
 [88,] 100.00   0.00    1
 [89,] 100.00   0.00    1
 [90,] 100.00   0.00    1
 [91,] 100.00   0.00    1
 [92,] 100.00   0.00    1
 [93,] 100.00   0.00    1
 [94,] 100.00   0.00    1
 [95,] 100.00   0.00    1
 [96,] 100.00   0.00    1
 [97,] 100.00   0.00    1
 [98,] 100.00   0.00    1
 [99,] 100.00   0.00    1
[100,] 100.00   0.00    1
[101,] 100.00   0.00    1
[102,] 100.00   0.00    1
[103,] 100.00   0.00    1
[104,] 100.00   0.00    1
[105,] 100.00   0.00    1
[106,] 100.00   0.00    1
[107,] 100.00   0.00    1
[108,] 100.00   0.00    1
[109,] 100.00   0.00    1
[110,] 100.00   0.00    1
[111,] 100.00   0.00    1
[112,] 100.00   0.00    1
[113,] 100.00   0.00    1
[114,] 100.00   0.00    1
[115,] 100.00   0.00    1
[116,] 100.00   0.00    1
[117,] 100.00   0.00    1
[118,] 100.00   0.00    1