How to arrange the factors as the principal component of the script Hello everyone, I can’t seem to find information about permutation and combination in the script manual. I need some direction, because it is repeated execution. Will the "FOR" function be used?
For example, if I have 6 factors (:pH, :ORP, :EC, :DO, :TN, :TP ), I need to execute 3 to 6 principal components with different combinations of factors without sorting, and there will be 42 kinds of results.
In addition, the right mouse button in the report ``save p Is there a way to execute rincipal components using scripts? The following is the script I tried, which was obviously unsuccessful.
Any suggestions are appreciated.
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;
ScriptingRe: 如何排列因素做主成分的腳本Excluding your code where you are trying to capture the "Saved Principal Components" everything looks fine, with one exception.
On Correlations is not specified as a literal string. it is just specified without the quotes as
on Correlations
However, I am not understanding what you want to capture and place into the new data table you are creating. You seem to be attempting to save row 1's Principal Component value for Principal Component 1. That value only represents the loading onto PC 1 for that row.
From your statements, I am wondering if what you are attempting to do, is to get a single value that is representative of the complete Principal Component 1.
Can you please clarify what you are trying to extract from each of your 42 combinations you want to run?
Re: How to arrange the factors as the main component of the script Hello, the content I need is the arrow position in the attachment (PCA). He needs to use the right mouse button to select and decide how many ingredients to paste the result in the original data sheet, such as attachment (Prin).
Thank you


Re: 如何排列因素做主成分的腳本Here is an example using one of the JMP Sample Data tables. It runs the PCA and Saves the Principal Component. I am still confused about what you are trying to save to data table Output, but I showed how to save two guesses as to what you are attempting to save.
Please run the example below, and see what it does, and then give me some feedback. Once I am able to get my understanding of what you are attempting to save to data table Output, modifying the script to allow you to run the 42 different combinations of parameters should not be hard to do.
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: How to arrange the factors as the main component of the script Hello, thank you very much, but I have encountered a problem, how to capture the "cumulative Percent" data in the attached picture (Eigenvalues).
The following is the script I edited:
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>Re: 如何排列因素做主成分的腳本Use
NumberColBox(4)Re: How to arrange the factors as the main component of the script Hello, thank you very much for your help, I found that it is necessary to add an item "Eigenvalues( 1 )" in the principal component analysis to make the data table capture [NumberColBox(4)], as follows
pca = dt << Principal Components(
Y( :pH, :ORP, :EC, :DO, :TN, :TP ),
Estimation Method( "Default" ),
"on Correlations",
Eigenvalues( 1 )
);
I also want to ask, is there a way to write a combination into a script? I want to use different combinations to run the principal components, but I don't know how to start.

Thanks again!