如何通過兩列的 UniqueVals 組合選擇和排除?所以我在這裡難住了。 我正在嘗試根據兩列輸出具有統計意義的篩選數據:Chart_ID 和 Recipe_ID。 我可以讓它在單列中工作,但無法弄清楚兩列。
- 我正在使用 Oneway (y=mean, x=chamber, BY:Chart_ID, Recipe_ID) 繪製原始數據並運行 All-pairs Tukey tTest。
- 然後取組合 pVal 數據表。
- 然後選擇 pVal >0.05 的所有行並排除
- 然後通過 Chart_ID 創建一個 UniqueVals 的匯總列表(這是所有具有重要 pVals 的 Chart_ID。)
- 然後選擇帶有匹配 UniqueVals 的源 dt 中的所有行
- 然後反轉選擇並排除
- --> 這使源 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 組合來選擇和排除?嗨,aliegner1!
也許我不明白,但您可以嘗試選擇重要的 p 值,對新表進行子集化,然後按 Chart_ID 和 Recipe_ID 進行匯總?
再說一次,也許我不明白,但你在做什麼有點“黑客攻擊”。至少,我建議您閱讀 ASA 關於 p 值的聲明,然後在 JMP 幫助下的統計索引中查找錯誤發現率。
祝你好運!
回复:如何通過兩列的 UniqueVals 組合來選擇和排除?謝謝你的信息。 我閱讀了 ASA 聲明,它主要是有道理的。 然而,我的情況(我假設有許多其他人)正在處理成千上萬的圖表,我需要一種方法來快速篩选和修剪列表以查看最重要的。 這是一個屏幕截圖作為示例。 我有 5000 個圖表要篩選,需要一個好的方法來確定最重要的圖表以花時間查看。 我得在某處劃清界限。
我還查找了 FDR,但我認為這不適用,因為我只使用了一個 X 特性。 只有一個 X 不會發生 FDR。

關於選擇和總結:
事情就是這樣。 我不知道如何獲得匯總然後轉換為讓我選擇源數據。
以前,我選擇單列 (Chart_ID) 然後轉換回數字,因為 Summarize 輸出字符。 從那裡,我能夠通過 UniqueVals 列表(即 Chart_ID 的)選擇源 dt Chart_ID Col。
如何使用兩個不同的數字和字符列來實現這一點?
回复:如何通過兩列的 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);使用腳本索引來更好地了解正在發生的事情(並在需要時進行調試)。
回复:如何通過兩列的 UniqueVals 組合來選擇和排除?@jthi
謝謝你的提示,但我對你的腳本有點困惑。 看起來它只是做了幾次選擇,但沒有做任何事情來循環回到源 dt。
我可以從組合數據表中選擇 pVal 就好了。 我遇到的問題是嘗試通過組合數據表中的兩列進行匯總,然後返回到主要源數據並使用匯總進行選擇。
我找到了一個樣本集,看起來我們可以用來討論這個問題。
我不知道如何使用兩個 BY 列匯總回源 dt
By(:trial, :oil amt),
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;