Formula Depot
Example 1
Summary: Executes a nominal logistic model and publishes probability formulas, saving the report to a temporary file.
Code:
Names Default To Here( 1 );
fd1 = Formula Depot();
dt = Open("data_table.jmp");
model = dt << RunScript( "Nominal Logistic" );
model << Publish Probability Formulas;
Report( fd1 ) << Save Window Report( "$TEMP/nodt_fdepot.jrp", embed data( 0 ) );
Report( fd1 ) << Close Window;
Open( "$TEMP/nodt_fdepot.jrp" );
Code Explanation:
- Set default names.
- Create formula depot.
- Open data table;
- Run nominal logistic model.
- Publish probability formulas.
- Save report window.
- Close report window.
- Open saved report.
Example 2
Summary: Executes a Lasso Poisson script and publishes the prediction formula for further analysis.
Code:
dt = Open("data_table.jmp");
fd = Formula Depot();
obj1 = dt << Run Script( "Lasso Poisson, Validation Column" );
md1 = obj1 << (Fit[1] << Publish Prediction Formula);
Code Explanation:
- Open table.
- Create Formula Depot.
- Run Lasso Poisson script.
- Publish prediction formula.
Formula Depot using RunScript
Example 1
Summary: Executes a Nominal Logistic script and generates a report for model comparison, utilizing Formula Depot to save and publish probability formulas.
Code:
dt = Open("data_table.jmp");
obj = dt << RunScript( "Nominal Logistic" );
fd = Formula Depot();
obj << Save Probability Formula;
fd << Add Formula From Column( Table( dt ), Columns( "Most Likely Species" ) );
obj << Publish Probability Formulas;
fd << Model Comparison( Table( dt ), Formulas( 1, 2 ) );
rfd = fd << report;
fd << close window;
Code Explanation:
- Open data table;
- Run Nominal Logistic script.
- Create Formula Depot object.
- Save probability formula.
- Add formula from column.
- Publish probability formulas.
- Compare models.
- Generate report.
- Close Formula Depot window.
Example 2
Summary: Executes a Nominal Logistic script, generates reports from Formula Depot, and creates a new table with a single column.
Code:
dt = Open("data_table.jmp");
obj = dt << RunScript( "Nominal Logistic" );
fd = Formula Depot();
obj << Publish Probability Formulas;
obj << Publish Probability Formulas;
rfd = fd << report;
fd << close window;
Close( dt, nosave );
dt = New Table( "test",
Add Rows( 0 ),
New Column( "test", Numeric, "Continuous", Format( "Best", 12 ), Formula( Names Default To Here( 1 ) ), Set Selected )
);
fd = Formula Depot();
fd << Add Formula From Column( Table( dt ), Columns( "test" ) );
rfd = fd << report;
fd << close window;
Code Explanation:
- Open data table;
- Run Nominal Logistic script.
- Create Formula Depot.
- Publish probability formulas twice.
- Generate report.
- Close Formula Depot window.
- Close dataset without saving.
- Create new empty table.
- Add "test" column.
- Create another Formula Depot.
Example 3
Summary: Executes a Nominal Logistic script and publishes probability formulas, generating a report in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << RunScript( "Nominal Logistic" );
fd = Formula Depot();
obj << Publish Probability Formulas;
obj << Publish Probability Formulas;
rfd = fd << report;
fd << close window;
Code Explanation:
- Open data table;
- Run Nominal Logistic script.
- Create Formula Depot.
- Publish probability formulas.
- Publish probability formulas.
- Generate report.
- Close Formula Depot window.
Formula Depot using Run Scripts
Example 1
Summary: Executes scripts, profiling, and model comparison in a formula depot, while also opening and closing data tables and the formula depot window.
Code:
dt = Open("data_table.jmp");
fd = formula depot();
fd << Run Scripts();
fd << Profiler();
fd << Model Comparison();
fd << Run Scripts( dt );
fd << Profiler( dt );
fd << Model Comparison( dt );
Close( dt, nosave );
fd << close window;
Code Explanation:
- Open data table.
- Create formula depot.
- Run scripts in depot.
- Open profiler in depot.
- Compare models in depot.
- Run scripts on data table.
- Open data table.
- Compare models on data table.
- Close data table without saving.
- Close formula depot window.
Example 2
Summary: Executes scripts, profiling, and model comparison in a formula depot with a data table.
Code:
dt = Open("data_table.jmp");
fd = formula depot();
fd << Run Scripts();
fd << Profiler();
fd << Model Comparison();
fd << Run Scripts( dt );
fd << Profiler( dt );
fd << Model Comparison( dt );
Code Explanation:
- Open data table.
- Create formula depot object.
- Run scripts in depot.
- Launch profiler.
- Launch model comparison.
- Run scripts with data table.
- Launch profiler with data table.
- Launch model comparison with data table.
Formula Depot using If
Example 1
Summary: Process of performing Principal Component Analysis (PCA) and DModX calculations on a dataset, publishing formulas for selected components, and comparing original and published values.
Code:
If( JMP Product Name() == "Pro",
fd = formula depot();
dt = Open("data_table.jmp");
obj = Principal Components(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Estimation Method( "Wide" )
);
mo = obj << Publish Components Formulas( 3 );
obj << Save Principal Components( 3 );
mo << Run Script;
For( i = 1, i <= 3, i++,
objCol = Column( "Prin" || Char( i ) );
fdCol = Column( "Prin" || Char( i ) || "_1" );
objVals = objCol << get values;
fdVals = fdCol << get values;
);
obj << close window;
obj = Principal Components(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Prin1, :Prin2, :Prin3 ),
Estimation Method( "Sparse" ),
Number of Components( 2 ),
"on Correlations"
);
mo = obj << Publish Components Formulas( 2 );
obj << Save Principal Components( 2 );
mo << Run Script;
For( i = 1, i <= 2, i++,
objCol = Column( "Prin" || Char( i ) || " 2" );
fdCol = Column( "Prin" || Char( i ) || "_2_1" );
objVals = objCol << get values;
fdVals = fdCol << get values;
);
obj << close window;
fd << close window;
Close( dt, nosave );
fd = formula depot();
dt = Open("data_table.jmp");
obj = Principal Components(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Estimation Method( "Wide" )
);
mo = obj << Publish dModX Formula( 2 );
obj << Save dModX( 2 );
mo << Run Script;
objCol = Column( "DModX" );
fdCol = Column( "DModX_1" );
objVals = objCol << get values;
fdVals = fdCol << get values;
obj << close window;
fd << close window;
Close( dt, nosave );
);
Code Explanation:
- Check if JMP is Pro.
- Open Formula Depot.
- Load data_table.jmp data.
- Perform PCA on selected columns.
- Publish 3 component formulas.
- Save 3 principal components.
- Run published script.
- Loop through first 3 principal components.
- Compare original and published values.
- Close PCA window.
- Repeat PCA with sparse method.
- Publish 2 component formulas.
- Save 2 principal components.
- Run published script.
- Loop through first 2 principal components.
- Compare original and published values.
- Close PCA window.
- Close Formula Depot.
- Close data table without saving.
- Reopen Formula Depot.
- Reopen data_table data.
- Perform PCA on selected columns.
- Publish DModX formula for 2 components.
- Save DModX for 2 components.
- Run published script.
- Compare DModX original and published values.
- Close PCA window.
- Close Formula Depot.
- Close data table without saving.
Example 2
Summary: Executes a Lasso Poisson model and generates a report in Formula Depot, while also profiling and updating the report.
Code:
If( JMP Product Name() == "Pro",
dt = Open( “$SAMPLE_DATA\data_table.jmp” );
fd = Formula Depot();
obj1 = dt << Run Script( “Lasso Poisson, Validation Column” );
model = obj1 << (Fit[1] << Publish Prediction Formula);
rfd = fd << report;
wnd1 = Window( “data_table - Formula Depot” );
fd << Profiler;
rfd = fd << report;
wnd2 = Window( “data_table - Formula Depot” );
Close( dt, NoSave );
fd << close window( 1 );
);
Code Explanation:
- Check if JMP is Pro.
- Open data table;
- Initialize Formula Depot.
- Run "Lasso Poisson" script.
- Publish prediction formula.
- Get Formula Depot report.
- Create "data_table - Formula Depot" window.
- Open profiler in Formula Depot.
- Update Formula Depot report.
- Close "data_table" dataset.
- Close Formula Depot window.