我有一系列医生的索赔申请。我想将聚类分析作为一种探索性工具,以根据收入代码、程序代码等内容来查找医生如何计费的模式。数据都是多态的,根据我的基本理解,潜在类算法适用于此种数据。我正在尝试使用 R 的一些集群包,特别poLCA是mclust针对此分析。在使用 对数据样本运行测试模型后,我收到警报poLCA。
> library(poLCA)
> # Example data structure - actual test data has 200 rows:
> df <- structure(list(RevCd = c(274L, 320L, 320L, 450L, 450L, 450L,
636L, 636L, 636L, 450L, 450L, 450L, 301L, 305L, 450L, 450L, 352L,
301L, 300L, 636L, 301L, 450L, 636L, 636L, 307L, 450L, 300L, 300L,
301L, 301L), PlaceofSvc = c(23L, 23L, 23L, 23L, 23L, 23L, 23L,
23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L,
23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L), TypOfSvc = c(51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L,
51L, 51L, 51L), FundType = c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L), ProcCd2 = c(1747L, 656L, 656L, 1375L,
1376L, 1439L, 1623L, 1645L, 1662L, 176L, 1374L, 1376L, 958L,
1032L, 1368L, 1374L, 707L, 960L, 347L, 1662L, 859L, 1375L, 1654L,
1783L, 882L, 1440L, 332L, 332L, 946L, 946L)), .Names = c("RevCd",
"PlaceofSvc", "TypOfSvc", "FundType", "ProcCd2"), row.names = c(1137L,
1138L, 1139L, 1140L, 1141L, 1142L, 1143L, 1144L, 1145L, 1146L,
1147L, 1945L, 1946L, 1947L, 1948L, 1949L, 1950L, 1951L, 1952L,
1953L, 1954L, 1955L, 1956L, 1957L, 1958L, 1959L, 2265L, 2266L,
2267L, 2268L), class = "data.frame")
> clust <- poLCA(cbind(RevCd, PlaceofSvc, TypOfSvc, FundType, ProcCd2)~1, df, nclass = 3)
=========================================================
Fit for 3 latent classes:
=========================================================
number of observations: 200
number of estimated parameters: 7769
residual degrees of freedom: -7569
maximum log-likelihood: -1060.778
AIC(3): 17659.56
BIC(3): 43284.18
G^2(3): 559.9219 (Likelihood ratio/deviance statistic)
X^2(3): 33852.85 (Chi-square goodness of fit)
ALERT: number of parameters estimated ( 7769 ) exceeds number of observations ( 200 )
ALERT: negative degrees of freedom; respecify model
我的新手假设是我需要运行更多的迭代才能获得稳健的结果?例如“......在您可以合理地确定您已经找到产生全局最大似然解的参数估计之前,必须多次运行 poLCA。” (http://www.sscnet.ucla.edu/polisci/faculty/lewis/pdf/poLCA-JSS-final.pdf)。或者,也许某些变量,特别是 CPT 和收入代码,有太多的唯一值,我需要将这些变量聚合到更高级别的类别中以减少参数的数量?
mclust当我使用基于 BIC 优化模型的package 运行模型时,我没有收到任何此类警报。
> library(mclust)
> clustBIC <- mclustBIC(df)
> summary(clustBIC, data = df)
classification table:
1 2
141 59
best BIC values:
VEV,2 VEV,3 EEV,3
-4562.286 -4706.190 -5655.783
如果有人可以对上述警报有所了解,将不胜感激。我还计划使用poLCA文档中的脚本来运行模型的多次迭代,直到对数似然最大化。然而它的计算量很大,我担心在我有机会发布这个之前这个过程会崩溃。如果我在这里遗漏了一些明显的东西,请提前道歉;我是聚类分析的新手。