Relevant post is here,
https://community.jmp.com/t5/Discussions/How-to-group-by-and-get-slopes-in-a-JSL-fit-model-script/m-p/251632#M49404
I have many columns and do not want to include some of them to the analysis. So I need to loop through the column names and pick the ones I need and do bivariate fitting.
So by following the solution on above post
I did
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Fishing.jmp");
colList = dt << get column names( string );
For( i = 1, i <= N Items( colList ), i++,
If( ! Contains( colList[i], "Validation") & ! Contains( colList[i], "People") ,
biv = Bivariate(invisible,
Y( :Fish Caught ),
X( :i),
Fit Line( {Line Color( "Medium Dark Red" )} ),
By( :Validation )
))
dtR2 = report(biv[1])["Summary of Fit"][tablebox(1)]<< make combined data table;
dtR2 = report(biv[1])["Summary of Fit"][tablebox(1)]<< make combined data table;
dtSlope = report(biv[1])["Parameter Estimates"][tablebox(1)]<< make combined data table (invisible);
dtR2 << select where(:Column 1 != "RSquare");
dtR2 << delete rows;
dtR2:Column 2 << set name("RSquare");
dtR2 << delete Columns({"Validation 2","Column 1"});
dtSlope << select where(:Term == "Intercept");
dtSlope << delete rows;
dtSlope:Estimate << set name( "Slope");
dtSlope << delete columns({"Validation 2","Term","~Bias","Std Error","t Ratio","Prob>|t|"});
// Put the data together
dtR2 << Update(
With( dtSlope ),
Match Columns( :Validation = :Validation, :X = :X, :Y = :Y )
);
// Clean up the items not needed
close(dtSlope, nosave);
window("Fishing - Bivariate of Fish Caught") << close window;
);
but it seems that I'm not sure how to implement this correctly.