[Filter: smut] DiedrichSchmidt's post body matched "cum", board "discussions".
Post Subject: Re: How to use JSL to save T² from PCA platform (or how to calculate it)
Post Body:
Hi @Mark_Bailey ,
Thanks for your feedback and including the JSL from the developer of the platform. Well, as it turns out, the solution to what I was after (option 1) is actually possible with JSL!! And so much simpler, too. I just needed to see it in the code that you sent. The critical part is here:
Outlier Analysis( 1, Number of Components( N ), Save T Square ),
By changing "N" in the Number of Components input, and adding the Save T Square, it will actually save the T² formula to the data table for the N components that you define. I didn't know that within the Outlier Analysis() call, you could send it the request to "Save T Square". Doing that along with the N components does exactly what I was hoping to do, thanks for the help! No need to put in a Wish List or anything, JMP can already do it for you!
I'm attaching the Iris_mod.jmp data table with scripts to that calculate the T² value for 2, 3, and 4 PCs. It is good to know how to efficiently calculate the T² value should I ever need to. The code I was just writing now to do the calculation was rather long and cumbersome, although I believe it would have worked once I got everything straightened out. However, I prefer the above solution -- it's only a few extra characters of code!
Upon closer inspection of the code you sent, I have noticed that the T² calculated from the PCA platform and the "manual" calculation in the code are different for the same number of PCs. Any clue as to why? Either the "manual" calculation is "wrong" or performed differently than how the PCA does it, or something else is going on. I'm also attaching another data table Iris_mod_different_T2.jmp that shows the T² results for the same number of PCs is different from the PCA platform and the "manual" calculation. Until further notice, I prefer to use the T² formula from the PCA platform. I would like to know if there something different about the "manual" calculation and why the values are not the same.
Thanks again!,
DS
P.S. If anyone is interested, the code I've been working on is below. It is an interactive code that allows the user to select the columns to perform the PCA on and then dynamically select the number of PCs to use for extracting out the DModX and T² formulas. You can even save the selected number of PCs to the data table if you want for other analyses.
A big thanks to @jthi for help with some other aspects of this code in order to get things to work as intended, like <
Names Default To Here( 1 );
//Clear Symbols();
//Function to choose the data table to model
choose_data_table = Function( {},
list = {};
For( i = 1, i <= N Table(), i++,
list[i] = Data Table( i ) << get name
);
win = New Window( "Select a data table",
<<MODAL></MODAL> PCRptOutlier << Save DModX( N_PCs );
If( savePCs == 1,
PCRptOutlier << Save Principal Components( N_PCs )
);
PCRptOutlier<<CLOSEWINDOW> 0, Try( choose_data_table, Throw( "No data found" ) )
);
ModMetrics;
);
Firstwin;</CLOSEWINDOW>
Body text "Cum" matched filter pattern "cum".
Post by User[id=12549,login=DiedrichSchmidt] was rejected for the following end-user facing error(s):
- Your post has been changed because invalid HTML was found in the message body. The invalid HTML has been removed. Please review the message and submit the message when you are satisfied.