## Using Simulate [JMP Pro] in a Script

Community Trekker

Joined:

Mar 27, 2015

I would like to use the simulation-feature of JMP Pro to make a power analysis for multiple different scenarios. Is there a way to start the simulation via script, as it would be a lot of work to go through the process manually.

Sebastian

1 ACCEPTED SOLUTION

Accepted Solutions

Staff

Joined:

Jun 23, 2011

Solution

This shows the basic idea (building on one of the examples in the documentation for a permutation test):

``````Names Default To Here( 1 );
dt = Open( "\$SAMPLE_DATA/Analgesics.jmp" );
dt << 	New Column( "pain shuffled",
Numeric,
"Continuous",
Format( "Fixed Dec", 4, 2 ),
Formula( Col Stored Value( :pain, Col Shuffle() ) )
);
ow = dt << Oneway( Y( :pain ), X( :drug ), Means( 1 ), Mean Diamonds( 1 ) );
Report(ow)[TableBox(2)] << simulate(1000, 999, Out(:pain), In(:pain shuffled));``````
3 REPLIES

Staff

Joined:

Jun 23, 2011

Solution

This shows the basic idea (building on one of the examples in the documentation for a permutation test):

``````Names Default To Here( 1 );
dt = Open( "\$SAMPLE_DATA/Analgesics.jmp" );
dt << 	New Column( "pain shuffled",
Numeric,
"Continuous",
Format( "Fixed Dec", 4, 2 ),
Formula( Col Stored Value( :pain, Col Shuffle() ) )
);
ow = dt << Oneway( Y( :pain ), X( :drug ), Means( 1 ), Mean Diamonds( 1 ) );
Report(ow)[TableBox(2)] << simulate(1000, 999, Out(:pain), In(:pain shuffled));``````

Community Trekker

Joined:

Mar 27, 2015

Thanks a lot Ian!

Community Trekker

Joined:

Mar 5, 2017

I'm trying this with the partition platform, but the partition platform REDO script adds in an "Initial Splits" option with the fit from the original run.  The simulations don't re-run the whole fit with all the vriables, but only with the variables that came from the original model.  This affects the results from the simulation - ie they are totally wrong.  Is there some way around that?

Here is the code I'm using:

``````Names Default To Here( 1 );
dt = Open( "\$SAMPLE_DATA/Diabetes.jmp" );
dt << new column("Permuted Y Binary",character, formula(Col Stored Value( :Y Binary, Col Shuffle() )));
dt << run formulas;

Pa = Partition(
Y( :Y Binary ),
X(
:Age,
:Gender,
:BMI,
:BP,
:Total Cholesterol,
:LDL,
:HDL,
:TCH,
:LTG,
:Glucose
),
Informative Missing( 1 ),
ROC Curve( 1 ),
K Fold Crossvalidation( 5 ),
go
);
Pa << finish;
Report( Pa )["Receiver Operating Characteristic"][Table Box(1)] << Simulate(100, Out(:Y Binary), In(:Permuted Y Binary));``````