ExcelのIndex(Match())に相当各一意の ID について、最初の測定値とそれ以降のすべての測定値の間の % エラーを計算したいデータがあります。他の行と列の値に基づいて 1 つのセルからデータを取得する方法がわかりません。これには JSL が必要ですか、それとも Excel で行ったように数式を作成すればよいのでしょうか。
強調表示した 2 つの列を数式を使用して計算したいのですが、実際のセットには数千行のデータがあるため、スクリプトにする必要があり、スクリプトが再度実行されるまで値が静的であることを理解できます。

ご協力いただければ幸いです。
JMP 16を使用しています。
基本的なデータ分析とモデリングRe: Excel の Index(Match()) に相当するものCol Min(Row(), :ID) を使用すると最も古い測定値を取得できます。
:Measurement[Col Min(Row(), :ID)]
これを別の列で使用するか、結果を計算する単一の数式の一部として使用できます。
Re: Excel の Index(Match()) に相当するものありがとうございます。うまくいきました。
ただし、懸念があります。各 ID に2 番目の値を使用したい場合、どうなるでしょうか?
したがって、ID == A の場合、「最も早い測定」列には 10.00001 が表示されます。
Re: Excel の Index(Match()) に相当するものかなり多くの異なるオプションがありますが、理解するのは少し難しいかもしれません。「最も簡単な」アイデアは、Col 統計関数を if ステートメントと組み合わせ、if ステートメントが欠損値または探している値を返すことです。
Col Min(If(Col Cumulative Sum(1, :ID) == 2, :Measurement, .), :ID)

Col 統計関数を使用する利点は、列のグループ化や数式として適切に機能することです。
Re: Excel の Index(Match()) に相当するもの私が最も「JMP らしい」と考える方法は、インタラクティブなソリューションであり、JMP に自動化されたプロセスを作成させ (拡張ログ/ワークフロー ビルダーを使用)、その後 JMP が作成したスクリプトによって残された「問題」を修正することです。
すでにOrder列があるので、使用できると思いますので、Order == 2のサブセットを作成します。右クリック -> 一致するセルを選択 -> サブセットを作成


サブセットから、測定列の名前を別の名前に変更します。次に、元のテーブルに戻り、更新を使用して、IDを一致条件列として使用してサブセットをテーブルに結合します。

これで、2 番目のオーダーからの測定値が列に表示されます。JMP は次のようなスクリプトを作成します。
// Select matching cells
Data Table("JMP Example") << Select Where(:Order == 2);
// Subset data table
// → Data Table("Subset of JMP Example")
Data Table("JMP Example") << Select Where(:Order == 2) <<
Subset(Copy formula(0), Selected Rows(1), Selected columns only(0));
// Change column name: Measurement → Measurement_ORDER2
Data Table("Subset of JMP Example"):Measurement << Set Name("Measurement_ORDER2");
// Update data table
Data Table("JMP Example") << Update(
With(Data Table("Subset of JMP Example")),
Match Columns(:ID = :ID),
Add Columns from Update Table(:Measurement_ORDER2),
Replace Columns in Main Table(None)
);
これは間違いなく最高のスクリプトではありませんが、機能し、何が行われているかを知ることができます。また、このプロセスを開始する前にワークフローの記録を開始し、これを自動化するワークフローを作成することもできます (私は個人的にワークフローを使用せず、拡張ログを好みますが、特に何かを自動化したい場合は非常に役立ちます)。ワークフロー ビルダーによって作成されたスクリプトは次のようになります。
Names Default To Here(1);
Workflow 6=function({},
step_name = "Open Data Table: JMP Example.jmp";
//Open Data Table: JMP Example.jmp
Open("$DOWNLOADS/JMP Example.jmp");
step_name = "Select matching cells";
//Select matching cells
Data Table("JMP Example") << Select Where(:Order == 2);
step_name = "Subset data table";
//Subset data table
Data Table("JMP Example") << Select Where(:Order == 2) <<
Subset(Selected Rows(1), Selected columns only(0));
step_name = "Change column name: Measurement → Measurement2";
//Change column name: Measurement → Measurement2
Data Table("Subset of JMP Example"):Measurement << Set Name("Measurement2");
step_name = "Update data table";
//Update data table
Data Table("JMP Example") << Update(
With(Data Table("Subset of JMP Example")),
Match Columns(:ID = :ID),
Add Columns from Update Table(:Measurement2),
Replace Columns in Main Table(None)
);
step_name = "Close Data Table: Subset of JMP Example";
//Close Data Table: Subset of JMP Example
Close(Data Table("Subset of JMP Example"), NoSave);
);
Workflow 6();
一般的に、ワークフロー ビルダーで作成されたスクリプトは、拡張ログで作成されたスクリプトと同様の問題を抱えていますが、ワークフローには追加の利点があります (そのように考えたい場合、参照の更新などの非常に単純なもの以外は、ほとんどが煩わしいものだと思います)。JMP で作成されたスクリプトを変更する方法は次のとおりです。
Names Default To Here(1);
dt = Open("$DOWNLOADS/JMP Example.jmp");
dt << Clear Column Selection << Clear Select;
rows_of_interest = dt << Get Rows Where(:Order == 2);
dt_subset = dt << Subset(Rows(rows_of_interest),
Copy formula(0),
Selected columns only(0),
Invisible
);
Column(dt_subset, "Measurement") << Set Name("Measurement_ORDER2");
dt << Update(
With(dt_subset),
Match Columns(:ID = :ID),
Add Columns from Update Table(:Measurement_ORDER2),
Replace Columns in Main Table(None)
);
Close(dt_subset, no save);
これらは「より高度な」JSLを使用して実行することもできますが、一般的に、数式を使用してJSLを避けたい場合は、使用しないことをお勧めします。これらを使用する唯一のケースは、速度が必要な場合ですが、その場合でも、最適化しないと遅くなることがあります。以下に、JSLを使用した1つのオプションと、説明のためのコメントを示します。
もっと見る...
Names Default To Here(1);
dt = Open("$DOWNLOADS/JMP Example.jmp");
// Get all IDs into a list using data table subscripting
ids = dt[0, "ID"];
// Get all unique IDs using Summarize (there are many other methods)
// Note that Summarize will change numeric values to strings (doesn't matter in this case)
Summarize(dt, uniq_ids = By(:ID));
// We can loop over the unique IDs while collecting results
// I will store results to Associative Array as it is efficient method and easy to access
aa_idpos = Associative Array();
aa_meas = Associative Array();
idx_of_interest = 2;
For Each({cur_id}, uniq_ids,
// We can use Loc to find specific ID from a list of IDs
cur_idx = Loc(ids, cur_id);
// From this we can pick second index for example and store it to our aa
// Note: Usually you want to check that there is at least two items if you do this
aa_idpos[cur_id] = cur_idx[2];
// You could also get the Measurement value instead
// (I prefer index as then I can access value from any of the columns easily)
aa_meas[cur_id] = :Measurement[cur_idx[idx_of_interest]];
);
// Show(aa_idpos);
// Then you can basically do whatever you want with these
// Fill them into the table for example by using Formula OR For Each Row
// Formula tends to be faster if you just need one column
new_col = dt << New Column("Second Meas by ID", Numeric, Continuous, Formula(
aa_meas[:ID]
));
// aa_meas WON'T be evaluated unless you specifically do it, so either remove the formula
// or evaluate it using eval(evalexpr()) / eval(substitute())
dt << run formulas;
new_col << Delete Formula();
<BR />/*
// or evaluation (one option, there many other options (local variables, not worrying about the scope, ...))
new_col = Eval(EvalExpr(
dt << New Column("Second Meas by ID", Numeric, Continuous, Formula(
aa = As Constant(Expr(aa_meas));
aa[:ID]
));
));<BR />*/
Re: Excel の Index(Match()) に相当するものサンプルデータテーブルのようにデータが順序付けられており、常に2番目の値が存在すると仮定すると、
:Measurement[Col Min( Row(), :ID ) + 1]
シリーズの 2 行目を使用する非常に簡単な方法です。
Re: Excel の Index(Match()) に相当するもの@txnelson が提案したように、これも使用できます:

:Measurement[Col Maximum( If( :Order == 2, Row() ), :ID )]
これにより、各 ID の 2 番目の測定値が返されます。
@ジェイソン
この PowerPoint は、JMP を初めて使用するユーザー向けに、Excel で vlookup を実行する方法を説明するために作成しました。お役に立てれば幸いです。
スティーブ
お役に立てれば幸いです!
Re: Excel の Index(Match()) に相当するもの参照用に複数のエントリを集約する場合、または除外された行がある場合、トピックはさらに複雑になります。
それに加えて、日常業務でこのような計算を頻繁に適用する場合、何度も手動で数式を作成したくはありません。
ウィッシュ リストに、 新しい数式列/分布:「正規化」というウィッシュがあります。
しかし、他のユーザーからの関心は非常に低く、Kudos はわずか 2 つだけです...
そこで私は@mia_stephensのアドバイスに従いました

... 独自のアドインを開発しました。マーケットプレイスで見つけることができます:
https://marketplace.jmp.com/appdetails/Normalization+GUI
アドインは、このような計算を自動的に生成するためのユーザー インターフェイスを提供します。
他の多くのオプションに加えて、「最初」、「最後」、「N-1」のオプションがあります。

正規化のために2 番目のエントリを使用することも可能です。
有効化するだけ

@shampton82が説明しているように、ランク/順序列を使用します。

最終的に、式は次のようになります。

@shampton82のアプローチと非常に似ています:
Col ...集計を使用して、参照値を他の行に配布します。
微妙な違い:行インデックスではなく値を配布します。