如何排列因素做主成分的腳本 大家好,我在腳本說明書中好像找不到關於排列組合的資訊,我需要一點方向,因為也是重複執行,會是使用"FOR"函數嗎?
比如我有6個因子( :pH, :ORP, :EC, :DO, :TN, :TP ),我需要執行3~6個不同組合因子且不排序的主成分,全部結果會有42種。
另外報告中滑鼠右鍵的''save principal components''有辦法使用腳本執行嗎?以下是我嘗試的腳本,顯然是不成功的。
任何建議都表示感謝。
names default to here(1);
dt = Current Data Table();
dto = New Table("Output",
New Column("PCA"),
Add Rows(1),
);
pca = dt << Principal Components(
Y( :pH, :ORP, :EC, :DO, :TN, :TP ),
Estimation Method( "Default" ),
"on Correlations"
);
dto:PCA[i] = (report(pca)["save Principal components"] << get)[1];
pca(report)<<close window;
Scripting回复:如何分散因素做主成分的腳本除了要嘗試捕獲“已保存的主要組件”的代碼外,一切都很好,只有一個例外。
未將“關聯”指定為文字字符串。它只是在不帶引號的情況下指定為
on Correlations
但是,我不理解要捕獲什麼並將其放入正在創建的新數據表中。您似乎正在嘗試將行1的“主要組件”值保存為“主要組件1”。該值僅表示該行在PC 1上的負載。
從您的陳述中,我想知道您要執行的操作是否是獲得一個代表完整主成分1的值。
您能否說明要從42種要運行的組合中提取的內容?
Re: 如何排列因素做主成分的腳本 你好,我需要的內容如附件(PCA)中箭頭位置,他需要使用滑鼠右鍵去選擇並決定要幾個成分後將結果貼在原本使用的數據表中,如附件(Prin)。
謝謝


回复:如何分散因素做主成分的腳本這是一個使用JMP樣本數據表之一的示例。它運行PCA並保存主組件。對於您要保存到數據表Output中的內容,我仍然感到困惑,但是我展示瞭如何保存關於您要保存的內容的兩個猜測。
請運行下面的示例,看看它能做什麼,然後給我一些反饋。一旦能夠了解要保存到數據表Output中的內容,修改腳本以允許您運行42種不同的參數組合就不難了。
names default to here(1);
dt = open("$SAMPLE_DATA\semiconductor capability.jmp");
dto = New Table("Output",
New Column("PCA"),
Add Rows(1),
);
pca = dt << Principal Components(
Y( :NPN1, :PNP1, :PNP2, :NPN2, :PNP3, :IVP1 ),
Estimation Method( "Default" ),
"on Correlations"
);
/*Principal Components(
Y( :pH, :ORP, :EC, :DO, :TN, :TP ),
Estimation Method( "Default" ),
"on Correlations"
);*/
// The Save Principal Components saves the Factor Loadings for each observartion/Row to the original data table
pca << save Principal components(1) ;
// I appologize, but I still do not understand what you are attempting to save to the data table Output
// This code saves the Factor Loading for the first row to the Output table
dto:pca[1] = dt:Prin 1[1];
// This code saves the Eigenvalue for the Prinicipal Component to the data table
dt0:pca[1] = (report(pca)["Summary Plots"][NumberColBox(1)]<<GET></GET>
Re: 如何排列因素做主成分的腳本 你好,非常感謝,不過遇到了點問題,要如何抓到附圖(Eigenvalues)中的"cumulative Percent"數據。
以下是我編輯完的腳本:
Names Default To Here( 1 );
dt = Data Table("PCA TEST");
dto = New Table("Output",
New Column("cumulative Percent"),
New Column("PCA1"),
New Column("PCA2"),
New Column("PCA3"),
New Column("PCA4"),
New Column("PCA5"),
New Column("PCA6"),
Add Rows(9),
);
pca = dt << Principal Components(
Y( :pH, :ORP, :EC, :DO, :TN, :TP ),
Estimation Method( "Default" ),
"on Correlations"
);
pca << save Principal components(6);
For(i=1,i<=9,i++,dto:pca1[i] = dt:Prin1[i]);
For(i=1,i<=9,i++,dto:pca2[i] = dt:Prin2[i]);
For(i=1,i<=9,i++,dto:pca3[i] = dt:Prin3[i]);
For(i=1,i<=9,i++,dto:pca4[i] = dt:Prin4[i]);
For(i=1,i<=9,i++,dto:pca5[i] = dt:Prin5[i]);
For(i=1,i<=9,i++,dto:pca6[i] = dt:Prin6[i]);
/*dto:cumulative Percent[1] = (report(pca)["Eigenvalues"][NumberColBox(5)]<<GET></GET>回复:如何分散因素做主成分的腳本採用
NumberColBox(4)Re: 如何排列因素做主成分的腳本 你好,非常感謝你的幫助,我發現需要在主成分分析中添加一項'' Eigenvalues( 1 )'',才能使數據表抓到[NumberColBox(4)],如下
pca = dt << Principal Components(
Y( :pH, :ORP, :EC, :DO, :TN, :TP ),
Estimation Method( "Default" ),
"on Correlations",
Eigenvalues( 1 )
);
另外想詢問,有辦法將組合寫成腳本嗎?想使用不同組合運行主成分,但不知如何下手。

再次感謝!