Below is an example script that repeats k-fold crossvalidation on the same stepwise model 10 times. Copied from the JMP Scripting Index, the first part of this script runs a stepwise regression model and then performs a k-fold crossvalidation with 5 folds. The second piece makes the table box containing the step history and best model statistics into a data table for each iteration, and concatenates all the data tables together into one K-Fold Results table. You can of course choose to make a different table box of results into an output table, or none at all.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Fitness.jmp" );
For( i = 1, i <= 10, i++,
obj = dt << Fit Model( Y( :Oxy ), Effects( :Runtime, :Weight, :RunPulse, :RstPulse, :MaxPulse ), Personality( Stepwise ), Run );
obj << Name( "K-Fold Crossvalidation" )(5);
obj << Finish;
kfold = obj << report;
tablebox = kfold[Table Box( 3 )];
output = tablebox << Make Into Data Table( "K-Fold Results" );
If( i != 1,
Data Table( "K-Fold Results" ) << Concatenate( Data Table( "K-Fold Results " || Char( i ) ), Append to first table );
);
);