如何比較包含 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