行を0と1と比較して、2つの病状の有病率とクラスタリングを見つける方法は?こんにちは、私は博士論文に取り組んでいるJMPの新しい経験のないユーザーです。 データの一部を比較する方法がわからないため、サポートが必要です。 私のデータは、146の病状に対してそれぞれ1または0(はい/いいえ)の146列で構成されています。 このデータを比較するための約14000行(患者)があります。 同じ人の2つの病状の最も一般的な組み合わせの順序を見つける必要があります。 どうやってやるの?
助けてくれてとても感謝しています、
エマ
分析Re:2つの病状の有病率とクラスタリングを見つけるために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));Re:2つの病状の有病率とクラスタリングを見つけるために0と1の行を比較する方法は?「同じ人の2つの病状の最も一般的な組み合わせの順序"は、いくつかの異なる分析目的を意味する可能性があります。 しかし、どのような分析が暗示されていても、最初にデータの内容を確認することを強くお勧めします。
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));
Re:2つの病状の有病率とクラスタリングを見つけるために0と1の行を比較する方法は?やあ@EmmaLT 、
私はあなたが求めていることをどのように行うかについての考えを持っていると思いますが、データの一部を共有できれば役に立ちます-必要に応じて匿名化できます。 分析の方法に影響を与える可能性があるため、データがどのように構造化されているかをよりよく理解できるように、データセット全体である必要はなく、サブセットである必要があります。
DS