こんにちは、
毎日、大きなデータ ファイル (10,000 列 x 20,000 行) を管理する必要があります。
私の目標は、ベストフィット法を使用して、制限のあるすべての列から能力統計を取得することです (正規分布しているのは少数の列のみです)。
私は次のような簡単なスクリプトを作成しました:
- 制限付き列をループする、
- プロット分布 > 「すべてに適合」 > 機能、
- レポートウィンドウで情報を選択し、
- レポートウィンドウを閉じる
コードは「機能している」ように見えますが、新しいテーブルが情報と一致するかどうかを確認するためにメトリックを個別にプロットすると、結果が異なる場合があります (分布タイプが同じではなく、Ppk/Cpk 値も同じではありません)。一方、USL、LSL、N は常に正しいです (そのため、スクリプトは適切なウィンドウから情報を取得します)
問題がどこから来ているのか分かりません:
- 新しいループを開始する前にプロセッサが追いつくことを確認するために、いくつかの Wait() コマンドを追加しました (しかし、これで十分でしょうか? 正しい方法でしょうか?)
- JMP の Fits all 関数が期待したほど正確ではないからでしょうか?
- それは何か他のものですか?
15,000 行のテーブルとランダムな数式を生成するスクリプトと、実際のコードを添付しました。
この例では、最初の 1 番目は SHASH であるはずですが、テーブルでは Johnson Sl が報告されています (機能が異なります)。他の 2 つは同様です。
ご協力ありがとうございました=)
説教者
//Create table with random distribution
dt = New Table( "tabletest",
Add Rows( 15000 ),
New Column( "Normal 10,1", Numeric, "Continuous", formula( Random Normal( 10, 1 ) ) ),
New Column( "LogNormal 10,1", Numeric, "Continuous", formula( Random Lognormal( 10, 1 ) ) ),
New Column( "Gamma 10,1", Numeric, "Continuous", formula( Random Gamma( 10, 1 ) ) ),
New Column( "Normal 10,2", Numeric, "Continuous", formula( Random Normal( 10, 2 ) ) );
);
Column( dt, "Normal 10,1" ) << set property( "spec limits", {LSL( 6 ), USL( 14 ), Show Limits( 0 )} );
Column( dt, "LogNormal 10,1" ) << set property( "spec limits", {LSL( 0 ), USL( 400000 ), Show Limits( 0 )} );
Column( dt, "Gamma 10,1" ) << set property( "spec limits", {LSL( 0 ), USL( 40 ), Show Limits( 0 )} );
dt << save( "$Desktop\tabletest.jmp" );
//Get Column only with limits (At east LSL or USL, I don't care about target)
MetricCols = dt << Get Column Names( numeric, continuous );
Show( MetricCols );
For( i = N Items( MetricCols ), i >= 1, i--,
Q = Column( MetricCols[i] ) << Get Property( "Spec limits" );
Show( Q );
spec_x = Eval List( {Arg( Q, 1 )/*, Arg( Q, 2 ), Arg( Q, 3 )*/} );
Show( spec_x );
If( N Row( Loc( spec_x, Empty() ) ),
Remove From( MetricCols, i )
);
);
//Create a new table to collect the stats from the "Test" table
CpkTable = New Table( "Capability Best Fit",
Add Rows( N Items( MetricCols ) ),
New Column( "Metric", "Character", "Nominal" ),
New Column( "N", "Numeric", "Continuous" ),
New Column( "LSL", "Numeric", "Continuous" ),
New Column( "USL", "Numeric", "Continuous" ),
New Column( "Best Fit", "Character", "Nominal" ),
New Column( "Cpk", "Numeric", "Continuous" ),
New Column( "Cpl", "Numeric", "Continuous" ),
New Column( "Cpu", "Numeric", "Continuous" )
);
//Loop to run Distribution > Fit ALL > Capability and collect the stats
For( i = 1, i <= N Items( MetricCols ), i++,
Show( i );
dt = Open( "$Desktop\tabletest.jmp" );
dis = dt << Distribution(
Continuous Distribution( Column( As Column( MetricCols[i] ) ), Fit Distribution( "All" ), Process Capability( 0 ), invisible )
);
Wait( 0 );
// Point to the first capability analysis and create a data table from it
dtCpk = dis << report;
Wait( 0 );
// Fill USL and LSL in the new table
Limits = Column( MetricCols[i] ) << Get Property( "Spec limits" );
Try( CpkTable:LSL[i] = Limits["LSL"] );
Try( CpkTable:USL[i] = Limits["USL"] );
// Find N and fill the new table
Try(
FindN = dtCpk["Summary Statistics"][Number Col Box( 1 )] << get;
CpkTable:N[i] = FindN[6];
);
// find the best fit and fill the new table
Try(
var = dtCpk["Compare Distributions"][String Col Box( "Distribution" )] << get;
CpkTable:Best Fit[i] = var[1];
CpkTable:Metric[i] = Char( MetricCols[i] );
);
// get CPK parameters from best fit capability analysis and fill the new table
Try(
cpk = dtCpk["Fitted " || var[1]]["Quantile Sigma"][Number Col Box( "Index" )] << get;
CpkTable:Cpk[i] = cpk[2];
CpkTable:Cpl[i] = cpk[4];
CpkTable:Cpu[i] = cpk[5];
Show( MetricCols[i] );
Show( var[1] );
Show( cpk );
);
Wait( 0 );
dtCpk << close window;
);ありがとう、ジム。
実際にこのソリューションは機能し、新しいテーブルに適切なフィットが表示されるようになりました。
JMP サポート グループと連絡を取ります。
JSL で、その時点から最適なプロセス能力を生成するスマートな方法はありますか? (新しいテーブルに Cpk、Cpu などを入力できます)
私はそれを行うための汚い方法(適合を見つけ、レポートを閉じ、適切な適合の機能を使用してレポートを再度開く)を考えることもできますが、それを行うよりスマートな方法があれば、私はそれを好みます。
以下のコードのいくつかのバリエーションを試しましたが、動作せず、スクリプト インデックスやディスカッションでも何も見つかりませんでした。
前もって感謝します、
説教者
dis = dt << Distribution(
Continuous Distribution( Column( As Column( MetricCols[i] ) ),/*, Fit Distribution( "All" ),*/ Process Capability( 0 ), invisible )
);
dis << Fit All;
dis << Process Capability ("Lognormal");問題を再現できました。Distribution コマンド内で「Fit Distribution( "All" )」が指定されていることが問題であると絞り込みました。「Fit Distribution」を別の呼び出しに移動すると、矛盾が修正されるようです。
dis = dt << Distribution(
Continuous Distribution( Column( As Column( MetricCols[i] ) )/*, Fit Distribution( "All" ), Process Capability( 0 )*/, invisible )
);
dis << Fit All;
この問題をJMPのサポートグループに報告することをお勧めします。