如何将行与 0 和 1 进行比较以找出两种医疗状况的患病率和聚类情况?您好,我是 JMP 的新用户,没有经验,正在撰写我的博士论文。 我根本不知道如何比较我的部分数据,我需要帮助。 我的数据由 146 列组成,分别为 146 种医疗状况为 1 或 0(是/否)。 我有大约 14000 行(患者)来比较这些数据。 我需要找出同一个人的两种疾病最常见组合的顺序。 我怎样才能做到这一点?
非常感谢帮助,
艾玛
分析回复:如何比较行与 0 和 1 以找出两种医疗状况的患病率和聚类情况?你好@EmmaLT ,
我想我知道如何做你问的事情,但如果你能分享你的一些数据会有所帮助——如果需要,你可以将它匿名。 它不需要是整个数据集,只是一个子集,这样我就可以更好地了解数据的结构,因为这可能会影响如何进行分析。
DS
回复:如何比较行与 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 以找出两种疾病的患病率和聚类情况?出现的是“同一个人两种疾病最常见组合的顺序"可能意味着几个不同的分析目标。 但是,无论隐含的分析是什么,我都强烈建议先查看数据“中”的内容。
一种方法是使用“Cols > Utilities > Combine Columns...”来创建一个新列,其中包含每个患者在每种情况下的状态。 然后您可以使用“Graph > Graph Builder”来制作这个新列的树状图,并通过工具提示检查结果。 如果您不确定如何执行此操作的详细信息,请尝试在线文档. 请注意,在如此多的条件下,这可能只是一团糟。
作为新用户,您可能对编写脚本不感兴趣。 但是下面的脚本模拟了一些数据,并制作了Treemap。 由于随机性,您每次看到的内容可能会有所不同。 但是运行此代码应该会生成如下图:

要运行脚本,请执行“文件 > 新建 > 新脚本”,将代码粘贴到出现的窗口中,然后执行“编辑 > 运行脚本”。
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));