如何透過兩列的 UniqueVals 組合來選擇和排除?所以我在這裡被難住了。我試圖根據兩列輸出篩選的 dt,其中僅包含具有統計意義的資料:Chart_ID 和 Recipe_ID。我可以讓它在單列上工作,但無法找出兩列。
- 我使用 Oneway (y=mean, x=chamber, BY:Chart_ID, Recipe_ID) 繪製原始資料並運行全對 Tukey tTest。
- 然後取合併的pVal資料表。
- 然後選擇 pVal >0.05 的所有行並排除
- 然後按 Chart_ID 建立 UniqueVals 的總計清單(這是所有具有重要 pVals 的 Chart_ID。)
- 然後選擇來源 dt 中具有匹配的 UniqueVals 的所有行
- 然後反轉選擇並排除
- --> 這使得來源 dt 中僅包含對 Chart_ID 來說 tTest 有意義的資料。
我不知道如何將 Recipe_ID 添加到匯總 UniqueVals 中。
有沒有更好的方法來結束來源 dt,排除所有不重要的圖表/食譜?
//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;資料混合與清理回复:如何通過兩列的 UniqueVals 組合選擇和排除?那行得通!如此簡單的勝利。將連接的值發送到字符串。回复:如何通過兩列的 UniqueVals 組合選擇和排除?如果列中有重複的值,我之前的 Associative Array() 解決方案將無法正常工作(你可以很容易地修復它),所以我使用的是 for-loop 版本。
這會做你想要的嗎?
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));只有 p 值低於 0.05 的組合是試驗 = 2 和爆米花 = 美食。

回复:如何通過兩列的 UniqueVals 組合選擇和排除?@jthi
謝謝你的提示,但我對你的腳本有點困惑。 看起來它只是做了幾次選擇,但沒有做任何事情來循環回到源 dt。
我可以從組合數據表中選擇 pVal 就好了。 我遇到的麻煩是嘗試通過組合數據表中的兩列進行匯總,然後循環回到主要源數據並使用匯總進行選擇。
我找到了一個樣本集,看起來我們可以用來討論這個問題。
我不知道如何使用兩個 BY 列總結回源 dt
由(:試驗,:油量),
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;回复:如何通過兩列的 UniqueVals 組合選擇和排除?您可以將數字列轉換為字符,然後將兩列連接起來以獲取比較字符串列表。 然後使用該列表選擇想要的行(或使用關聯數組)。 沒有示例數據集,所以這裡有一個示例:
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);使用 Scripting Index 更好地了解正在發生的事情(並在需要時進行調試)。
回复:如何通過兩列的 UniqueVals 組合選擇和排除?謝謝你的信息。 我閱讀了 ASA 的聲明,它主要是有道理的。 然而,我的情況(我假設許多其他人)正在處理數千個圖表,我需要一種方法來快速篩选和修剪列表以查看最重要的。 這是一個屏幕截圖作為示例。 我有 5000 張圖表要篩選,需要一種好的方法來識別最重要的圖表以花時間查看。 我得在某處劃清界限。
我也查了 FDR,但我認為這不適用,因為我只使用了一個 X 特徵。 只有一個 X 就不會發生 FDR。

關於選擇和總結:
就是這樣。 我不知道如何獲得匯總然後轉換為讓我選擇源數據。
以前,我選擇單個列 (Chart_ID) 然後轉換回數字,因為 Summarize 輸出字符。 從那裡,我能夠通過 UniqueVals 列表(即 Chart_ID)選擇源 dt Chart_ID Col。
如何使用兩個不同的數字和字符列來實現這一點?
回复:如何通過兩列的 UniqueVals 組合選擇和排除?嗨,alegner1!
也許我不明白,但是您可以嘗試選擇重要的 p 值,對新表進行子集化,然後通過 Chart_ID 和 Recipe_ID 進行匯總?
再說一次,也許我不明白,但你在做什麼有點“黑客攻擊”。至少,我建議您閱讀 ASA 關於 p 值的聲明,然後在 JMP 幫助下的統計索引中查找錯誤發現率。
祝你好運!