I was forgetting about the fact that there is additional PLS functionality in JMP Pro that is not in the regular version. For JMP it will be similar, but a little simpler:
NamesDefaultToHere(1);
// Get some data
dt = Open( "$SAMPLE_DATA/Baltic.jmp" );
// Do a PLS fit in JMP (also works in JMP Pro)
pls = dt << Partial Least Squares(
Y( :ls, :ha, :dt ),
X(
:v1,
:v2,
:v3,
:v4,
:v5,
:v6,
:v7,
:v8,
:v9,
:v10,
:v11,
:v12,
:v13,
:v14,
:v15,
:v16,
:v17,
:v18,
:v19,
:v20,
:v21,
:v22,
:v23,
:v24,
:v25,
:v26,
:v27
),
Validation Method( Name( "Leave-One-Out" ), Initial Number of Factors( 15 ) ),
Fit(
Method( NIPALS ),
Number of Factors( 7 ),
Show Confidence Band( 1 ),
Distance Plots( 1 ),
Scatter Scores Plots( 1 ),
Diagnostics Plots( 1 ),
Overlay Loadings Plots( 1 ),
T Square Plot( 1 ),
Overlay Coefficients Plots( 1 )
)
);
// See what messages the PLS platform understands (look in the Log Window)
ClearLog();
ShowProperties(pls);
// Save some results from the (7 factor) fit
pls << (Fit[1] << savePredictionFormula);
pls << (Fit[1] << saveYresiduals);
To understand why the code works, I would start with 'Help > Books > Scripting Guide' to learn the rudiments of JSL.