Subscribe Bookmark RSS Feed

Script for progressing Analyze < Multivariate < Discriminant < Stepwise variable selection?

ajgarnello

Community Trekker

Joined:

Feb 10, 2015

Hello,

I am going to be collecting data on a large number of DA tests:

I have 100 tests of randomly partitioned training/validation rows to run through a DA, and for each test I am looking to collect the data of: %Classified correctly as I step forward in including variables.

For example: With a specified group of included/excluded rows, I want to run a DA test, stepwise, including 1 variable. I would then record the classification %, then step the model forward one more time, collect the same data, and repeat this procedure until 10 variables have been included in the model.  Then, I would repeat this entire process for another set of included/excluded variables.

I can't seem to find scripting available to progress the Stepwise variable selection, does such script exist?

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

In cases like this 'ShowProperties()' is your friend, since it gives a listing in the log of what messages an object understands.

There may well be more than one way to do this, but the code below should help to get you started. I'm assuming here that you know enough JSL to dig out the required numbers from a report.

NamesDefaultToHere(1);

dt = Open("$SAMPLE_DATA/Cherts.jmp");

doDiscriminant =

Expr(

  da = dt << Discriminant(

  X( :location name ),

  Y( :Al, :Mn, :Na, :Br, :Ce, :Co, :Cr, :Cs, :Eu, :Fe, :Hf, :La, :Sc, :Sm, :U ),

  )

);

for(i=1, i<=3, i++,

  doDiscriminant;

  da << StepwiseVariableSelection;

  for(k=1, k<=i, k++, da << stepForward);

  da << applyThisModel;

  daRep = da << Report;

  // 'Scrape' the deired output from daRep in tha usual way here . . .

  Wait(1);

  daRep << closeWindow;

);

2 REPLIES
Solution

In cases like this 'ShowProperties()' is your friend, since it gives a listing in the log of what messages an object understands.

There may well be more than one way to do this, but the code below should help to get you started. I'm assuming here that you know enough JSL to dig out the required numbers from a report.

NamesDefaultToHere(1);

dt = Open("$SAMPLE_DATA/Cherts.jmp");

doDiscriminant =

Expr(

  da = dt << Discriminant(

  X( :location name ),

  Y( :Al, :Mn, :Na, :Br, :Ce, :Co, :Cr, :Cs, :Eu, :Fe, :Hf, :La, :Sc, :Sm, :U ),

  )

);

for(i=1, i<=3, i++,

  doDiscriminant;

  da << StepwiseVariableSelection;

  for(k=1, k<=i, k++, da << stepForward);

  da << applyThisModel;

  daRep = da << Report;

  // 'Scrape' the deired output from daRep in tha usual way here . . .

  Wait(1);

  daRep << closeWindow;

);

ajgarnello

Community Trekker

Joined:

Feb 10, 2015

Hello Ian,

Thank you for this, it was very helpful! I'm now moving forward with finding the best way to save the desired output (The Score Summary table). Also, It would be supremely helpful to create an iterative naming system for each of these saved files, perhaps using a wildcard command for naming it based off of the iteration #.