¿Cómo seleccionar y excluir mediante una combinación UniqueVals de dos columnas?Entonces estoy perplejo aquí. Estoy intentando generar un dt filtrado solo de datos que sean estadísticamente significativos, basado en dos columnas: Chart_ID y Recipe_ID. Puedo hacer que funcione con una sola columna pero no puedo encontrar dos columnas.
- Estoy trazando los datos sin procesar usando Oneway (y=media, x=cámara, BY:Chart_ID, Recipe_ID) y ejecutando la prueba tTest de Tukey de todos los pares.
- Luego, tomando la tabla de datos pVal combinada.
- luego seleccionando todas las filas donde pVal >0.05 y excluyendo
- luego, cree una lista resumida de UniqueVals por Chart_ID (estos son todos los Chart_ID con pVals significativos).
- luego seleccionando todas las filas en la fuente dt con UniqueVals coincidentes
- luego invirtiendo la selección y excluyendo
- --> esto deja la fuente dt con solo datos que son tTest significativos según Chart_ID.
No puedo entender cómo agregar Recipe_ID al resumen UniqueVals.
¿Existe una mejor manera de terminar con una fuente de datos que haya excluido todos los gráficos/recetas que no son significativos?
//dtSPC --> my source data, raw SPC data. Need to exclude rows from Charts, Recipes with high pVals
/*plotting a basic Fit YbyX just to get pValues. Formatting and style done on final plot*/
ow1 = Oneway(
Y( :MEAN ),
X( :CHAMBER ),
By(:CHART_ID, :RECIPE),
//All pairs Tukey HSD test
All Pairs(
1,
Confidence Quantile( 0 ),
Difference Matrix( 0 ),
LSD Threshold Matrix( 0 ),
Connecting Letters Report( 0 ),
Ordered Differences Report( 1 )
),
);
/***********************************/
/***********************************/
// Create the combined data table, using xPath (return a list of the OutlineBoxes from the report that have the title Ordered Differences Report. Then, use the first of those to make the combined data table.)
outlines = (Report( ow1[1] ) << Top Parent) << XPath( "//OutlineBox[text()='Ordered Differences Report']" );
dt1 = outlines[1][Table Box( 1 )] << Make Combined Data Table;
dt1 = current data table();
dt1 << set name( "pValue PairWise by Channel Tukey");
dt1:CHART_ID << Data type( Numeric ) << Set Modeling Type( Nominal );
/***********************************/
/**********************************/
//Screen and show only the CHART_ID's w/ a Tukey pair pVal<0.05
//exclude all high pVal rows, leaving only low pVal Channels. Does not work in reverse.
dt1 << select where(:name("p-Value") > 0.05);
dt1 << exclude;
dt1 << clear select;
//create a list of remaining Unique CHART_ID's
summarize(dt1, uniqueVals=by(:CHART_ID));
//Convert to numeric
For( i = 1, i <= N Items(uniqueVals ), i++,
uniqueVals[i] = Num(uniqueVals[i] )
);
//extra, just to look at the data
//dtUnique = New Table( "uniqueVals less 0.05");
//dtUnique << New Column( "CHART_ID", Values(uniqueVals));
//select on SPC source data just the channels w/ low pVals
//need to choose SPC data table
dtSPC << clear select;
dtSPC << select where( contains( uniqueVals, :CHART_ID));
//invert and exclude, leaving only low pVal CHART_ID's
dtSPC << invert row selection << exclude;
dtSPC << clear select;Combinación y limpieza de datosRe: ¿Cómo seleccionar y excluir por combo UniqueVals de dos columnas?¡eso funciono! una victoria tan simple. enviar un valor concatenado a una cadena.Re: ¿Cómo seleccionar y excluir por combo UniqueVals de dos columnas?Mi solución anterior de matriz asociativa () no funcionará correctamente si hay valores duplicados en las columnas (podría arreglarse fácilmente), así que estoy usando la versión for-loop.
¿Hace esto lo que quieres?
Names Default To Here(1);
dtPopCorn = Open( "$SAMPLE_DATA/Popcorn.jmp" );
/*plotting a basic Fit YbyX just to get pValues. Formatting and style done on final plot*/
ow1 = Oneway(
Y( :yield ),
X( :batch),
By(:trial, :popcorn),
//All pairs Tukey HSD test
All Pairs(
1,
Confidence Quantile( 0 ),
Difference Matrix( 0 ),
LSD Threshold Matrix( 0 ),
Connecting Letters Report( 0 ),
Ordered Differences Report( 1 )
),
);
/***********************************/
/***********************************/
// Create the combined data table, using xPath (return a list of the OutlineBoxes from the report that have the title Ordered Differences Report. Then, use the first of those to make the combined data table.)
outlines = (Report( ow1[1] ) << Top Parent) << XPath( "//OutlineBox[text()='Ordered Differences Report']" );
dt1 = outlines[1][Table Box( 1 )] << Make Combined Data Table;
dt1 << set name( "pValue PairWise by Channel Tukey");
/***********************************/
/**********************************/
pVals = Loc(dt1:"p-Value"n << get as matrix <= 0.05);
comparisonStrings = {};
For(i = 1, i <= N Items(pVals), i++,
Insert Into(comparisonStrings, char(dt1:trial[pVals[i]]) || dt1:popcorn[pVals[i]]);
);
show(comparisonStrings);
dtPopCorn << clear select;
dtPopCorn << select where(contains(comparisonStrings, char(:trial)||:popcorn));La única combinación con un valor de p por debajo de 0,05 es prueba = 2 y palomitas de maíz = gourmet.

Re: ¿Cómo seleccionar y excluir por combo UniqueVals de dos columnas?@jthi
Gracias por los consejos, pero estoy un poco confundido acerca de su secuencia de comandos. Parece que solo selecciona varias veces, pero no hace nada para volver a un dt de origen.
Puedo seleccionar los pVal de la tabla de datos combinados muy bien. El problema que tengo es tratar de resumir en dos columnas en la Tabla de datos combinados, luego regresar a la fuente principal de datos y seleccionar usando el resumen.
Encontré un conjunto de muestra que parece que podemos usar para hablar sobre este problema.
No puedo averiguar cómo resumir de nuevo a la fuente dt usando las dos columnas BY
Por (: prueba, : cantidad de aceite),
dtPopCorn = Open( "$SAMPLE_DATA/Popcorn.jmp" );
/*plotting a basic Fit YbyX just to get pValues. Formatting and style done on final plot*/
ow1 = Oneway(
Y( :yield ),
X( :popcorn ),
By(:trial, :oil amt),
//All pairs Tukey HSD test
All Pairs(
1,
Confidence Quantile( 0 ),
Difference Matrix( 0 ),
LSD Threshold Matrix( 0 ),
Connecting Letters Report( 0 ),
Ordered Differences Report( 1 )
),
);
/***********************************/
/***********************************/
// Create the combined data table, using xPath (return a list of the OutlineBoxes from the report that have the title Ordered Differences Report. Then, use the first of those to make the combined data table.)
outlines = (Report( ow1[1] ) << Top Parent) << XPath( "//OutlineBox[text()='Ordered Differences Report']" );
dt1 = outlines[1][Table Box( 1 )] << Make Combined Data Table;
dt1 = current data table();
dt1 << set name( "pValue PairWise by Channel Tukey");
dt1:trial << Data type( Numeric ) << Set Modeling Type( Nominal );
/***********************************/
/**********************************/
//Screen and show only the trial's w/ a Tukey pair pVal<0.05
//exclude all high pVal rows, leaving only low pVal Channels. Does not work in reverse.
dt1 << select where(:name("p-Value") > 0.5); //I know...just setting 0.5 so that one row stands out.
dt1 << exclude;
dt1 << clear select;
//create a list of remaining Unique trial's
summarize(dt1, uniqueVals=by(:trial));
//Convert to numeric
For( i = 1, i <= N Items(uniqueVals ), i++,
uniqueVals[i] = Num(uniqueVals[i] )
);
//extra, just to look at the data
//dtUnique = New Table( "uniqueVals less 0.5");
//dtUnique << New Column( "trial", Values(uniqueVals));
//select on SPC source data just the channels w/ low pVals
//need to choose SPC data table
dtPopCorn << clear select;
dtPopCorn << select where( contains( uniqueVals, :trial));
//invert and exclude, leaving only low pVal trial's
dtPopCorn << invert row selection << exclude;
dtPopCorn << clear select;Re: ¿Cómo seleccionar y excluir por combo UniqueVals de dos columnas?Puede convertir la columna numérica en carácter y luego combinar las dos columnas para obtener una lista de cadenas de comparación. Luego use esa lista para seleccionar las filas deseadas (o use matrices asociativas). No tengo un conjunto de datos de ejemplo, así que aquí hay una especie de ejemplo:
Names Default To Here(1);
dt = New Table("Untitled 22",
Add Rows(5),
Compress File When Saved(1),
New Column("CHART_ID",
Character,
"Nominal",
Set Values({"123", "1", "12", "0", "135"})
),
New Column("RECIPE",
Character,
"Nominal",
Set Values({"A", "A", "B", "B", "C"})
),
New Column("pval",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([0.1, 0.001, 0.051, 0.002, 0.1])
)
);
pVals = Loc(dt:pval << get as matrix > 0.05); //get rows over 0.05
comparisonStrings = {};
For(i = 1, i <= N Items(pVals), i++,
Insert Into(comparisonStrings, char(dt:CHART_ID[pVals[i]]) || dt:RECIPE[pVals[i]]);
);
wait(1);
dt << Select Where(Contains(comparisonStrings, char(:CHART_ID)||:RECIPE));
wait(1);
dt << clear select;
wait(1);
aa = Associative Array(Eval List(dt:CHART_ID[pVals]), EvalList(dt:RECIPE[pVals]));
dt << Select Where(Contains(aa, :CHART_ID) & aa[:CHART_ID] == :RECIPE);Use Scripting Index para obtener una mejor comprensión de lo que está sucediendo (y para la depuración si es necesario).
Re: ¿Cómo seleccionar y excluir por combo UniqueVals de dos columnas?Gracias por la información. Leí la declaración de ASA y tiene sentido en su mayoría. Sin embargo, mi situación (y supongo que muchas otras personas) están lidiando con miles de gráficos y necesito una forma de filtrar y recortar rápidamente la lista para ver los más importantes. Aquí hay una captura de pantalla como ejemplo. Tengo 5000 gráficos para revisar y necesito un buen método para identificar los más importantes para pasar el tiempo mirando. Tengo que trazar la línea en alguna parte.
También busqué FDR, pero no creo que esto se aplique, ya que solo estoy usando una única característica X. No sucede ningún FDR con una sola X.

En cuanto a seleccionar y resumir:
Esa es la cosa. No puedo entender cómo obtener el resumen para luego traducirlo y permitirme seleccionar los datos de origen.
Anteriormente, estaba seleccionando una sola columna (Chart_ID) y luego volvía a convertir a numérico porque Resumir genera caracteres. A partir de ahí, pude seleccionar la fuente dt Chart_ID Col por la lista de UniqueVals (que era Chart_ID).
¿Cómo hacer que esto suceda con dos columnas diferentes que son numéricas y de carácter?
Re: ¿Cómo seleccionar y excluir por combo UniqueVals de dos columnas?¡Hola, aliegner1!
Tal vez no lo entiendo, pero podría intentar seleccionar valores p significativos, subdividir una nueva tabla y luego resumir por Chart_ID y Recipe_ID.
De nuevo, tal vez no entiendo, pero lo que estás haciendo huele a " hackear ".Como mínimo, le recomiendo que lea la Declaración de ASA sobre los valores p y luego busque la Tasa de descubrimiento falso en el Índice de estadísticas en la Ayuda de JMP.
¡Buena suerte!