如何比较包含 0 和 1 的行以找出两种疾病的患病率和聚类情况?您好,我是 JMP 的新用户,没有经验,正在写我的博士论文。 我根本不知道如何比较我的部分数据,我需要帮助。 我的数据由 146 列组成,其中 1 或 0(是/否)分别代表 146 种医疗状况。 我有大约 14000 行(患者)来比较这些数据。 我需要找出同一个人的两种疾病最常见组合的顺序。 我怎样才能做到这一点?
非常感谢帮助,
艾玛
高级统计建模数据混合和清理回复:如何比较 0 和 1 的行来找出两种疾病的患病率和聚类情况?感谢 txnelson 和其他所有人的意见和建议! 我在分析过程中停止了,不得不重新开始提取原始数据,所以我还无法尝试解决方案。 到时候我会回来的。 谢谢你!
回复:如何比较 0 和 1 的行来找出两种疾病的患病率和聚类情况?出现这样的情况“同一个人的两种医疗状况最常见组合的顺序“可能意味着一些不同的分析目标。 但是,无论暗示什么分析,我都强烈建议首先查看数据“中”的内容。
一种方法是使用“列 > 实用程序 > 组合列...”来创建一个新列,其中包含每个患者每种情况的状态。 然后,您可以使用“图形 > 图形生成器”创建此新列的树形图,并通过工具提示检查结果。 如果您不确定如何执行此操作的详细信息,请尝试在线文档。 请注意,在如此多的条件下,这可能会变得一团糟。
作为新用户,您可能对脚本编写不感兴趣。 但下面的脚本模拟了一些数据,并制作了树形图。 由于随机性,你每次看到的可能会有所不同。 但运行这段代码应该会生成一个如下图:

要运行脚本,请执行“文件>新建>新脚本”,将代码粘贴到出现的窗口中,然后执行“编辑>运行脚本”。
NamesDefaultToHere(1);
// Generate some fake binary data for each condition (maximum possible incidence for one condition is 20% of the patients):
// This is unrepresentative since the incidences of the conditions are treated as independent, but the in practice this may not
// be the case
nr = 1400; // Number of patients
nc = 15; // Number of conditions
m = J(nr, nc, 0);
for(c=1, c<=nc, c++,
incidence = RandomInteger(0, Round(0.2 * nr));
m[RandomIndex(nr, incidence), c] = 1;
);
dt = asTable(m);
dt << setName("Fake Incidence Data");
// Use 'Combine Columns' to make a binary string for each patient indicating what conditions they have
cols = dt << getColumnNames;
dt << combineColumns(columns(Eval(cols)), ColumnName("Patient Condition"), Delimiter( "" ), MultipleResponse(0));
// Make a Treemap of the patient conditions
dt << Graph Builder(
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :Patient Condition ) ),
Elements( Treemap( X, Legend( 1 ) ) )
);
// Aggregate the patient comnditions to a new table and sort it (descending)
//dt2 = dt << Summary(Group(:Patient Condition));
//dt2 << Sort(By(:N Rows), ReplaceTable, Order(Descending));
回复:如何比较 0 和 1 的行来找出两种疾病的患病率和聚类情况?我创建了一个示例脚本,它生成一个示例数据表来运行分析。我只创建 100 行数据,因为创建数据对需要一段时间。生成的表格提供了每种医疗状况组合的患者数量。

如果同时对所有 14000 名患者运行该脚本,将需要相当长的时间。您可以轻松地在数据子集上运行它,然后合并结果表。
Names Default To Here( 1 );
dt = New Table( "raw Data" );
dt << add rows( 100 );
dt << New Column( "Patient", set each value( Row() ) );
Try( dt << delete columns( "Column 1" ) );
For( i = 1, i <= 146, i++,
dt << New Column( "Med Cond " || Char( i ),
set each value( Round( Random Uniform( 0, 1 ), 0 ) )
)
);
// Create the paired data table
dtPair = New Table( "Pairs",
New Column( "Patient" ),
New Column( "First Med Cond", Character ),
New Column( "Second Med Cond", Character )
);
//Populate the Pairs Table
For( theRow = 1, theRow <= N Rows( dt ), theRow++,
For( theFirstCond = 2, theFirstCond <= N Cols( dt ), theFirstCond++,
If( Column( dt, theFirstCond )[theRow] == 1,
thePatient = dt:Patient[theRow];
firstCond = (Column( dt, theFirstCond )) << get name;
For( theSecondCond = theFirstCond + 1, theSecondCond <= N Cols( dt ),
theSecondCond++,
If( Column( dt, theSecondCond )[theRow] == 1,
dtPair << add row( 1 );
pairRow = N Rows( dtPair );
dtPair:Patient[pairRow] = thePatient;
dtPair:First Med Cond[pairRow] = firstCond;
dtPair:Second Med Cond[pairRow] = (Column( dt, theSecondCond )) << get name;
)
);
)
)
);
dtSummary = dtPair << Summary(
Group( :First Med Cond, :Second Med Cond ),
Freq( "None" ),
Weight( "None" )
);
dtSummary << sort( by(N Rows), order(descending), replace table(11));回复:如何比较 0 和 1 的行来找出两种疾病的患病率和聚类情况?你好@艾玛LT ,
我想我知道如何做你所询问的事情,但如果你可以分享你的一些数据,那将会有所帮助 - 如果需要,你可以将其匿名。 它不需要是整个数据集,只需一个子集,以便我可以更好地理解数据的结构,因为这可能会影响如何进行分析。
DS