Fit Spline By Group: Save Spline Coefficients to Column?
Jun 5, 2018 3:19 PM(519 views)
Hi all--having an issue. I am using Fit Y by X to fit 5,000 separate regressions. I hold control, select red drop-down arrow, and Fit->Flexible, Fit->Spline and select, say, 0.1. This fits a spline to all 5,000 graphs with lambda of 0.1. I have 28 X values in each of 5,000 graphs, and I understand there are 4 different spline coefficients (A, B, C, D).
I understand if I just had 1 regression, I could select "Save Coefficients" and a nifty Bx5 matrix, (where B is a subset of my X values) table will pop out with each row as an B value and columns 2-5 as the values of my spline function, for each discrete value of B.
However, when I do this fitting "By Group" with 5,000 regressions, I get 5,000 of these tables as outputs! I would like a way to either:
1) Get 1 table that contains all of the knot spline function values for all values of B (ie for all "By: Groups" (instead of 5000 separate tables)
2) Be able to get Spline value A from spline function as its own column in the original datatable, get Spline value B from spline function as its own column in original datatable, etc. where spline values A, B, C, D pertain to the correct discrete B value and the correct By: Group
I know if I just I hit Ctrl and "Save Predicteds" after Fit Y by X, there will be a column saved to the original datatable with ~5000 formulas (JMP says "Huge formula with 5000 items). It is a conditional formula that looks for the By: Group, then does Spline Eval(X, [28x5]) for each group. Is there a way I can use this script and do find/replace to extract the Spline Coefficient? Maybe there is some unique JSL thing to do? How do I get these darn coefficients???
I also understand there is a Spline Coef(x, y, lambda) thing in JSL but I don't understand jsl syntax at all and am dimwitted in programming, in general.