外れ値を自動的に選択する複数のバッチで構成される 7000 行があります。バッチごとに分布を実行し、外れ値ボックス プロットを使用して外れ値を探しています。しかし、バッチが 100 以上あるのですが、どの行が外れ値であるかを JMP に自動的に選択させる方法はありますか?
Re: 外れ値を自動的に選択するこれは必要なものですか?
Names Default To Here( 1 );
// make a sample data table
dt = New Table( "Data",
add rows( 10000 ),
New Column( "it", Numeric, Ordinal, Format( "Best", 8 ), Formula( Row() ) ),
New Column( "Batch", Numeric, Ordinal, Format( "Best", 8 ), formula( Random Integer( 110 ) ) ),
New Column( "y1", Numeric, Continues, Format( "Best", 8 ), formula( Random Lognormal( :Batch / 10, 5 ) ) ),
New Column( "y2", Numeric, Continues, Format( "Best", 8 ), formula( Random Lognormal( :Batch / 10, 5 ) ) ),
New Column( "Out",
Numeric,
Ordinal,
Format( "Best", 8 ),
Set Property( "Value Colors", {0 = -13977687, 1 = -4222943} ),
Color Cell by Value,
formula( 0 )
),
New Column( "Outy1",
Numeric,
Ordinal,
Format( "Best", 8 ),
Set Property( "Value Colors", {0 = -13977687, 1 = -4222943} ),
Color Cell by Value,
formula( 0 )
),
New Column( "Outy2",
Numeric,
Ordinal,
Format( "Best", 8 ),
Set Property( "Value Colors", {0 = -13977687, 1 = -4222943} ),
Color Cell by Value,
formula( 0 )
),
);
dt << run formulas;
Column( dt, "it" ) << delete formula;
Column( dt, "Batch" ) << delete formula;
Column( dt, "y1" ) << delete formula;
Column( dt, "y2" ) << delete formula;
Column( dt, "Out" ) << delete formula;
Column( dt, "Outy1" ) << delete formula;
Column( dt, "Outy2" ) << delete formula;
// now we get to work
// make a list of batches
byvarlist = Associative Array( dt:Batch ) << get keys;
// make a list of columns
cols = dt << get column names( Continuous ); //List all Numeric columns
// loop through the batches
For( i = 1, i <= N Items( byvarlist ), i++,
// select each batch
dt << select where( dt:Batch == byvarlist[i] );
// subset each batch
subdt = dt << Subset( Selected Rows( 1 ) );
// clear selection for smoth workflow
dt << clear select;
// finde outliers in each variable within each batch
For( ii = 1, ii <= N Items( cols ), ii++,
out = Eval(
Parse(
"subdt << get rows where(
subdt:" || Char( cols[ii] ) || " > Col Quantile( subdt:" || Char( cols[ii] ) ||
", 0.75 ) + 1.5 * (Col Quantile( subdt:" || Char( cols[ii] ) || ", 0.75 ) - Col Quantile( subdt:" || Char( cols[ii] ) ||
", 0.25 )) | subdt:" || Char( cols[ii] ) || " <
Col Quantile( subdt:" || Char( cols[ii] ) ||
", 0.25 ) - 1.5 * (Col Quantile( subdt:" || Char( cols[ii] ) || ", 0.75 ) - Col Quantile( subdt:" || Char( cols[ii] ) ||
", 0.25 )));"
)
)`;
Eval( Parse( "column (subdt, \!"Out" || Char( cols[ii] || "\!" )[" || Char( out ) || "] = 1;" ) ) );
// also indicate the global outlier
Column( subdt, "Out" )[out] = 1;
//wait (0.00001);
);
// update original data table with new information for the batch
subdt << delete columns( "Batch" );
subdt << delete columns( cols );
dt << Update( With( subdt ), Match Columns( :it = :it ) );
Close( subdt, No Save );
//Wait( 0.00001 );
);
dt << color by column( :Out );
Re: 外れ値を自動的に選択するもう 1 つだけ簡単な質問です。 約90列を削除しましたが、これでうまくいきますか
n 列でしょうか、それとも常に 3 列である必要がありますか?
Re: 外れ値を自動的に選択する効果があるようです。ありがとう。
Re: 外れ値を自動的に選択するそれがあなたにとってうまくいくかどうかを見てください...
あなたが送ったスクリプトはあなたのデータにまったく適合していませんでした...
Re: 外れ値を自動的に選択する添付のデータは、これを使用しようとしていたデータの例です。理想的には、これを各 Y に対して実行します。
Re: 外れ値を自動的に選択する私の式はバッチサイズの影響を受けません。さらに、バッチ列が文字(数値ではなく)であっても機能します。
2 つまたは 3 つの異なるバッチだけでもサンプルを投稿できますか?Re: 外れ値を自動的に選択する実行すると、テーブルが 1 つ取得されます。これがそのスナップショットです。
すべてを選択したい場合は、Out = 1 の行を選択できるため、機能します。
異常値。
[画像: image.png]
Re: 外れ値を自動的に選択するスクリプト全体を実行すると、望んでいたものが得られることがわかりますか (データ上ではないだけです)。Re: 外れ値を自動的に選択する//からすべてをコピーします。これから作業を始めます。 これを実行すると
私自身のテーブルでは、1 つのバッチのみで 1 つのテーブルを作成するだけです。 私は言わなければならない
1 つは、バッチごとのポイント数が一貫していないことです。 私はします
それが重要かどうかはわかりません。
Re: 外れ値を自動的に選択するこれは私にとってはうまくいきました。
最終的にはテーブルが 3 つできるはずです。すべての行を含むオリジナルで、1 つは異常値のみを含み、最後の行は異常値を含みません。うまくいくかどうか教えてください。
Names Default To Here( 1 );<BR /><BR />// make a sample data table<BR />dt = New Table( "Data",<BR /> add rows( 10000 ),<BR /> New Column( "it", Numeric, Continues, Format( "Best", 8 ), Formula( Row() ) ),<BR /> New Column( "Batch", Numeric, Ordinal, Format( "Best", 8 ), formula( Random Integer( 110 ) ) ),<BR /> New Column( "y", Numeric, Continues, Format( "Best", 8 ), formula( Random Lognormal( :Batch / 10, 5 ) ) ),<BR /> New Column( "Out", Numeric, Ordinal, Format( "Best", 8 ), formula( 0 ) ), <BR /><BR />);<BR /><BR />dt << run formulas;<BR />Column( dt, "it" ) << delete formula;<BR />Column( dt, "Batch" ) << delete formula;<BR />Column( dt, "y" ) << delete formula;<BR />Column( dt, "Out" ) << delete formula;<BR /><BR />// now we get to work<BR />dt = Current Data Table();<BR />byvarlist = Associative Array( dt:Batch ) << get keys;<BR />For( i = 1, i <= N Items( byvarlist ), i++,<BR /> dt << select where( dt:Batch == byvarlist[i] );<BR /> subdt = dt << Subset( Selected Rows( 1 ) );<BR /> dt << clear select;<BR /> subdt:Out << set formula(<BR /> If(<BR /> :y > Col Quantile( :y, 0.75 ) + (Col Quantile( :y, 0.75 ) - Col Quantile( :y, 0.25 )) * 1.5, 1,<BR /> :y < Col Quantile( :y, 0.25 ) - (Col Quantile( :y, 0.75 ) - Col Quantile( :y, 0.25 )) * 1.5, 1,<BR /> 0<BR /> )<BR /> );<BR /> subdt << run formulas;<BR /> Column( subdt, "Out" ) << delete formula;<BR /> keep = {"it", "Out"};<BR /> todelete = subdt << get column names( "string" );<BR /> For( icol = 1, icol <= N Items( keep ), icol++,<BR /> Remove From( todelete, Contains( todelete, Keep[icol] ), 1 )<BR /> );<BR /> subdt << delete columns( todelete );<BR /> dt << Update( With( subdt ), Match Columns( :it = :it ) );<BR /> Close( subdt, No Save );<BR /> Wait( 0.00001 );<BR />);<BR />selected = dt << select where( :Out == 1 );<BR />selected << Markers( 11 );<BR />selected << Marker Size( 8 );<BR />selected << Row Colors( red );<BR />dt << clear select;<BR /><BR />dt << select where( dt:Out == 1 );<BR />Outdt = dt << Subset( Selected Rows( 1 ) );<BR />dt << clear select;<BR /> <BR />Wait( 0.00001 );<BR /> <BR />dt << select where( dt:Out == 0 );<BR />indt = dt << Subset( Selected Rows( 1 ) );<BR />dt << clear select;<BR /><BR />
Re: 外れ値を自動的に選択する私が送信した最後のメッセージが届いたかどうかわかりませんが、奇妙なメッセージが届きました
自動返信メール。 2番目のものを修正しましたが、まだ動作しています
同じこと。
Re: 外れ値を自動的に選択するforループではそうではありませんRe: 外れ値を自動的に選択する私のバッチ列は大文字です:
[画像: image.png]
Re: 外れ値を自動的に選択する列名は大文字と小文字が区別されます。:Batch または :batch を使用する場合は一貫してください。Re: 外れ値を自動的に選択するこれを実行すると、最初のバッチのみでサブセットテーブルが作成されました。 私
開いているテーブルを実行するようにこれを変更しました:
dt = currentdatatable();
byvarlist = Associative Array( dt:Batch ) << get keys;
For( i = 1, i <= N Items( byvarlist ), i++,
dt << select where( dt:batch == byvarlist[i] );
subdt = dt << Subset( Selected Rows( 1 ) );
dt << clear select;
subdt:Out << set formula(
If(
:y > Col Quantile( :y, 0.75 ) + (Col Quantile( :y, 0.75 )
-Col Quantile( :y, 0.25 )) * 1.5, 1,
:y < Col Quantile( :y, 0.25 ) - (Col Quantile( :y, 0.75 )
-Col Quantile( :y, 0.25 )) * 1.5, 1,
0
)
);
subdt << run formulas;
Column( subdt, "Out" ) << delete formula;
keep = {"it", "Out"};
todelete = subdt << get column names( "string" );
For( icol = 1, icol <= N Items( keep ), icol++,
Remove From( todelete, Contains( todelete, Keep[icol] ), 1 )
);
subdt << delete columns( todelete );
dt << Update( With( subdt ), Match Columns( :it = :it ) );
Close( subdt, No Save );
);
selected = dt << select where( :Out == 1 );
selected << Markers( 11 );
selected << Marker Size( 8 );
selected << Row Colors( red );
dt << clear select;Re: 外れ値を自動的に選択するもう一度試してみます
これは洗練されたソリューションではありませんが、手順が明確で変更が簡単です
Names Default To Here( 1 );
// make a sample data table
dt = New Table( "Data",
add rows( 10000 ),
New Column( "it", Numeric, Continues, Format( "Best", 8 ), Formula( Row() ) ),
New Column( "Batch" ,Numeric, Ordinal, Format( "Best", 8 ), formula( random integer (110) )),
New Column( "y" ,Numeric, Continues, Format( "Best", 8 ), formula( random log normal (:Batch / 10, 5) )),
New Column( "Out" ,Numeric, Ordinal, Format( "Best", 8 ), formula (0)),
);
dt << run formulas;
column (dt, "it") << delete formula;
column (dt, "Batch") << delete formula;
column (dt, "y") << delete formula;
column (dt, "Out") << delete formula;
// now we get to work
// extract the list of the by variable levels
byvarlist = Associative Array( dt:Batch ) << get keys;
// run across each group and locate the outliers
For( i = 1, i <= N Items( byvarlist ), i++,
// produce a subset data table for each group using selection method
dt << select where (dt:batch == byvarlist[i]);
subdt = dt << Subset(
Selected Rows( 1 ),
);
dt << clear select;
// indicate outliers within the group
subdt:Out << set formula(
If(
:y > Col Quantile( :y, 0.75 ) + (Col Quantile( :y, 0.75 ) -
Col Quantile( :y, 0.25 )) * 1.5, 1,
:y < Col Quantile( :y, 0.25 ) - (Col Quantile( :y, 0.75 ) -
Col Quantile( :y, 0.25 )) * 1.5, 1,
0
)
);
subdt << run formulas;
// prepare table for updating original by removing formulas and columns that are not needed
column (subdt, "Out") << delete formula;
keep = {"it", "Out"};
todelete = subdt << get column names( "string" );
For( icol = 1, icol <= N Items( keep ), icol++,
Remove From( todelete, Contains( todelete, Keep[icol] ), 1 )
);
subdt << delete columns( todelete );
// update
dt << Update(
With( subdt ),
Match Columns( :it = :it )
);
Close( subdt, No Save );
);
// now the original data has all the outliers indicated in a column
selected = dt << select where (:Out == 1);
selected << Markers( 11 );
selected << Marker size ( 8 );// not working???
selected << Row Colors( red );// not working???
dt << clear select;
Re: 外れ値を自動的に選択するテーブルをバッチごとに分割し、一意の値ごとにグループ化して(行が失われないように)、スクリプトを実行してみてください。
それ以外の場合は、私が提供する戦略とは異なる戦略が必要です。
それは意味がありますか?Re: 外れ値を自動的に選択するこれをデータで機能させることができません。列の高さと重みを変更し、テーブルを開いてテーブルに埋め込んだ2行を削除しましたが、評価が完了したと表示されますが、何も実行されません。
また、バッチごとに by と this を個別に使用するものも必要です。
Re: 外れ値を自動的に選択するこんにちは、
おそらくここに解決策があります:
https://community.jmp.com/t5/Discussions/How-to-extract-month-in-words-from-a-date-value-how-to-change/mp/19362/highlight/true#M17650
ロン
Re: 外れ値を自動的に選択するGrubbのスクリプトを試してみました。これは外れ値を表示するだけで、行は強調表示されませんよね?行を強調表示するものが必要です。
Re: 外れ値を自動的に選択するby に変数が必要な場合、外れ値のスクリーニングは機能しません。私がやりたいのは、Y を 1 つの列に入れることです。別の列にはバッチというラベルが付いています。byでバッチを入れて、バッチをやりながら配布数を作っていきます。つまり、100 回のディストリビューションとします。100 個の分布すべての外れ値をすべて強調表示するスクリプトが必要です。理想的には、行だけを強調表示して、さまざまなものに色を使用するので、自分の色を選択できるようにします。今ではもっと意味が分かりますか?
Re: 外れ値を自動的に選択する検索していたらファイル交換の一部JMPコミュニティのために '外れ値」とすると、次の 2 つのユーティリティ スクリプトが見つかるはずです。
もちろん、これらの各テストの統計的根拠は、状況と基準に適している必要があります。
Re: 外れ値を自動的に選択するあなたが何を探しているのか正確にはわかりません。特定の分布の行を選択する場合は、出力を表示するときに、外れ値箱ひげ図で表示されている外れ値データ ポイントをドラッグするだけで、外れ値データ ポイントが選択されます。

ただし、列から列に移動して異常値の行を選択する場合は、単純なスクリプトで実行できますが、行の選択はすべての列にわたって行われるため、最終的にはいずれかの列が選択された行が選択されることになることに注意してください。 。
本当に必要なのは、外れ値である個々のセルをすべて色付けする単純なスクリプトです。平均値を大幅に上回っている場合は赤、平均値を下回る外れ値の場合はオレンジ色になる可能性があります。
何を探しているのか正確に説明していただけますか?
より良い答えについては、ダンの返信を参照してください。
Re: 外れ値を自動的に選択する[分析] > [スクリーニング] > [異常値の探索] を参照するとよいでしょう。