Hallo,
Ich muss täglich große Datendateien verwalten (10.000 Spalten x 20.000 Zeilen).
Mein Ziel besteht darin, Fähigkeitsstatistiken aus allen Spalten mit Grenzwerten zu erhalten, indem ich die Methode der besten Anpassung verwende (nur wenige Spalten sind normalverteilt).
Ich habe schnell und unkompliziert ein Skript erstellt, das:
- Durchlaufen von Spalten mit Begrenzungen,
- Plotverteilung > "für alle geeignet" > Fähigkeit,
- wählt die Informationen im Berichtsfenster aus und
- Schließen Sie das Berichtsfenster
Der Code „scheint“ zu funktionieren, aber wenn ich die Messwerte einzeln plotte, um zu überprüfen, ob die neue Tabelle mit den Informationen übereinstimmt, unterscheiden sich die Ergebnisse manchmal (nicht derselbe Verteilungstyp, nicht dieselben Ppk/Cpk-Werte). Andererseits sind USL, LSL und N immer richtig (das Skript wählt also die Informationen aus dem richtigen Fenster).
Ich weiß nicht, woher das Problem kommt:
- Ich habe einige Wait()-Befehle hinzugefügt, um sicherzustellen, dass der Prozessor aufholen kann, bevor eine neue Schleife gestartet wird (aber ist das genug? Ist das der richtige Weg?)
- Liegt es daran, dass die Funktion „JMP Fits all“ nicht so präzise ist, wie ich es erwarte?
- Ist es etwas anderes?
Ich habe ein Skript angehängt, das eine Tabelle mit 15.000 Zeilen und zufälligen Formeln generiert, gefolgt vom eigentlichen Code.
In diesem Beispiel sollte der erste SHASH sein, aber in der Tabelle wird Johnson Sl (mit anderer Fähigkeit) gemeldet. Die beiden anderen sind ähnlich.
Vielen Dank für Ihre Hilfe 
Prediger
//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;
);Danke Jim,
Tatsächlich funktioniert die Lösung und zeigt nun die richtige Passform in der neuen Tabelle an.
Ich werde mit der JMP-Supportgruppe kommunizieren.
Gibt es eine intelligente Möglichkeit, in JSL die Prozessfähigkeit für die beste Anpassung ab diesem Punkt zu generieren? (Damit ich die neue Tabelle mit Cpk, Cpu usw. füllen kann.)
Ich könnte mir eine schmutzige Methode vorstellen (Passung finden, Bericht schließen, Bericht mit der Funktion der richtigen Passung erneut öffnen), aber wenn es eine intelligentere Methode gibt, würde ich diese bevorzugen.
Ich habe einige Variationen des unten stehenden Codes ausprobiert, er funktioniert nicht und ich konnte weder im Skriptindex noch in den Diskussionen etwas finden.
Dank im Voraus,
Prediger
dis = dt << Distribution(
Continuous Distribution( Column( As Column( MetricCols[i] ) ),/*, Fit Distribution( "All" ),*/ Process Capability( 0 ), invisible )
);
dis << Fit All;
dis << Process Capability ("Lognormal");Ich konnte das Problem reproduzieren. Ich habe es auf ein Problem mit der Angabe von „Fit Distribution( „All“)“ im Distribution-Befehl eingegrenzt. Es scheint, dass das Verschieben von „Fit Distribution“ in einen separaten Aufruf die Diskrepanz behebt.
dis = dt << Distribution(
Continuous Distribution( Column( As Column( MetricCols[i] ) )/*, Fit Distribution( "All" ), Process Capability( 0 )*/, invisible )
);
dis << Fit All;
Ich schlage vor, dass Sie dieses Problem an die Support-Gruppe bei JMP weiterleiten.