Fit Model
Example 1
Summary: Opens a data table, fits a model to predict pain levels based on gender and drug interactions, and generates plots for actual vs predicted values, residuals, and effect leverage.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :pain ),
Effects(
:gender, :drug, :gender * :drug
),
Personality(
"Standard Least Squares"
),
Run(
:pain <<
{Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open table.
- Fit model.
- Specify response variable.
- Add effects.
- Set personality.
- Run analysis.
- Plot actual vs predicted.
- Plot residual vs predicted.
- Plot effect leverage.
Example 2
Summary: Opens a data table and fits a repeated measures model to analyze the relationship between species, subject, season, and miles traveled.
Code:
// Repeated Measures Model
// Open data table
dt = Open("data_table.jmp");
// Repeated Measures Model
Fit Model(
Y( :miles ),
Effects(
:species,
:subject[:species] & Random,
:season, :species * :season
),
Personality(
"Standard Least Squares"
),
Run
);
Code Explanation:
- Open data table.
- Fit Model dialog initiated.
- Set response variable: miles.
- Add species effect.
- Add subject[:species] random effect.
- Add season effect.
- Add species*season interaction.
- Set personality to Standard Least Squares.
- Run the model.
Example 3
Summary: Fits a Nominal Logistic model to predict the 'Claim(Y/N)' response variable, considering AgeClass, City(Y/N), and Rating Class as effects, with interactive profiling capabilities.
Code:
// Fit Model (Claim Y/N)
// Open data table
dt = Open("data_table.jmp");
// Fit Model (Claim Y/N)
Fit Model(
Y( :"Claim(Y/N)"n ),
Effects(
:AgeClass, :"City(Y/N)"n,
:Rating Class
),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
AgeClass( "Elder" ),
"City(Y/N)"n( "N" ),
Rating Class( "A" )
)
)
)
);
Code Explanation:
- Open table.
- Fit Model.
- Set response variable.
- Add effects.
- Use Nominal Logistic personality.
- Run model.
- Enable Likelihood Ratio Tests.
- Disable Wald Tests.
- Enable Profiler.
- Set term values.
Example 4
Summary: Opens a data table, fits a model for Claim USD using Standard Least Squares personality and Minimal Report emphasis, and generates a profiler with confidence intervals.
Code:
// Fit Model (Claim USD)
// Open data table
dt = Open("data_table.jmp");
// Fit Model (Claim USD)
Fit Model(
Y( :Claim USD ),
Effects(
:AgeClass, :"City(Y/N)"n,
:Rating Class
),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
AgeClass( "Elder" ),
"City(Y/N)"n( "N" ),
Rating Class( "A" )
)
),
:Claim USD <<
{Plot Actual by Predicted( 0 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )},
SendToReport(
Dispatch(
{"Response Claim USD",
"Prediction Profiler"},
"10000", ScaleBox,
{
Format(
"Currency",
"USD",
15,
0
), Max( 8000 ),
Inc( 1000 )}
)
)
)
);
Code Explanation:
- Open data table.
- Fit model for Claim USD.
- Specify response variable.
- Add effects: AgeClass, City(Y/N), Rating Class.
- Set personality to Standard Least Squares.
- Set emphasis to Minimal Report.
- Run profiler with confidence intervals.
- Set term values: Elder, N, A.
- Disable plot options.
- Format prediction profiler scale.
Example 5
Summary: Opens a data table, fits a model report with frequency and response variables, specifies effects, chooses personality, sets emphasis, and runs the model to generate a customized report.
Code:
// Fit Model Report
// Open data table
dt = Open("data_table.jmp");
// Fit Model Report
Fit Model(
Freq( :Relative Sizes ),
Y( :Group Means ),
Effects( :Group ),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
:Group Means << {{:Group << {}}}
)
);
Code Explanation:
- Open data table.
- Fit Model Report.
- Set frequency variable.
- Define response variable.
- Specify effects.
- Choose personality.
- Set emphasis.
- Run model.
- Customize report.
Example 6
Summary: Performs a power analysis and plot for a group effect in a linear model, utilizing the Fit Model platform to analyze the relationship between Group Means and Relative Sizes.
Code:
// Power Analysis and Plot
// Open data table
dt = Open("data_table.jmp");
// Power Analysis and Plot
Fit Model(
Freq( :Relative Sizes ),
Y( :Group Means ),
Effects( :Group ),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
:Group Means << {Lack of Fit( 0 ),
Plot Actual by Predicted( 0 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 ),
{:Group <<
{Power Analysis(
Alpha( 0.05 ),
Sigma( 5, 6, 1 ),
Delta( 3.46410161513775 ),
Number( 16, 64, 4 ),
Solve for Power,
Power Plot,
Done
)}}}
),
SendToReport(
Dispatch(
{"Response Group Means"},
"Summary of Fit", OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response Group Means"},
"Analysis of Variance",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response Group Means"},
"Effect Tests", OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response Group Means",
"Effect Details", "Group"},
"Least Squares Means Table",
OutlineBox,
{Close( 1 )}
)
)
);
Code Explanation:
- Open data table.
- Initiate Fit Model process.
- Set frequency to Relative Sizes.
- Define Y variable as Group Means.
- Include Group effect.
- Choose Standard Least Squares personality.
- Minimal report emphasis.
- Configure model options.
- Disable various plot outputs.
- Perform power analysis for Group.
Example 7
Summary: Fits a model to predict the response variable Y, considering the effects of HBars, Dynamo, Seat, Tires, Gear, Raincoat, and Brkfast. The script also generates profiler plots with normal and Pareto plots.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Y ),
Effects(
:HBars, :Dynamo, :Seat, :Tires,
:Gear, :Raincoat, :Brkfast
),
Personality(
"Standard Least Squares"
),
Run(
Profiler( 1 ),
Y << {Normal Plot( 1 ),
Pareto Plot( 1 )}
)
);
Code Explanation:
- Open table.
- Define response variable.
- Define effect variables.
- Choose model personality.
- Run model.
- Generate profiler.
- Enable normal plot.
- Enable Pareto plot.
Example 8
Summary: Opens a data table, fits weight to an age vector and height using standard least squares, and generates a minimal report with customized plots disabled.
Code:
// Fit weight to age vector and height
// Open data table
dt = Open("data_table.jmp");
// Fit weight to age vector and height
Fit Model(
Y( :weight ),
Effects( :age vector, :height ),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
:weight << {Lack of Fit( 0 ),
Plot Actual by Predicted( 0 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
)
);
Code Explanation:
- Open data table.
- Fit weight to age vector.
- Include height as effect.
- Use standard least squares.
- Generate minimal report.
- Disable lack of fit test.
- Disable actual vs predicted plot.
- Disable regression plot.
- Disable residual vs predicted plot.
- Disable effect leverage plot.
Example 9
Summary: Opens a data table, fits a model to predict weight based on age, sex, and height, and generates plots for actual vs predicted, residual vs predicted, and effect leverage.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality(
"Standard Least Squares"
),
Run(
:weight <<
{Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open data table.
- Define model response.
- Specify model effects.
- Choose model personality.
- Run model fit.
- Plot actual vs predicted.
- Plot residual vs predicted.
- Plot effect leverage.
Example 10
Summary: Opens a data table, fits a MANOVA model to specified response variables, and runs the analysis with the 'Manova' personality.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y(
:BP 8M, :BP 12M, :BP 6M, :BP 8W,
:BP 12W, :BP 6W, :BP 8F, :BP 12F,
:BP 6F
),
Effects( :Subject, :Dose ),
Personality( "Manova" ),
Run
);
Code Explanation:
- Open table.
- Define response variables.
- Specify effects.
- Choose MANOVA personality.
- Run model.
Example 11
Summary: Opens a data table, fits a stepwise model with 2nd-order interactions to predict percent body fat from various anthropometric measurements, and generates a profiler with confidence intervals.
Code:
// Fit Model: Stepwise, 2nd order interactions
// Open data table
dt = Open("data_table.jmp");
// Fit Model: Stepwise, 2nd order interactions
Fit Model(
Y( :Percent body fat ),
Effects(
:"Weight (lbs)"n,
:"Abdomen circumference (cm)"n,
:"Thigh circumference (cm)"n *
:"Wrist circumference (cm)"n,
:"Wrist circumference (cm)"n,
:"Thigh circumference (cm)"n
),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Reorder X Variables(
:"Weight (lbs)"n,
:
"Abdomen circumference (cm)"n,
:
"Thigh circumference (cm)"n,
:
"Wrist circumference (cm)"n
),
Term Value(
" Weight (lbs)"n(
183,
Lock( 0 ),
Show( 1 )
),
" Abdomen 2 circumference (cm)"n(
93.662,
Lock( 0 ),
Show( 1 )
),
" Thigh circumference (cm)"n(
57.15,
Lock( 0 ),
Show( 1 )
),
" Wrist circumference (cm)"n(
15,
Min( 15 ),
Lock( 0 ),
Show( 1 )
)
)
),
:Percent body fat <<
{Lack of Fit( 0 ),
Plot Actual by Predicted( 0 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
),
SendToReport(
Dispatch(
{"Response Percent body fat",
"Prediction Profiler"}, "4",
ScaleBox,
{Min( 15 ), Max( 22 ),
Inc( 1 ), Minor Ticks( 0 ),
Inside Ticks( 1 ),
Rotated Labels( "Vertical" )}
)
)
);
Code Explanation:
- Open table.
- Define response variable.
- Specify effects for modeling.
- Choose model personality.
- Set report emphasis.
- Run model fit.
- Generate profiler.
- Configure confidence intervals.
- Reorder X variables.
- Set term values and constraints.
Example 12
Summary: Opens a data table, fits a model using PCA variable reduction, and generates a report with a profiler and term values for selected variables.
Code:
// Fit Model: From PCA variable reduction
// Open data table
dt = Open("data_table.jmp");
// Fit Model: From PCA variable reduction
Fit Model(
Y( :Percent body fat ),
Effects(
:"Hip circumference (cm)"n,
:"Neck circumference (cm)"n,
:"Wrist circumference (cm)"n
),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
" Hip circumference (cm)"n(
99.06,
Lock( 0 ),
Show( 1 )
),
" Neck circumference (cm)"n(
38.1,
Lock( 0 ),
Show( 1 )
),
" Wrist circumference (cm)"n(
18,
Min( 15 ),
Lock( 0 ),
Show( 1 )
)
)
),
:Percent body fat <<
{Lack of Fit( 0 ),
Plot Actual by Predicted( 0 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
),
SendToReport(
Dispatch(
{"Response Percent body fat",
"Prediction Profiler"}, "3",
ScaleBox,
{Min( 15 ), Max( 22 ),
Inc( 1 ), Minor Ticks( 0 ),
Inside Ticks( 1 ),
Rotated Labels( "Vertical" )}
)
)
);
Code Explanation:
- Open data table.
- Fit Model: From PCA variable reduction.
- Set response variable.
- Add effects variables.
- Use Standard Least Squares personality.
- Emphasize Minimal Report.
- Run Profiler with confidence intervals.
- Set term values for variables.
- Hide Lack of Fit plot.
- Adjust Prediction Profiler scale.
Example 13
Summary: Fits a model to the data table, defining dependent and independent variables, specifying interaction effects, choosing a modeling personality, and applying a Box Cox transformation.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :y ),
Effects(
:load, :flow, :load * :flow,
:speed, :load * :speed,
:flow * :speed, :mud,
:load * :mud, :flow * :mud,
:speed * :mud
),
Personality(
"Standard Least Squares"
),
Run( Box Cox Y Transformation( 1 ) )
);
Code Explanation:
- Open data table.
- Define dependent variable.
- Define independent variables.
- Specify interaction effects.
- Choose modeling personality.
- Apply Box Cox transformation.
Example 14
Summary: Fits an ordinal logistic model to a data table, specifying the response variable and effect variable, while utilizing the 'Ordinal Logistic' personality.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Freq( :Count ),
Y( :Response ),
Effects( :Cheese ),
Personality( "Ordinal Logistic" ),
Run
);
Code Explanation:
- Open table.
- Set frequency column.
- Define response variable.
- Add effect variable.
- Choose ordinal logistic personality.
- Run model.
Example 15
Summary: Fits a model to the data table, specifying response and effect variables, and runs the fit with profiler and desirability functions for multiple components.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y(
:MN ckt wx, :MN ckt yz,
:SD ckt wx, :SD ckt yz
),
Effects(
:Thickness, :PEB, :PUDDLE, :time,
:focus
),
Personality(
"Standard Least Squares"
),
Run(
Profiler(
Confidence Intervals( 1 ),
Desirability Functions( 1 )
),
:MN ckt wx <<
{Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )},
:MN ckt yz <<
{Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )},
:SD ckt wx <<
{Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )},
:SD ckt yz <<
{Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )}
)
);
Code Explanation:
- Open table.
- Define response variables.
- Define effect variables.
- Choose model personality.
- Run fit model.
- Enable profiler.
- Set confidence intervals.
- Enable desirability functions.
- Display scaled estimates for MN ckt wx.
- Plot actual vs predicted for MN ckt wx.
- Display scaled estimates for MN ckt yz.
- Plot actual vs predicted for MN ckt yz.
- Display scaled estimates for SD ckt wx.
- Plot actual vs predicted for SD ckt wx.
- Display scaled estimates for SD ckt yz.
- Plot actual vs predicted for SD ckt yz.
Example 16
Summary: Opens a data table, fits a MANOVA model with specified response variables and an effect, and runs the analysis.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y(
:April AM, :April PM, :May AM,
:May PM, :June AM, :June PM
),
Effects( :treatment ),
Personality( "Manova" ),
Run
);
Code Explanation:
- Open table.
- Fit Model.
- Specify response variables.
- Add effect.
- Set personality to MANOVA.
- Execute model.
Example 17
Summary: Opens a data table and fits a model to predict 'Coal particles' based on the effects of 'pH', 'Polymer', and their interaction, using Standard Least Squares personality.
Code:
// Model Specification
// Open data table
dt = Open("data_table.jmp");
// Model Specification
Fit Model(
Y( :Coal particles ),
Effects(
:pH, :Polymer, :pH * :Polymer
),
Personality(
"Standard Least Squares"
)
);
Code Explanation:
- Open table.
- Fit model.
- Specify response variable.
- Add effects.
- Set personality.
Example 18
Summary: Opens a data table, fits an ANCOVA model with pH, Polymer, and their interaction as effects, and configures various plots for visualization.
Code:
// Fit ANCOVA Model
// Open data table
dt = Open("data_table.jmp");
// Fit ANCOVA Model
Fit Model(
Y( :Coal particles ),
Effects(
:pH, :Polymer, :pH * :Polymer
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run(
:Coal particles <<
{Lack of Fit( 0 ),
Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open table.
- Fit ANCOVA model.
- Set response variable.
- Add effects: pH, Polymer, interaction.
- Choose personality: Standard Least Squares.
- Set emphasis: Effect Leverage.
- Configure lack of fit test.
- Enable actual vs predicted plot.
- Enable residual vs predicted plot.
- Enable effect leverage plot.
Example 19
Summary: Opens a data table, fits a model to predict heart rate based on drink type and time, and generates various plots and reports for analysis.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Heart Rate ),
Effects(
:Drink, :"Time (Numeric)"n,
:Drink * :"Time (Numeric)"n,
:Testers
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Drink( "Coca-Cola" ),
"Time (Numeric)"n(
21.44
),
Testers( "Tester 1" )
)
),
:Heart Rate << {Lack of Fit( 0 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )},
SendToReport(
Dispatch(
{"Response Heart Rate",
"Prediction Profiler"},
"Profiler", FrameBox,
Frame Size( 217, 151 )
),
Dispatch(
{"Response Heart Rate",
"Prediction Profiler"},
"Profiler", FrameBox( 3 ),
Frame Size( 217, 151 )
),
Dispatch(
{"Response Heart Rate",
"Prediction Profiler"},
"Profiler", FrameBox( 5 ),
Frame Size( 217, 151 )
)
)
)
);
Code Explanation:
- Open data table.
- Define response variable.
- Specify model effects.
- Choose personality.
- Set emphasis.
- Run profiler.
- Configure profiler settings.
- Customize plot options.
- Adjust report frame sizes.
- Display results.
Example 20
Summary: Opens a data table and fits a MANOVA model using the Fit Model command, specifying response variables, an effect variable, and setting the personality to Manova.
Code:
// Manova
// Open data table
dt = Open("data_table.jmp");
// Manova
Fit Model(
Y( :S1, :S3 ),
Effects( :CROP ),
Personality( "Manova" ),
Run
);
Code Explanation:
- Open data table.
- Fit Model command initiated.
- Specify response variables.
- Define effect variable.
- Set personality to Manova.
- Execute model fitting.
Example 21
Summary: Opens a data table and fits a nominal logistic regression model to predict the response variable CROP based on predictor variables S1 and S3, using the Nominal Logistic personality.
Code:
// Nominal Logistic Regression
// Open data table
dt = Open("data_table.jmp");
// Nominal Logistic Regression
Fit Model(
Y( :CROP ),
Effects( :S1, :S3 ),
Personality( "Nominal Logistic" ),
Run
);
Code Explanation:
- Open table.
- Fit Nominal Logistic Regression.
- Set response variable.
- Add predictor variables.
- Specify model personality.
- Execute the analysis.
Example 22
Summary: Opens a data table, fits a model with specified effects and interactions, sets the response variable, and uses standard least squares personality.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:X1, :X2, :X3, :X1 * :X2,
:X1 * :X3, :X2 * :X3
),
Y( :Y ),
PERSONALITY( Standard Least Squares )
);
Code Explanation:
- Open data table.
- Fit model with effects.
- Include X1, X2, X3.
- Include interactions X1X2, X1X3, X2*X3.
- Set response variable Y.
- Use standard least squares personality.
Example 23
Summary: Opens a data table, fits a model with effects, and includes random effects to analyze the relationship between variables.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Whole Plots & Random,
:Subplots & Random, :A1, :A2, :A3,
:A4, :C1, :C2, :A1 * :A2,
:A1 * :A3, :A1 * :A4, :A1 * :C1,
:A1 * :C2, :A2 * :A3, :A2 * :A4,
:A2 * :C1, :A2 * :C2, :A3 * :A4,
:A3 * :C1, :A3 * :C2, :A4 * :C1,
:A4 * :C2, :C1 * :C2
),
Y( :OCV )
);
Code Explanation:
- Open data table.
- Fit model with effects.
- Include random effects.
- Add main effects.
- Include interaction terms.
- Set response variable.
- Execute model fitting.
Example 24
Summary: Opens a data table, fits a reduced model with specified effects, and keeps the dialog open for further analysis.
Code:
// Reduced Model 1
// Open data table
dt = Open("data_table.jmp");
// Reduced Model 1
Fit Model(
Y( :OCV ),
Effects(
:Whole Plots & Random,
:Subplots & Random, :A1, :A2, :A3,
:A4, :C1, :C2, :A1 * C1, :A1 * C2,
:A2 * C1, :A4 * C2
),
Keep dialog open( 1 ),
Personality(
"Standard Least Squares"
),
Method( "REML" )
);
Code Explanation:
- Open data table.
- Define response variable.
- Specify effects.
- Keep dialog open.
- Set personality.
- Choose method.
Example 25
Summary: Opens a data table, fits a Reduced Model 2 with specified effects and personality, and keeps the dialog open for further analysis.
Code:
// Reduced Model 2
// Open data table
dt = Open("data_table.jmp");
// Reduced Model 2
Fit Model(
Y( :OCV ),
Effects(
:Whole Plots & Random,
:Subplots & Random, :A1, :A2, :A4,
:C1, :C2, :A1 * C1, :A1 * C2,
:A2 * C1, :A4 * C2
),
Keep dialog open( 1 ),
Personality(
"Standard Least Squares"
),
Method( "REML" )
);
Code Explanation:
- Open data table.
- Fit model.
- Specify response variable.
- Define effects.
- Keep dialog open.
- Choose personality.
- Select method.
- End fit model command.
Example 26
Summary: Opens a data table and fits a linear model using the specified effects, with the response variable being :Y.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:X1, :X2, :X3, :X4, :X5, :X6
),
Y( :Y )
);
Code Explanation:
- Open data table.
- Define model effects.
- Specify response variable.
- Fit linear model.
Example 27
Summary: Fits a model to the specified data table, defining response and effect variables, setting personality and emphasis, and generating a profiler with confidence intervals.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :log y ),
Effects(
:log10 Rw, :log10 R, :Tu, :Tl,
:Hu, :Hl, :L, :Kw, :Hu * :Hu,
:L * :L, :Hl * :Hl, :Kw * :Kw,
:Hl * :Hu
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
log10 Rw(
-1.06,
Max( -0.82 )
),
log10 R( 3.35 ),
Tu( 89335 ),
Tl( 89.55, Min( 63.1 ) ),
Hu( 1050 ),
Hl( 760 ),
L( 1400 ),
Kw( 10950 )
)
),
:Y << {Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )}
)
);
Code Explanation:
- Open data table.
- Define response variable.
- Define effects.
- Set model personality.
- Set emphasis.
- Run fit model.
- Generate profiler.
- Enable confidence intervals.
- Set term values.
- Configure predictions plot.
Example 28
Summary: Opens a data table, fits a model using least squares regression with specified effects, and generates a profiler with confidence intervals.
Code:
// Fit Model (Least Squares)
// Open data table
dt = Open("data_table.jmp");
// Fit Model (Least Squares)
Fit Model(
Y( :log y ),
Effects(
:log10 Rw, :log10 R, :Tu, :Tl,
:Hu, :Hl, :L, :Kw, :Hu * :Hu,
:L * :L, :Hl * :Hl, :Kw * :Kw,
:Hl * :Hu
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
log10 Rw(
-1.06,
Max( -0.82 )
),
log10 R( 3.35 ),
Tu( 89335 ),
Tl( 89.55, Min( 63.1 ) ),
Hu( 1050 ),
Hl( 760 ),
L( 1400 ),
Kw( 10950 )
)
),
:Y << {Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )}
)
);
Code Explanation:
- Open data table.
- Fit model using least squares.
- Specify response variable.
- Define effects for model.
- Set personality to standard least squares.
- Emphasize effect screening.
- Run the model.
- Create profiler.
- Include confidence intervals.
- Set term values for profiler.
Example 29
Summary: Opens a data table, defines a model with multiple effects, specifies the response variable, sets the model personality to Standard Least Squares, and fits the model.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Silica & RS, :Sulfur & RS,
:Silane & RS, :Silica * :Sulfur,
:Silica * :Silane,
:Sulfur * :Silane,
:Silica * :Silica,
:Sulfur * :Sulfur,
:Silane * :Silane
),
Y( :Stretch ),
PERSONALITY(
"Standard Least Squares"
)
);
Code Explanation:
- Open table.
- Define model effects.
- Specify response variable.
- Set model personality.
- Fit model.
Example 30
Summary: Opens a data table, defines a model with whole plots and random effects, and fits the model to predict corrosion resistance based on furnace temperature and coating.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Whole Plots & Random,
:Furnace Temp, :Coating,
:Furnace Temp * :Coating
),
Y( :Corrosion Resistance )
);
Code Explanation:
- Open table.
- Define model effects.
- Specify response variable.
- Fit model.
Example 31
Summary: Opens a data table and fits a model with multiple effects to analyze the relationships between Interfer, Wall, Depth, and Adhesive variables.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Interfer, :Wall, :Depth,
:Adhesive
),
Y( :Mean Y ),
Y( :SN Ratio Y )
);
Code Explanation:
- Open data table.
- Fit Model script initiated.
- Define effects: Interfer, Wall, Depth, Adhesive.
- Set response variable: Mean Y.
- Add response variable: SN Ratio Y.
- Model execution begins.
- Analyze data using defined effects.
- Generate model results for Mean Y.
- Generate model results for SN Ratio Y.
- Display analysis reports.
Example 32
Summary: Opens a data table and fits a model with multiple effects, excluding the intercept.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Cocoa & RS & Mixture,
:Sugar & RS & Mixture,
:Flour & RS & Mixture,
:Butter & RS & Mixture,
:Milk & RS & Mixture
),
Y( :Taste ),
No Intercept( 1 )
);
Code Explanation:
- Open table.
- Fit a model.
- Specify effects.
- Include Cocoa & RS & Mixture.
- Include Sugar & RS & Mixture.
- Include Flour & RS & Mixture.
- Include Butter & RS & Mixture.
- Include Milk & RS & Mixture.
- Set response variable.
- Exclude intercept.
Example 33
Summary: Opens a data table, defines a model with whole plots and random effects, includes continuous effects, specifies interaction terms, sets the response variable, and fits the model using standard least squares.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Whole Plots & Random,
:Subplots & Random, :Temperature,
:Time, :Catalyst,
:Temperature * :Time,
:Temperature * :Catalyst,
:Time * :Catalyst
),
Y( :Y )
);
Code Explanation:
- Open data table.
- Define model effects.
- Include random effects.
- Add continuous effects.
- Specify interaction terms.
- Set response variable.
- Fit the model.
Example 34
Summary: Opens a data table, fits a model for Y Simulated using REML method with Standard Least Squares personality, and specifies effects including interactions and random effects.
Code:
// Model for Y Simulated
// Open data table
dt = Open("data_table.jmp");
// Model for Y Simulated
Fit Model(
Y( :Y Simulated ),
Effects(
:Temperature, :Time, :Catalyst,
:Temperature * :Time,
:Temperature * :Catalyst,
:Time * :Catalyst
),
Random Effects(
:Whole Plots, :Subplots
),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Method( "REML" )
);
Code Explanation:
- Open table.
- Fit model for Y Simulated.
- Specify response variable.
- Define effects: Temperature, Time, Catalyst.
- Include interaction effects.
- Define random effects: Whole Plots, Subplots.
- Choose personality: Standard Least Squares.
- Set emphasis: Minimal Report.
- Select method: REML.
- Execute fit model.
Example 35
Summary: Opens a data table and fits a model to predict the Strength variable based on various effects, including Grind, Temperature, Time, Charge, and Station.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Grind, :Temperature, :Time,
:Charge, :Station
),
Y( :Strength )
);
Code Explanation:
- Open table.
- Fit model.
- Specify effects.
- Include Grind.
- Include Temperature.
- Include Time.
- Include Charge.
- Include Station.
- Set response variable.
- Y is Strength.
Example 36
Summary: Fits a reduced model with 'Strength' as response, including 'Time', 'Charge', and 'Station' as effects, using Standard Least Squares personality and Effect Screening emphasis.
Code:
// Reduced Model
// Open data table
dt = Open("data_table.jmp");
// Reduced Model
Fit Model(
Y( :Strength ),
Effects( :Time, :Charge, :Station ),
Keep dialog open( 1 ),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" )
);
Code Explanation:
- Open data table.
- Assign table to variable
dt. - Fit model with
Strengthas response. - Include
Time,Charge,Stationas effects. - Keep dialog open.
- Use "Standard Least Squares" personality.
- Set emphasis to "Effect Screening".
Example 37
Summary: Opens a data table, defines a response variable, and fits a standard least squares model with multiple effects using the Fit Model platform in JMP.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Y( :Y ),
Effects(
:X1 & RS, :X2 & RS, :X3 & RS,
:X1 * :X1, :X1 * :X2, :X2 * :X2,
:X1 * :X3, :X2 * :X3, :X3 * :X3
),
Personality(
"Standard Least Squares"
)
);
Code Explanation:
- Open data table.
- Define response variable.
- Define effects for model.
- Specify model personality.
- Fit standard least squares model.
Example 38
Summary: Opens a data table, defines a linear model with multiple effects, specifies the response variable, sets the model personality to Standard Least Squares, and fits the model.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Operator, :Speed, :Current,
:Operator * :Speed,
:Operator * :Current,
:Speed * :Current
),
Y( :Depth ),
PERSONALITY(
"Standard Least Squares"
)
);
Code Explanation:
- Open data table.
- Define model effects.
- Specify response variable.
- Set model personality.
- Fit the model.
Example 39
Summary: Opens a data table, defines effects for a mixed-effects model, specifies the response variable, and fits the model without an intercept.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:CuSO4 & RS & Mixture,
:Na2S2O3 & RS & Mixture,
:Glyoxal & RS & Mixture,
:CuSO4 * :Na2S2O3,
:CuSO4 * :Glyoxal,
:CuSO4 * :Wavelength,
:Na2S2O3 * :Glyoxal,
:Na2S2O3 * :Wavelength,
:Glyoxal * :Wavelength
),
Y( :Damping ),
No Intercept( 1 )
);
Code Explanation:
- Open table.
- Define effects.
- Specify response variable.
- Fit model without intercept.
Example 40
Summary: Opens a data table, fits a stepwise model for regression analysis, and includes main effects and interaction terms to analyze the relationship between Yield and various predictor variables.
Code:
// Model for Stepwise
// Open data table
dt = Open("data_table.jmp");
// Model for Stepwise
Fit Model(
Y( :Yield ),
Effects(
:Methanol & RS, :Ethanol & RS,
:Propanol & RS, :Butanol & RS,
:pH & RS, :Time & RS,
:Methanol * :Methanol,
:Methanol * :Ethanol,
:Ethanol * :Ethanol,
:Methanol * :Propanol,
:Ethanol * :Propanol,
:Propanol * :Propanol,
:Methanol * :Butanol,
:Ethanol * :Butanol,
:Propanol * :Butanol,
:Butanol * :Butanol,
:Methanol * :pH, :Ethanol * :pH,
:Propanol * :pH, :Butanol * :pH,
:pH * :pH, :Methanol * :Time,
:Ethanol * :Time,
:Propanol * :Time,
:Butanol * :Time, :pH * :Time,
:Time * :Time
),
Personality( "Stepwise" )
);
Code Explanation:
- Open data table.
- Fit model for stepwise analysis.
- Set response variable: Yield.
- Include main effects: Methanol & RS, Ethanol & RS, Propanol & RS, Butanol & RS, pH & RS, Time & RS.
- Include interaction effects between methanol, ethanol, propanol, butanol, pH, and time.
- Set personality to stepwise.
- Perform stepwise regression analysis.
Example 41
Summary: Opens a data table, defines effects for a model, specifies the response variable, and fits the model with the specified effects.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Dichloromethane & RS,
:Methanol & RS,
:Sample Volume & RS,
:Dichloromethane *
:Dichloromethane,
:Dichloromethane * :Methanol,
:Methanol * :Methanol,
:Dichloromethane * :Sample Volume,
:Methanol * :Sample Volume,
:Sample Volume * :Sample Volume
),
Y( :Metacrate )
);
Code Explanation:
- Open data table.
- Define effects for model.
- Specify response variable.
- Fit model with specified effects.
Example 42
Summary: Opens a data table, fits a model with specified effects, and excludes the intercept using Standard Least Squares personality.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:X1 & Mixture, :X2 & Mixture,
:X3 & Mixture, :X1 * :X2,
:X1 * :X3, :X2 * :X3
),
Y( :Y ),
No Intercept,
PERSONALITY(
"Standard Least Squares"
)
);
Code Explanation:
- Open table.
- Fit model.
- Define effects.
- Specify response.
- Exclude intercept.
- Choose personality.
Example 43
Summary: Opens a data table, defines a standard least squares model with specified effects, sets the response variable, and fits the model.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Feed Rate, :Catalyst, :Stir Rate,
:Temperature, :Concentration
),
Y( :Percent Reacted ),
PERSONALITY(
"Standard Least Squares"
)
);
Code Explanation:
- Open data table.
- Define model effects.
- Set response variable.
- Specify model personality.
- Fit standard least squares model.
Example 44
Summary: Opens a data table, defines effects for multiple response variables, and fits a model using the specified effects.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Brand, :Time, :Power,
:Brand * :Time, :Brand * :Power,
:Time * :Power, :Time * :Time,
:Power * :Power
),
Y( :Number Popped ),
Y( :Total Kernels )
);
Code Explanation:
- Open table.
- Define effects.
- Specify response variables.
- Fit model.
Example 45
Summary: Opens a data table, defines a model with multiple effects, and fits the model to predict the response variable 'Percent Reacted'.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Feed Rate, :Catalyst, :Stir Rate,
:Temperature, :Concentration,
:Feed Rate * :Catalyst,
:Feed Rate * :Stir Rate,
:Feed Rate * :Temperature,
:Feed Rate * :Concentration,
:Catalyst * :Stir Rate,
:Catalyst * :Temperature,
:Catalyst * :Concentration,
:Stir Rate * :Temperature,
:Stir Rate * :Concentration,
:Temperature * :Concentration
),
Y( :Percent Reacted )
);
Code Explanation:
- Open data table.
- Define effects for model.
- Specify response variable.
- Fit the model.
Example 46
Summary: Opens a data table, defines a reduced model with multiple effects, and executes the fit using Standard Least Squares personality.
Code:
// Reduced Model
// Open data table
dt = Open("data_table.jmp");
// Reduced Model
Fit Model(
Y( :Percent Reacted ),
Effects(
:Catalyst, :Temperature,
:Concentration,
:Catalyst * :Temperature,
:Temperature * :Concentration
),
Personality(
"Standard Least Squares"
)
);
Code Explanation:
- Open table.
- Define model.
- Set response variable.
- Specify effects.
- Choose personality.
- Execute fit.
Example 47
Summary: Opens a data table and fits a linear regressor model with multiple effects to predict the response variable, using standard least squares personality.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Feed Rate, :Catalyst, :Stir Rate,
:Temperature, :Concentration,
:Feed Rate * :Catalyst,
:Feed Rate * :Stir Rate,
:Catalyst * :Stir Rate,
:Feed Rate * :Temperature,
:Catalyst * :Temperature,
:Stir Rate * :Temperature,
:Feed Rate * :Concentration,
:Catalyst * :Concentration,
:Stir Rate * :Concentration,
:Temperature * :Concentration
),
Y( :Percent Reacted ),
PERSONALITY(
"Standard Least Squares"
)
);
Code Explanation:
- Open table.
- Fit a linear regressor.
- Include multiple effects.
- Specify response variable.
- Use standard least squares personality.
Example 48
Summary: Opens a data table, fits a reduced model with main effects and interaction terms using standard least squares, and keeps the dialog open.
Code:
// Reduced Model
// Open data table
dt = Open("data_table.jmp");
// Reduced Model
Fit Model(
Y( :Percent Reacted ),
Effects(
:Catalyst, :Temperature,
:Concentration,
:Catalyst * :Temperature,
:Temperature * :Concentration
),
Keep dialog open( 1 ),
Personality(
"Standard Least Squares"
)
);
Code Explanation:
- Open data table.
- Fit model.
- Specify response variable.
- Add main effects.
- Add interaction terms.
- Keep dialog open.
- Use standard least squares.
Example 49
Summary: Opens a data table, defines effects for a model, specifies the response variable, chooses the modeling personality, and fits the model using Standard Least Squares.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Feed Rate, :Catalyst, :Stir Rate,
:Temperature, :Concentration,
:Feed Rate * :Catalyst,
:Feed Rate * :Stir Rate
),
Y( :Percent Reacted ),
PERSONALITY(
"Standard Least Squares"
)
);
Code Explanation:
- Open data table.
- Define effects for model.
- Specify response variable.
- Choose modeling personality.
- Fit the model.
Example 50
Summary: Opens a data table, fits a model with multiple effects and interaction terms, sets the response variable, and excludes the intercept term.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Whole Plots & Random,
:m1 & RS & Mixture,
:m2 & RS & Mixture,
:m3 & RS & Mixture,
:extrusion rate * :temperature,
:extrusion rate * :m1,
:extrusion rate * :m2,
:extrusion rate * :m3,
:temperature * :m1,
:temperature * :m2,
:temperature * :m3, :m1 * :m2,
:m1 * :m3, :m2 * :m3
),
Y( :thickness ),
No Intercept( 1 )
);
Code Explanation:
- Open table.
- Fit model.
- Specify effects.
- Include interaction terms.
- Set response variable.
- Exclude intercept term.
Example 51
Summary: Opens a data table and fits a model with multiple effects, including Rater, Variety, Field, De-Stem, Yeast, Temperature, Press, Barrel Age, Barrel Seasoning, and Filtering, using the Rating as the response variable.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Rater, :Variety, :Field,
:"De-Stem"n, :Yeast, :Temperature,
:Press, :Barrel Age,
:Barrel Seasoning, :Filtering
),
Y( :Rating )
);
Code Explanation:
- Open data table.
- Fit model with effects.
- Include Rater effect.
- Include Variety effect.
- Include Field effect.
- Include De-Stem effect.
- Include Yeast effect.
- Include Temperature effect.
- Include Press effect.
- Include Barrel Age effect.
- Include Barrel Seasoning effect.
- Include Filtering effect.
- Set Rating as response variable.
Example 52
Summary: Opens a data table and fits a model with specified variables, including Rater, Variety, De-Stem, Yeast, Press, Barrel Seasoning, and Filtering effects.
Code:
// Reduced Model
// Open data table
dt = Open("data_table.jmp");
// Reduced Model
Fit Model(
Y( :Rating ),
Effects(
:Rater, :Variety, :"De-Stem"n,
:Yeast, :Press, :Barrel Seasoning,
:Filtering
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" )
);
Code Explanation:
- Open data table.
- Fit model with specified variables.
- Set response variable to Rating.
- Include Rater effect.
- Include Variety effect.
- Include De-Stem effect.
- Include Yeast effect.
- Include Press effect.
- Include Barrel Seasoning effect.
- Include Filtering effect.
Example 53
Summary: Performs a nominal logistic regression analysis on the provided data table, incorporating main effects and interaction terms to predict the response variable.
Code:
// Nominal Logistic Regression
// Open data table
dt = Open("data_table.jmp");
// Nominal Logistic Regression
Fit Model(
Freq( :count ),
Y( :brand ),
Effects(
:softness, :previous use,
:softness * :previous use,
:temperature,
:softness * :temperature,
:previous use * :temperature,
:softness * :previous use *
:temperature
),
Personality( "Nominal Logistic" ),
Run
);
Code Explanation:
- Open table.
- Set frequency column.
- Define response variable.
- Add main effects.
- Add interaction effects.
- Set model personality.
- Run the model.
Example 54
Summary: Fits an ordinal logistic model to a data table, incorporating multiple predictors and running likelihood ratio tests.
Code:
// Logistic for Y Ordinal
// Open data table
dt = Open("data_table.jmp");
// Logistic for Y Ordinal
Fit Model(
Y( :Y Ordinal ),
Effects(
:Age, :Gender, :BMI, :BP,
:Total Cholesterol, :LDL, :HDL,
:TCH, :LTG, :Glucose
),
Personality( "Ordinal Logistic" ),
Run( Likelihood Ratio Tests( 1 ) )
);
Code Explanation:
- Open data table.
- Fit ordinal logistic model.
- Set response variable.
- Include multiple predictors.
- Choose ordinal logistic personality.
- Run likelihood ratio tests.
Example 55
Summary: Fits a linear model to open data, defining response and effect variables, selecting personality, and emphasizing effect screening in JMP.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Y( :Price ),
Effects(
:Carat Weight, :Color, :Clarity,
:Depth, :Table, :Cut, :Report
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" )
);
Code Explanation:
- Open table.
- Fit a linear model.
- Set response variable.
- Define effects.
- Choose personality.
- Set emphasis.
Example 56
Summary: Opens a data table, fits a model to predict Price using various effects, and runs a profiler with confidence intervals, desirability functions, and response limits.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Price ),
Effects(
:Carat Weight, :Color, :Clarity,
:Depth, :Table, :Cut, :Report
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
Price <<
Response Limits(
{Lower( 2000, 0.01 ),
Middle( 3000, 1 ),
Upper( 4000, 0.01 ),
Goal( Match Target ),
Importance( 1 )}
),
Term Value(
Carat Size(
0.631909406669322
),
Color( "E" ),
Clarity( "VS2" ),
Depth( 58.015177401438 ),
Table( 62.4632071198035 ),
Cut( "Ideal" ),
Report( "GIA" )
)
),
:Price << {Sorted Estimates( 0 ),
Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
)
);
Code Explanation:
- Open data table.
- Fit model on Price.
- Include Carat Weight, Color, Clarity.
- Include Depth, Table, Cut, Report.
- Use Standard Least Squares personality.
- Emphasize effect screening.
- Run profiler with confidence intervals.
- Set desirability functions.
- Define response limits for Price.
- Set term values for predictors.
Example 57
Summary: Opens a data table and fits a model with specified effects, including interactions between Polymer A, Polymer B, Total Polymer, and Compression Force, while setting the response variable to Dissolution 60 and excluding the intercept.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Polymer A & Mixture,
:Polymer B & Mixture,
:Polymer A * :Total Polymer,
:Polymer A * :Compression Force,
:Polymer B * :Total Polymer,
:Polymer B * :Compression Force,
:Total Polymer *
:Compression Force
),
Y( :Dissolution 60 ),
No Intercept( 1 )
);
Code Explanation:
- Open data table.
- Fit model with specified effects.
- Include Polymer A & Mixture.
- Include Polymer B & Mixture.
- Include interaction: Polymer A * Total Polymer.
- Include interaction: Polymer A * Compression Force.
- Include interaction: Polymer B * Total Polymer.
- Include interaction: Polymer B * Compression Force.
- Include interaction: Total Polymer * Compression Force.
- Set response variable: Dissolution 60.
- Exclude intercept from model.
Example 58
Summary: Performs a multivariate analysis of variance (MANOVA) model to analyze the relationship between log-histogram variables and categorical predictors, utilizing the Manova personality in JMP.
Code:
// Manova
// Open data table
dt = Open("data_table.jmp");
// Manova
Fit Model(
Y(
:LogHist0, :LogHist1, :LogHist3,
:LogHist5
),
Effects(
:drug, :dep1, :drug * :dep1
),
Personality( "Manova" ),
Run(
Response Function( "Contrast" ),
Response Function( "Sum" )
)
);
Code Explanation:
- Open table.
- Fit model with Manova personality.
- Specify response variables.
- Include main effects.
- Include interaction effect.
- Run contrast response function.
- Run sum response function.
Example 59
Summary: Opens a data table, fits a model with measurement as the response variable and drug type as an effect, using standard least squares personality and emphasizing effect leverage. It also enables plot residual by predicted.
Code:
// Fit Model Equivalence Tests
// Open data table
dt = Open("data_table.jmp");
// Fit Model Equivalence Tests
Fit Model(
Y( :Measurement ),
Effects( :Drug Type ),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run(
:Measurement <<
{Summary of Fit( 0 ),
Analysis of Variance( 0 ),
Parameter Estimates( 0 ),
Lack of Fit( 0 ),
Scaled Estimates( 0 ),
Plot Actual by Predicted( 0 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 1 ),
Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 0 ),
Plot Residual by Normal Quantiles(
0
), Box Cox Y Transformation( 0 ),
Effect Tests( 0 ),
Multiple Comparisons(
Effect( :Drug Type ),
Student's t(
1,
All Pairwise Comparisons Scatterplot(
0
),
Equivalence Tests( 3 )
)
)}
)
);
Code Explanation:
- Open data table.
- Fit model with measurement.
- Use drug type as effect.
- Choose standard least squares personality.
- Set emphasis on effect leverage.
- Disable summary of fit.
- Disable analysis of variance.
- Disable parameter estimates.
- Disable lack of fit.
- Enable plot residual by predicted.
Example 60
Summary: Fits a model with separate slopes using the Fit Model function in JMP, specifying the response variable y and effects for Drug, x, and their interaction.
Code:
// Fit Model-separate slopes
// Open data table
dt = Open("data_table.jmp");
// Fit Model-separate slopes
Fit Model(
Y( :y ),
Effects( :Drug, :x, :Drug * :x ),
Personality(
"Standard Least Squares"
),
Run
);
Code Explanation:
- Open data table.
- Define variable
dt. - Specify file path.
- Call
Fit Modelfunction. - Set response variable
y. - Define effects:
Drug,x, interactionDrug * x. - Set personality to "Standard Least Squares".
- Execute model fit.
Example 61
Summary: Fits a model to data, specifying the response variable and effects, choosing a personality, and running the analysis.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :y ),
Effects( :Drug, :x ),
Personality(
"Standard Least Squares"
),
Run
);
Code Explanation:
- Open table.
- Fit Model.
- Specify response variable.
- Add effects.
- Choose personality.
- Run model.
Example 62
Summary: Opens a data table, fits a model for Annual Salary Z with effects of Gender, Length Of Service, and Performance, and generates a minimal report with parameter estimates.
Code:
// Fit Model - Annual Salary Z
// Open data table
dt = Open("data_table.jmp");
// Fit Model - Annual Salary Z
Fit Model(
Y( :Annual Salary Z ),
Effects(
:Gender, :Length Of Service,
:Performance
),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
:Annual Salary Z <<
{Summary of Fit( 1 ),
Analysis of Variance( 1 ),
Parameter Estimates( 1 ),
Scaled Estimates( 0 ),
Plot Actual by Predicted( 0 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 0 ),
Plot Residual by Normal Quantiles(
0
), Box Cox Y Transformation( 0 )}
),
SendToReport(
Dispatch(
{"Response Annual Salary Z"},
"Effect Tests", OutlineBox,
{Close( 0 )}
)
)
);
Code Explanation:
- Open table.
- Fit model for Annual Salary Z.
- Set response variable.
- Add effects: Gender, Length Of Service, Performance.
- Choose Standard Least Squares personality.
- Set Minimal Report emphasis.
- Configure report options.
- Disable summary of fit.
- Disable analysis of variance.
- Enable parameter estimates.
Example 63
Summary: Fits a MANOVA model to analyze the relationships between weight, waist, and pulse on chin-ups, sit-ups, and jumps.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :chins, :situps, :jumps ),
Effects( :weight, :waist, :pulse ),
Personality( "Manova" ),
Run
);
Code Explanation:
- Open table.
- Fit model.
- Specify response variables.
- Specify effect variables.
- Set personality to MANOVA.
- Run model.
Example 64
Summary: Opens a data table and fits a quadratic model to analyze the relationships between Reaction Time, Reaction Temperature, and Yield.
Code:
// Model quadratic
// Open data table
dt = Open("data_table.jmp");
// Model quadratic
Fit Model(
Effects(
:Reaction Time & RS,
:Reaction Temperature & RS,
:Reaction Time * :Reaction Time,
:Reaction Time *
:Reaction Temperature,
:Reaction Temperature *
:Reaction Temperature,
:Reaction Time * :Reaction Time
* :Reaction Time,
:Reaction Time * :Reaction Time
* :Reaction Temperature,
:Reaction Time * (
Reaction Temperature *
:Reaction Temperature),
:Reaction Temperature *
:Reaction Temperature *
:Reaction Temperature
),
Y( :Yield )
);
Code Explanation:
- Open data table.
- Fit quadratic model.
- Specify effects: Reaction Time & RS.
- Specify effects: Reaction Temperature & RS.
- Specify effects: Reaction Time squared.
- Specify effects: Reaction Time * Temperature.
- Specify effects: Temperature squared.
- Specify effects: Reaction Time cubed.
- Specify effects: Reaction Time squared * Temperature.
- Specify effects: Temperature cubed.
Example 65
Summary: Opens a data table, fits a linear regressor model with multiple effects and interactions, and excludes the intercept. The response variable is set to Rating.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Mullet & RS & Mixture,
:Sheepshead & RS & Mixture,
:Croaker & RS & Mixture,
:Mullet * :Sheepshead,
:Mullet * :Croaker,
:Mullet * :Temperature,
:Sheepshead * :Croaker,
:Sheepshead * :Temperature,
:Croaker * :Temperature,
:Mullet * :Sheepshead * :Croaker,
:Mullet * :Sheepshead *
:Temperature,
:Mullet * :Croaker * :Temperature,
:Sheepshead * :Croaker *
:Temperature,
:Mullet * :Sheepshead * :Croaker
* :Temperature
),
Y( :Rating ),
No Intercept( 1 )
);
Code Explanation:
- Open data table.
- Fit a linear regressor.
- Define effects for model.
- Include interactions between variables.
- Set response variable as Rating.
- Exclude intercept from model.
Example 66
Summary: Fits a model to predict Oxy levels based on Runtime, Weight, RunPulse, RstPulse, and MaxPulse using Standard Least Squares personality.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Oxy ),
Effects(
:Runtime, :Weight, :RunPulse,
:RstPulse, :MaxPulse
),
Personality(
"Standard Least Squares"
),
Run
);
Code Explanation:
- Open data table.
- Define response variable.
- Specify predictor variables.
- Choose model personality.
- Run the model.
Example 67
Summary: Runs a stepwise regression analysis to identify significant predictor variables in the specified model, utilizing the Stepwise personality.
Code:
// Stepwise Fit
// Open data table
dt = Open("data_table.jmp");
// Stepwise Fit
Fit Model(
Y( :Oxy ),
Effects(
:Runtime, :Weight, :RunPulse,
:RstPulse, :MaxPulse
),
Personality( "Stepwise" ),
Run
);
Code Explanation:
- Open table.
- Define model.
- Specify response variable.
- List predictor variables.
- Choose stepwise personality.
- Execute model fit.
Example 68
Summary: Opens a data table, defines effects for modeling, specifies the response variable, and fits the model using the specified effects.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Liquid, :Sugar, :Flour, :Sifted,
:Type, :Temp, :Salt, :Clamp,
:Coat
),
Y( :Strength )
);
Code Explanation:
- Open data table.
- Define effects for modeling.
- Specify response variable.
- Fit model using specified effects.
Example 69
Summary: Opens a data table, fits a model with specified effects and interactions, applies Scheffe cubic terms, sets the response variable, and excludes the intercept.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Solvent & Mixture,
:Active & Mixture,
:Water & Mixture,
:Solvent * :Active,
:Solvent * :Water,
:Active * :Water,
:Solvent * :Active * :Water,
Scheffe Cubic( Solvent, Active ),
Scheffe Cubic( Solvent, Water ),
Scheffe Cubic( Active, Water )
),
Y( :T ),
No Intercept( 1 )
);
Code Explanation:
- Open table.
- Fit model.
- Specify effects.
- Include interactions.
- Apply Scheffe cubic.
- Set response variable.
- Exclude intercept.
Example 70
Summary: Opens a data table, fits a model with multiple effects and interaction terms, and specifies the response variable.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:"%Beads"n, :"%Strength"n,
:"Flow(g/min)"n, :"T(ºC)"n,
:"%Beads"n * :"%Strength"n,
:"%Beads"n * :"Flow(g/min)"n,
:"%Beads"n * :"T(ºC)"n,
:"%Strength"n * :"Flow(g/min)"n,
:"%Strength"n * :"T(ºC)"n,
:"Flow(g/min)"n * :"T(ºC)"n,
:"%Beads"n * :"%Beads"n,
:"%Strength"n * :"%Strength"n,
:"Flow(g/min)"n * :"Flow(g/min)"n,
:"T(ºC)"n * :"T(ºC)"n
),
Y( :"Size/nm"n )
);
Code Explanation:
- Open table.
- Fit model with effects.
- Include interaction terms.
- Set response variable.
Example 71
Summary: Opens a data table, defines a model with specified effects and interaction terms, adds Scheffe cubic terms, and fits the model without an intercept.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:Propanol & Mixture,
:Butanol & Mixture,
:Pentanol & Mixture,
:Propanol * :Butanol,
:Propanol * :Pentanol,
:Butanol * :Pentanol,
:Propanol * :Butanol * :Pentanol,
Scheffe Cubic(
Propanol,
Butanol
),
Scheffe Cubic(
Propanol,
Pentanol
),
Scheffe Cubic(
Butanol,
Pentanol
)
),
No Intercept( 1 )
);
Code Explanation:
- Open data table.
- Define effects for model.
- Include interaction terms.
- Add Scheffe cubic terms.
- Fit model without intercept.
Example 72
Summary: Opens a data table, defines effects for a model, specifies the response variable, and fits the model using JMP's Fit Model platform.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:X1, :X2, :X3, :X1 * :X2,
:X1 * :X3, :X2 * :X3
),
Y( :Y )
);
Code Explanation:
- Open data table.
- Define effects for model.
- Specify response variable.
- Fit the model.
Example 73
Summary: Opens a data table and fits a MANOVA model to analyze the relationship between response variables Distance and Durability, with Brand as an effect variable.
Code:
// MANOVA
// Open data table
dt = Open("data_table.jmp");
// MANOVA
Fit Model(
Y( :Distance, :Durability ),
Effects( :Brand ),
Personality( "Manova" ),
Run
);
Code Explanation:
- Open data table.
- Fit Model command.
- Specify response variables.
- Add effect variable.
- Set personality to Manova.
- Execute the model.
Example 74
Summary: Visualizes the relationship between durability and brand, using a standard least squares personality to fit the model. The script also generates a profiler report with confidence intervals and term values for each brand.
Code:
// Fit Model: Durability by Brand
// Open data table
dt = Open("data_table.jmp");
// Fit Model: Durability by Brand
Fit Model(
Y( :Durability ),
Effects( :Brand ),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Brand(
"Brand A",
Lock( 0 ),
Show( 1 )
)
)
),
:Durability <<
{Parameter Estimates( 0 ),
Effect Details( 0 ),
Lack of Fit( 0 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
),
SendToReport(
Dispatch(
{"Response Durability",
"Whole Model"},
"Actual by Predicted Plot",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response Durability",
"Whole Model"},
"Summary of Fit", OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response Durability",
"Whole Model"},
"Effect Tests", OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response Durability",
"Prediction Profiler"},
"Profiler", FrameBox,
{Frame Size( 185, 118 )}
)
)
);
Code Explanation:
- Open table.
- Fit model.
- Set response variable.
- Add effect.
- Choose personality.
- Set emphasis.
- Run profiler.
- Configure profiler settings.
- Hide certain reports.
- Adjust report layout.
Example 75
Summary: Fits a model to the 'Price' variable in a data table, considering the effects of 'Age' and 'Bidders', with emphasis on effect leverage. The script also configures various plots for visualization.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Price ),
Effects( :Age, :Bidders ),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run(
:Price << {Lack of Fit( 0 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open data table.
- Define model variables.
- Select modeling personality.
- Set analysis emphasis.
- Run the model fit.
- Configure lack of fit test.
- Enable actual vs predicted plot.
- Disable regression plot.
- Enable residual vs predicted plot.
- Enable effect leverage plot.
Example 76
Summary: Fits a model to open data, specifying effects and personality for Stepwise regression.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :"$/oz"n ),
Effects(
:Type, :Size, :Type * :Size
),
Personality( "Stepwise" ),
Run
);
Code Explanation:
- Open table.
- Define model response.
- Specify model effects.
- Set personality to Stepwise.
- Run model.
Example 77
Summary: Fits a logistic regression model to analyze the relationship between heat, soak, and readiness using the Nominal Logistic personality.
Code:
// Logistic Regression
// Open data table
dt = Open("data_table.jmp");
// Logistic Regression
Fit Model(
Freq( :count ),
Y( :ready ),
Effects( :heat, :soak ),
Personality( "Nominal Logistic" ),
Run
);
Code Explanation:
- Open data table.
- Fit logistic regression model.
- Set frequency column.
- Specify response variable.
- Define effect variables.
- Choose nominal logistic personality.
- Run the analysis.
Example 78
Summary: Opens a data table and fits a model with specified variables, including main effects, interaction effect, and log variance effect, using the Loglinear Variance personality.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Y( :Shrinkage ),
Effects(
:MoldTemp, :Screw Speed,
:MoldTemp * :Screw Speed
),
LogVariance Effects(
:Hold Time & LogVariance
),
Personality( "Loglinear Variance" ),
Run
);
Code Explanation:
- Open data table.
- Fit model with specified variables.
- Set response variable: Shrinkage.
- Include main effects: MoldTemp, Screw Speed.
- Include interaction effect: MoldTemp * Screw Speed.
- Specify log variance effect: Hold Time.
- Choose personality: Loglinear Variance.
- Run the model.
Example 79
Summary: Fits a model using REML, incorporating random and fixed effects for temperature, with standard least squares personality.
Code:
// Model: REML
// Open data table
dt = Open("data_table.jmp");
// Model: REML
Fit Model(
Censor Code( "" ),
Y( :Shrinkage ),
Effects(
:Casting[:Temperature] & Random,
:Temperature
),
Personality(
"Standard Least Squares"
),
Method( "REML" ),
Set Alpha Level( 0.05 )
);
Code Explanation:
- Open data table.
- Fit model using REML.
- Set censor code to none.
- Specify response variable.
- Add random effect for temperature.
- Include fixed effect for temperature.
- Choose standard least squares personality.
- Use REML method.
- Set alpha level to 0.05.
Example 80
Summary: Fits an EMS model to a data table, specifying censor code and response variable, while defining random and fixed effects.
Code:
// Model: EMS
// Open data table
dt = Open("data_table.jmp");
// Model: EMS
Fit Model(
Censor Code( "" ),
Y( :Shrinkage ),
Effects(
:Casting[:Temperature] & Random,
:Temperature
),
Personality(
"Standard Least Squares"
),
Method( "EMS" ),
Set Alpha Level( 0.05 )
);
Code Explanation:
- Open table.
- Fit model using EMS.
- Specify censor code.
- Set response variable.
- Define random effect.
- Include fixed effect.
- Choose standard least squares.
- Select EMS method.
- Set alpha level.
Example 81
Summary: Performs a Nominal Logistic regression analysis on the 'Species' response variable, utilizing 'Sepal length', 'Sepal width', 'Petal length', and 'Petal width' as predictor variables in JMP.
Code:
// Nominal Logistic
// Open data table
dt = Open("data_table.jmp");
// Nominal Logistic
Fit Model(
Y( :Species ),
Effects(
:Sepal length, :Sepal width,
:Petal length, :Petal width
),
Personality( "Nominal Logistic" ),
Run
);
Code Explanation:
- Open data table.
- Define response variable.
- Specify predictor variables.
- Set model personality.
- Run the model.
Example 82
Summary: Fits a linear regression model to data, using standard least squares personality and emphasizing effect leverage.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :y ),
Effects(
:x1, :x2, :x3, :x4, :x5, :x6
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run
);
Code Explanation:
- Open data table.
- Fit model using linear regression.
- Set response variable to y.
- Include x1 to x6 as effects.
- Use standard least squares personality.
- Emphasize effect leverage.
- Run the model.
Example 83
Summary: Opens a data table and fits a nominal logistic model to predict Lung Cancer based on the Smoker variable.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Freq( :Count ),
Y( :Lung Cancer ),
Effects( :Smoker ),
Personality( "Nominal Logistic" )
);
Code Explanation:
- Open table.
- Fit logistic model.
Example 84
Summary: Fits a model using REML to analyze the relationship between rating and machine/person interactions, with random effects for both machine and person.
Code:
// Fit Model REML
// Open data table
dt = Open("data_table.jmp");
// Fit Model REML
Fit Model(
Y( :rating ),
Effects(
:machine, :person & Random,
:machine * :person & Random
),
Personality(
"Standard Least Squares"
),
Run
);
Code Explanation:
- Open data table.
- Fit model using REML.
- Set response variable.
- Add fixed effects.
- Add random effects.
- Specify model personality.
- Run the analysis.
Example 85
Summary: Fits a mixed-effects model using the EMS method to analyze the relationship between machine and person variables, with rating as the response variable.
Code:
// Fit Model EMS
// Open data table
dt = Open("data_table.jmp");
// Fit Model EMS
Fit Model(
Y( :rating ),
Effects(
:machine, :person & Random,
:machine * :person & Random
),
Personality(
"Standard Least Squares"
),
Method( "EMS" ),
Run
);
Code Explanation:
- Open table.
- Fit Model EMS.
- Specify response variable.
- Define effects.
- Set personality.
- Choose method.
- Execute model fit.
Example 86
Summary: Fits a standard least squares model to data, specifying frequency, response, and effect variables, and configuring mean effects.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Freq( :N ),
Y( :mean ),
Effects( :grp ),
Personality(
"Standard Least Squares"
),
Run( :mean << {{:grp << {}}} )
);
Code Explanation:
- Open table.
- Define data table variable.
- Fit Model command.
- Specify frequency column.
- Set response variable.
- Add effect variable.
- Choose personality.
- Run model.
- Configure mean effect.
- Display results.
Example 87
Summary: Fits a Nominal Logistic model to predict a response variable based on predictor variables, with likelihood ratio tests enabled and Wald tests disabled.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Y ),
Effects( :X ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Logistic Plot( 1 )
)
);
Code Explanation:
- Open data table.
- Define data table variable.
- Initiate Fit Model.
- Specify response variable.
- Specify predictor variable.
- Set model personality.
- Run model fitting.
- Enable likelihood ratio tests.
- Disable Wald tests.
- Enable logistic plot.
Example 88
Summary: Generates a response surface model to analyze the relationship between odor, temperature, and glucose ratio, with additional effects for humidity and interactions. The model is run with profiler plots and scaled estimates.
Code:
// Response Surface
// Open data table
dt = Open("data_table.jmp");
// Response Surface
Fit Model(
Y( :odor ),
Effects(
:temp & RS, :gl ratio & RS,
:ht & RS, :temp * :temp,
:gl ratio * :temp,
:gl ratio * :gl ratio,
:ht * :temp, :ht * :gl ratio,
:ht * :ht
),
Personality(
"Standard Least Squares"
),
Run(
Profiler( 1 ),
:odor << {Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )}
)
);
Code Explanation:
- Open data table.
- Define response variable.
- Specify effects for model.
- Set model personality.
- Run the model.
- Generate profiler plot.
- Enable scaled estimates.
- Plot actual vs. predicted.
Example 89
Summary: Opens a data table, defines effects for a model, and fits the model to predict the 'Odor' variable.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:temp & RS, :gl ratio & RS,
:ht & RS, :temp * :temp,
:temp * :gl ratio,
:gl ratio * :gl ratio,
:temp * :ht, :gl ratio * :ht,
:ht * :ht
),
Y( :Odor )
);
Code Explanation:
- Open table.
- Define effects.
- Fit model.
Example 90
Summary: Opens a data table, defines a linear model with multiple effects, sets the response variable, and fits the model using Standard Least Squares personality.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
temp & RS, gl ratio & RS, ht & RS,
temp * gl ratio, temp * ht,
gl ratio * ht, temp * temp,
gl ratio * gl ratio, ht * ht
),
Y( :odor ),
Personality(
"Standard Least Squares"
)
);
Code Explanation:
- Open data table.
- Define effects for model.
- Set response variable.
- Choose modeling personality.
- Fit the model.
Example 91
Summary: Opens a data table, defines a standard least squares model with multiple effects, excludes the intercept, and fits the model to the response variable.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:p1 & RS & Mixture,
:p2 & RS & Mixture,
:p3 & RS & Mixture, :p1 * :p2,
:p1 * :p3, :p2 * :p3
),
Y( :Y ),
No Intercept,
PERSONALITY(
"Standard Least Squares"
)
);
Code Explanation:
- Open data table.
- Define effects for model.
- Specify response variable.
- Exclude intercept from model.
- Set model personality.
- Fit standard least squares model.
Example 92
Summary: Fits a linear model to data, utilizing the Fit Model function in JMP Scripting Language (JSL) to analyze the relationship between OZONE levels and POPulation.
Code:
// Fit Model with Linear Fit
// Open data table
dt = Open("data_table.jmp");
// Fit Model with Linear Fit
Fit Model(
Y( :OZONE ),
Effects( :POP ),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run(
:OZONE << {Lack of Fit( 0 ),
Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open table.
- Define data table variable.
- Fit Model function call.
- Specify response variable.
- Specify effect variable.
- Set personality to "Standard Least Squares".
- Set emphasis to "Effect Leverage".
- Run the model.
- Configure Lack of Fit option.
- Enable Plot Actual by Predicted.
Example 93
Summary: Fits a model with a knotted spline effect to analyze the relationship between OZONE levels and POPulation, while emphasizing effect leverage and providing plots for actual vs. predicted values, residuals, and effect leverage.
Code:
// Fit Model with Knotted Spline Effect
// Open data table
dt = Open("data_table.jmp");
// Fit Model with Knotted Spline Effect
Fit Model(
Y( :OZONE ),
Effects( :POP & Knotted( 5 ) ),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run(
:OZONE << {Lack of Fit( 0 ),
Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open table.
- Fit Model with Knotted Spline Effect.
- Specify response variable.
- Add knotted spline effect.
- Choose Standard Least Squares personality.
- Set emphasis on Effect Leverage.
- Run model.
- Disable Lack of Fit test.
- Enable Actual vs. Predicted plot.
- Enable Residual vs. Predicted plot.
- Enable Effect Leverage plot.
Example 94
Summary: This JSL script defines a full factorial model to analyze the relationship between popcorn, oil amount, and batch on yield, using standard least squares personality.
Code:
// Full Factorial Model
// Open data table
dt = Open("data_table.jmp");
// Full Factorial Model
Fit Model(
Y( :yield ),
Effects(
:popcorn, :oil amt,
:popcorn * :oil amt, :batch,
:popcorn * :batch,
:oil amt * :batch,
:popcorn * :oil amt * :batch
),
Personality(
"Standard Least Squares"
),
Run
);
Code Explanation:
- Open data table.
- Define response variable.
- Define main effects.
- Define interaction effects.
- Specify model personality.
- Run the model.
Example 95
Summary: Fits a proportional hazards model to analyze the relationship between the 'days' variable and the effect of 'Group', while accounting for censoring in the data.
Code:
// Proportional Hazards
// Open data table
dt = Open("data_table.jmp");
// Proportional Hazards
Fit Model(
Y( :days ),
Effects( :Group ),
Personality( "Proportional Hazard" ),
Censor( :Censor ),
Run
);
Code Explanation:
- Open table.
- Fit proportional hazards model.
- Set response variable.
- Include group effect.
- Choose proportional hazard personality.
- Specify censoring variable.
- Execute model fit.
Example 96
Summary: Opens a data table, fits a model using Standard Least Squares personality, and runs a profiler with plots for actual vs predicted values, effect leverage, and residual analysis.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Y ),
Effects( :F, :Ct, :A, :T, :Cn ),
Personality(
"Standard Least Squares"
),
Run(
Profiler,
:Y <<
{Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open table.
- Fit model.
- Specify response variable.
- Add effects.
- Choose personality.
- Run profiler.
- Plot actual vs predicted.
- Disable residual plot.
- Enable effect leverage plot.
Example 97
Summary: Fits a Proportional Hazards model to analyze the relationship between Usage Hours and various effect variables, including Avg Load, Avg Moisture, Avg Vibration, Avg Solar Exposure, Location X, and Location Y.
Code:
// Fit Proportional Hazards
// Open data table
dt = Open("data_table.jmp");
// Fit Proportional Hazards
Fit Model(
Y( :Usage Hours ),
Effects(
:Avg Load, :Avg Moisture,
:Avg Vibration,
:Avg Solar Exposure, :Location X,
:Location Y
),
Personality( "Proportional Hazard" ),
Censor( :Censor ),
Censor Code( "1" ),
Run( Likelihood Ratio Tests( 1 ) )
);
Code Explanation:
- Open data table.
- Define data table variable.
- Fit Proportional Hazards model.
- Specify response variable.
- Define effect variables.
- Set model personality.
- Identify censor variable.
- Specify censor code.
- Run model.
- Perform likelihood ratio tests.
Example 98
Summary: Fits a regression model to predict Yield based on Aperture, Ranging, and Cadence variables in a data table.
Code:
// Regression Model
// Open data table
dt = Open("data_table.jmp");
// Regression Model
Fit Model(
Y( :Yield ),
Effects(
:Aperture, :Ranging, :Cadence
),
Personality(
"Standard Least Squares"
),
Run
);
Code Explanation:
- Open table.
- Fit regression model.
- Specify response variable.
- Define predictor variables.
- Choose modeling personality.
- Execute model fit.
Example 99
Summary: Opens a data table, defines main effects for various variables, specifies the response variable, and fits a model using the Fit Model platform in JMP.
Code:
// Main Effects Model
// Open data table
dt = Open("data_table.jmp");
// Main Effects Model
Fit Model(
Effects(
:day & Random, :time of day,
:thermometer, :outside temp,
:type of space, :east or west,
:sector, :wing, :volunteer,
:outside conditions
),
Y( :fahrenheit )
);
Code Explanation:
- Open table.
- Define effects.
- Specify response variable.
- Fit model.
Example 100
Summary: Opens a data table, fits a model with specified effects, and configures various plot options to visualize the results.
Code:
// Final Model, after Stepwise
// Open data table
dt = Open("data_table.jmp");
// Final Model, after Stepwise
Fit Model(
Y( :fahrenheit ),
Effects(
:time of day, :east or west,
:time of day * :east or west,
:thermometer, :type of space,
:sector, :volunteer
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run(
:fahrenheit <<
{Parameter Estimates( 0 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open table.
- Fit model with specified effects.
- Use Standard Least Squares personality.
- Set emphasis on Effect Leverage.
- Configure fahrenheit parameter estimates.
- Enable Plot Actual by Predicted.
- Disable Plot Regression.
- Enable Plot Residual by Predicted.
- Enable Plot Effect Leverage.
Example 101
Summary: Runs the ordinal logistic model fit process, utilizing the Fit Model platform in JMP to analyze the relationship between taste test ratings and salt levels.
Code:
// Ordinal Fit
// Open data table
dt = Open("data_table.jmp");
// Ordinal Fit
Fit Model(
Y( :Taste Test ),
Effects( :Salt & RS, :Salt * :Salt ),
Personality( "Ordinal Logistic" ),
Run
);
Code Explanation:
- Open data table.
- Fit ordinal logistic model.
- Set response variable.
- Add main effect.
- Add interaction effect.
- Specify personality.
- Execute analysis.
Example 102
Summary: Opens a data table, fits a model to the Expenditures variable with Age Cohort and Ethnicity effects, and runs a profiler with confidence intervals. It also displays summary statistics and plots.
Code:
// Fit Model (Expenditures)
// Open data table
dt = Open("data_table.jmp");
// Fit Model (Expenditures)
Fit Model(
Y( :Expenditures ),
Effects(
:Age Cohort, :Ethnicity,
:Age Cohort * :Ethnicity
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Leverage" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Age Cohort(
" 51 +",
Lock( 0 ),
Show( 1 )
),
Ethnicity(
"Hispanic",
Lock( 0 ),
Show( 1 )
)
)
),
:Expenditures <<
{Summary of Fit( 1 ),
Analysis of Variance( 1 ),
Parameter Estimates( 1 ),
Lack of Fit( 0 ),
Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 1 ),
Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ),
Plot Residual by Normal Quantiles(
0
), Box Cox Y Transformation( 0 )}
),
Local Data Filter(
Add Filter(
columns( :Ethnicity ),
Where(
:Ethnicity == {"Hispanic",
"White not Hispanic"}
),
Display(
:Ethnicity,
N Items( 8 )
)
)
)
);
Code Explanation:
- Open data table.
- Fit Model (Expenditures).
- Set response variable: Expenditures.
- Include effects: Age Cohort, Ethnicity, Age Cohort * Ethnicity.
- Use Standard Least Squares personality.
- Emphasize Effect Leverage.
- Run Profiler with confidence intervals.
- Lock Age Cohort and Ethnicity terms.
- Display Summary of Fit, Analysis of Variance, Parameter Estimates.
- Enable Plot Actual by Predicted, Plot Residual by Predicted, Plot Effect Leverage.
Example 103
Summary: Fits a linear regressor model to a data table, specifying the response variable and adding effects, while choosing the personality and emphasis.
Code:
// Model 1
// Open data table
dt = Open("data_table.jmp");
// Model 1
Fit Model(
Censor Code( "" ),
Y( :Y ),
Effects( :X1, :X2, :X3 ),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Set Alpha Level( 0.05 )
);
Code Explanation:
- Open table.
- Fit a linear regressor.
- Specify response variable.
- Add effects.
- Choose personality.
- Set emphasis.
- Define alpha level.
Example 104
Summary: Fits a linear model to analyze the relationship between Y and X1, X2, and X3 variables in a data table, using standard least squares and generating a minimal report.
Code:
// Model 2
// Open data table
dt = Open("data_table.jmp");
// Model 2
Fit Model(
Censor Code( "" ),
Y( :Y ),
Effects( :X1, :X3, :X2 ),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Set Alpha Level( 0.05 )
);
Code Explanation:
- Open data table.
- Fit a linear model.
- Specify Y variable.
- Include X1 effect.
- Include X3 effect.
- Include X2 effect.
- Use standard least squares.
- Generate minimal report.
- Set alpha level to 0.05.
Example 105
Summary: Opens a data table, fits a model report with standard least squares personality, and configures analysis options for a minimal report.
Code:
// Fit Model Report
// Open data table
dt = Open("data_table.jmp");
// Fit Model Report
Fit Model(
Y( :Y ),
Effects( :X1, :A ),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
:Y << {Analysis of Variance( 1 ),
Lack of Fit( 0 ),
Plot Actual by Predicted( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
),
SendToReport(
Dispatch( {"Response Y"},
"Effect Tests", OutlineBox,
{Close( 0 )}
)
)
);
Code Explanation:
- Open data table.
- Fit model report.
- Set response variable.
- Define effects.
- Choose personality.
- Set emphasis.
- Configure analysis options.
- Disable analysis of variance.
- Disable lack of fit.
- Close effect tests outline.
Example 106
Summary: Fits a Nominal Logistic model to predict sex based on length, basilar, zygomat, and postorb effects in a data table.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :sex ),
Effects(
:length, :basilar, :zygomat,
:postorb
),
Personality( "Nominal Logistic" ),
Run
);
Code Explanation:
- Open data table.
- Fit Nominal Logistic model.
- Set response variable to sex.
- Add length as effect.
- Add basilar as effect.
- Add zygomat as effect.
- Add postorb as effect.
- Execute model fitting.
Example 107
Summary: Opens a data table, fits Model 2 to the data, and generates plots for actual vs predicted values, residuals, and effect leverage for multiple response variables.
Code:
// Fit Model 2
// Open data table
dt = Open("data_table.jmp");
// Fit Model 2
Fit Model(
Y(
:length, :basilar, :zygomat,
:postorb
),
Effects( :sex ),
Personality(
"Standard Least Squares"
),
Run(
:length <<
{Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )},
:basilar <<
{Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )},
:zygomat <<
{Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )},
:postorb <<
{Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open data table.
- Fit Model 2.
- Specify response variables.
- Add effect variable.
- Choose personality method.
- Run model for length.
- Plot actual vs predicted.
- Plot residual vs predicted.
- Plot effect leverage.
- Repeat steps 6-9 for basilar, zygomat, postorb.
Example 108
Summary: Fits a model using the EMS method to analyze the relationship between tenderizer, carcass, roasting time, and their interactions in a data table.
Code:
// Fit Model - EMS Method
// Open data table
dt = Open("data_table.jmp");
// Fit Model - EMS Method
Fit Model(
Y( :Y ),
Effects(
:Tenderizer, :Carcass,
:Tenderizer * :Carcass & Random,
:Roasting Time,
:Roasting Time * :Tenderizer
),
Personality(
"Standard Least Squares"
),
Method( "EMS" ),
Run
);
Code Explanation:
- Open data table.
- Define response variable.
- Specify effects.
- Set personality.
- Choose method.
- Run model.
Example 109
Summary: Opens a data table and fits a quadratic model to predict the response variable, incorporating interaction terms between Reaction Time, Reaction Temperature, and their combinations.
Code:
// Quadratic Model
// Open data table
dt = Open("data_table.jmp");
// Quadratic Model
Fit Model(
Effects(
:Reaction Time & RS,
:Reaction Temperature & RS,
:Reaction Time * :Reaction Time,
:Reaction Time *
:Reaction Temperature,
:Reaction Temperature *
:Reaction Temperature,
:Reaction Time * :Reaction Time
* :Reaction Time,
:Reaction Time * :Reaction Time
* :Reaction Temperature,
:Reaction Time * (
Reaction Temperature *
:Reaction Temperature),
:Reaction Temperature *
:Reaction Temperature *
:Reaction Temperature
),
Y( :Yield )
);
Code Explanation:
- Open data table.
- Fit quadratic model.
- Include interaction terms.
- Set response variable.
Example 110
Summary: Opens a data table, defines effects for multiple variables, specifies the response variable, chooses the Standard Least Squares model personality, and sets the report emphasis to minimal.
Code:
// Model
// Open data table
dt = Open("data_table.jmp");
// Model
Fit Model(
Effects(
:X1, :X2, :X3, :X4, :X5, :X6, :X7,
:X8, :X9, :X10, :X11, :X12, :X13,
:X14, :X15, :X16, :X17, :X18
),
Y( :Y ),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" )
);
Code Explanation:
- Open table.
- Define effects.
- Specify response variable.
- Choose model personality.
- Set report emphasis.
Example 111
Summary: Opens a data table, fits a model with specified effects and personality, runs the model with profiler settings, and configures report dispatch for parameter estimates and scaled estimates.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Disso ),
Effects(
:Mill Time, :Screen Size,
:Blend Time, :Blend Speed,
:Compressor, :Coating Viscosity,
:Spray Rate
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Mill Time(
17.011,
Lock( 0 ),
Show( 1 )
),
Screen Size(
"3",
Lock( 0 ),
Show( 1 )
),
Blend Time(
14.9224,
Lock( 0 ),
Show( 1 )
),
Blend Speed(
60.0442,
Lock( 0 ),
Show( 1 )
),
Compressor(
"Compress1",
Lock( 0 ),
Show( 1 )
),
Coating Viscosity(
99.316,
Lock( 0 ),
Show( 1 )
),
Spray Rate(
399.7,
Lock( 0 ),
Show( 1 )
)
)
),
:Disso << {Lack of Fit( 0 ),
Sorted Estimates( 0 ),
Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
),
SendToReport(
Dispatch( {"Response Disso"},
"Parameter Estimates",
OutlineBox,
{Close( 1 )}
),
Dispatch( {"Response Disso"},
"Scaled Estimates",
OutlineBox,
{Close( 1 )}
)
)
);
Code Explanation:
- Open data table.
- Fit Model command starts.
- Set response variable.
- Define model effects.
- Choose personality method.
- Set emphasis on effect screening.
- Run model with profiler.
- Configure profiler settings.
- Lock term values.
- Close unnecessary reports.
Example 112
Summary: Fits a model with interactions to analyze the relationship between various variables, including Mill Time, Screen Size, Blend Time, Compressor, Coating Viscosity, and Spray Rate, and generates a profiler with confidence intervals.
Code:
// Fit Model with Interactions
// Open data table
dt = Open("data_table.jmp");
// Fit Model with Interactions
Fit Model(
Y( :Disso ),
Effects(
:Mill Time, :Screen Size,
:Blend Time, :Compressor,
:Coating Viscosity, :Spray Rate,
:Mill Time * :Coating Viscosity,
:Blend Time * :Spray Rate,
:Coating Viscosity * :Spray Rate
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Mill Time(
17.011,
Lock( 0 ),
Show( 1 )
),
Screen Size(
"3",
Lock( 0 ),
Show( 1 )
),
Blend Time(
14.9224,
Lock( 0 ),
Show( 1 )
),
Compressor(
"Compress1",
Lock( 0 ),
Show( 1 )
),
Coating Viscosity(
99.316,
Lock( 0 ),
Show( 1 )
),
Spray Rate(
399.7,
Lock( 0 ),
Show( 1 )
)
)
),
:Disso << {Lack of Fit( 0 ),
Sorted Estimates( 0 ),
Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
),
SendToReport(
Dispatch( {"Response Disso"},
"Parameter Estimates",
OutlineBox,
{Close( 1 )}
),
Dispatch( {"Response Disso"},
"Scaled Estimates",
OutlineBox,
{Close( 1 )}
)
)
);
Code Explanation:
- Open data table.
- Fit Model with interactions.
- Set response variable.
- Define effects.
- Set personality.
- Set emphasis.
- Run model.
- Generate profiler.
- Configure profiler settings.
- Customize report display.
Example 113
Summary: Fits a model with interaction profiles to analyze the relationship between 'Mill Time', 'Screen Size', 'Blend Time', 'Coating Viscosity', and 'Spray Rate' on the response variable 'Disso', while emphasizing effect screening and customizing diagnostic plots.
Code:
// Fit Model with Interaction Profiles
// Open data table
dt = Open("data_table.jmp");
// Fit Model with Interaction Profiles
Fit Model(
Y( :Disso ),
Effects(
:Mill Time, :Screen Size,
:Blend Time, :Coating Viscosity,
:Spray Rate,
:Mill Time * :Coating Viscosity,
:Blend Time * :Spray Rate,
:Coating Viscosity * :Spray Rate,
:Mill Time * :Mill Time
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Mill Time(
17.011,
Lock( 0 ),
Show( 1 )
),
Screen Size(
"3",
Lock( 0 ),
Show( 1 )
),
Blend Time(
14.9224,
Lock( 0 ),
Show( 1 )
),
Coating Viscosity(
99.316,
Lock( 0 ),
Show( 1 )
),
Spray Rate(
399.7,
Lock( 0 ),
Show( 1 )
)
)
),
:Disso << {Lack of Fit( 0 ),
Sorted Estimates( 0 ),
Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 ),
Interaction Plots( 1 )}
),
SendToReport(
Dispatch( {"Response Disso"},
"Parameter Estimates",
OutlineBox,
{Close( 1 )}
),
Dispatch( {"Response Disso"},
"Scaled Estimates",
OutlineBox,
{Close( 1 )}
)
)
);
Code Explanation:
- Open data table.
- Define response variable.
- Specify model effects.
- Set model personality.
- Emphasize effect screening.
- Run profiler with settings.
- Configure profiler term values.
- Customize diagnostic plots.
- Hide parameter estimates.
- Hide scaled estimates.
Example 114
Summary: Visualizes the relationship between four response variables (ABRASION, MODULUS, ELONG, and HARDNESS) using a Standard Least Squares model with specified effects and plots actual vs predicted values for each response variable.
Code:
// RSM for 4 Responses
// Open data table
dt = Open("data_table.jmp");
// RSM for 4 Responses
Fit Model(
Y(
:ABRASION, :MODULUS, :ELONG,
:HARDNESS
),
Effects(
:SILICA & RS, :SILANE & RS,
:SULFUR & RS, :SILICA * :SILICA,
:SILANE * :SILICA,
:SILANE * :SILANE,
:SULFUR * :SILICA,
:SULFUR * :SILANE,
:SULFUR * :SULFUR
),
Personality(
"Standard Least Squares"
),
Run(
Profiler(
Confidence Intervals( 1 )
),
:ABRASION <<
{Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )},
:MODULUS <<
{Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )},
:ELONG << {Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )},
:HARDNESS <<
{Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 )}
)
);
Code Explanation:
- Open data table.
- Define response variables.
- Specify model effects.
- Use Standard Least Squares personality.
- Run the model.
- Generate profiler with confidence intervals.
- Display scaled estimates for ABRASION.
- Plot actual vs predicted for ABRASION.
- Display scaled estimates for MODULUS.
- Plot actual vs predicted for MODULUS.
Example 115
Summary: Opens a data table, fits a Nominal Logistic model with specified effect variables, and runs the model execution with likelihood ratio tests enabled and Wald tests disabled.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Survived ),
Effects(
:Passenger Class, :Sex, :Age,
:Siblings and Spouses,
:Parents and Children, :Fare
),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 )
)
);
Code Explanation:
- Open data table.
- Fit Model command initiated.
- Specify response variable.
- Define effect variables.
- Set personality to Nominal Logistic.
- Run model execution.
- Enable Likelihood Ratio Tests.
- Disable Wald Tests.
Example 116
Summary: Fits a full factorial model to analyze the relationship between Wear, Speed, Angle, Material, and their interactions using Standard Least Squares.
Code:
// Fit Model: Full Factorial Specification
// Open data table
dt = Open("data_table.jmp");
// Fit Model: Full Factorial Specification
Fit Model(
Y( :Wear ),
Effects(
:Speed, :Angle, :Speed * :Angle,
:Material, :Speed * :Material,
:Angle * :Material,
:Speed * :Angle * :Material
),
Personality(
"Standard Least Squares"
)
);
Code Explanation:
- Open data table.
- Fit model with specified effects.
- Set response variable to Wear.
- Include Speed in effects.
- Include Angle in effects.
- Include interaction Speed*Angle.
- Include Material in effects.
- Include interaction Speed*Material.
- Include interaction Angle*Material.
- Include interaction SpeedAngleMaterial.
Example 117
Summary: Opens a data table, fits a model with specified effects, and runs a profiler with confidence intervals, while configuring term values, locking some terms, and plotting actual by predicted.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :Wear ),
Effects(
:Speed, :Angle, :Speed * :Angle,
:Material, :Speed * :Material,
:Angle * :Material,
:Speed * :Angle * :Material
),
Personality(
"Standard Least Squares"
),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Speed(
0,
Lock( 0 ),
Show( 1 )
),
Angle(
0,
Lock( 0 ),
Show( 1 )
),
Material(
"A",
Lock( 0 ),
Show( 1 )
)
)
),
:Wear << {Lack of Fit( 0 ),
Sorted Estimates( 1 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
)
);
Code Explanation:
- Open data table.
- Fit model with specified effects.
- Use standard least squares personality.
- Set emphasis on effect screening.
- Run profiler with confidence intervals.
- Set term values for Speed, Angle, and Material.
- Lock term values for Speed and Angle.
- Show term values for Speed, Angle, and Material.
- Configure Lack of Fit and Sorted Estimates.
- Plot Actual by Predicted, disable other plots.
Example 118
Summary: Fits a Proportional Hazards model to analyze the relationship between variables in a data table, with interactive features for censoring and risk ratio calculation.
Code:
// Fit Proportional Hazards
// Open data table
dt = Open("data_table.jmp");
// Fit Proportional Hazards
Fit Model(
Y( :Time ),
Effects(
:Cell Type, :Treatment, :Prior,
:Age, :Diag Time, :KPS
),
Personality( "Proportional Hazard" ),
Censor( :censor ),
Run( Risk Ratios( 1 ) )
);
Code Explanation:
- Open data table.
- Define response variable.
- Specify effects variables.
- Choose proportional hazard model.
- Identify censoring variable.
- Run model.
- Display risk ratios.
Example 119
Summary: Fits a standard least squares model to predict weight (lb.) based on age, sex, and height (in.), with interactive plots for actual vs predicted, residual vs predicted, and effect leverage.
Code:
// Fit Model
// Open data table
dt = Open("data_table.jmp");
// Fit Model
Fit Model(
Y( :"weight (lb.)"n ),
Effects(
:age, :sex, :"height (in.)"n
),
Personality(
"Standard Least Squares"
),
Run(
:"weight (lb.)"n <<
{Plot Actual by Predicted( 1 ),
Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open table.
- Fit Model.
- Set response variable.
- Add effects.
- Choose personality.
- Run model.
- Plot actual vs predicted.
- Plot residual vs predicted.
- Plot effect leverage.
Example 120
Summary: Opens the 'data_table.jmp' file and fits a model with ABRASION as the response variable, including main effects of SILICA, SILANE, SULFUR, and their interactions, using Standard Least Squares personality and minimal report emphasis.
Code:
Open("data_table.jmp");
Fit Model(
Y( :ABRASION ),
Effects( :SILICA, :SILANE, :SULFUR, :SILICA * :SILANE, :SILICA * :SULFUR, :SILANE * :SULFUR ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
:ABRASION << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Tests( 0 ), Effect Details( 0 ),
Lack of Fit( 0 ), Scaled Estimates( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ),
Interaction Plots( 1 )},
Effect Summary( 0 )
)
);
Code Explanation:
- Open data_table data
- Fit model with ABRASION as response.
- Include SILICA, SILANE, SULFUR effects.
- Include interaction effects between pairs.
- Use Standard Least Squares personality.
- Set report emphasis to Minimal.
- Disable Summary of Fit.
- Disable Analysis of Variance.
- Enable Interaction Plots.
- Disable other report sections.
Example 121
Summary: Opens the 'data_table.jmp' file and fits two separate models for ABRASION and weight, including interaction effects, using Standard Least Squares personality with minimal report emphasis.
Code:
Open("data_table.jmp");
Fit Model(
Y( :ABRASION ),
Effects( :SILICA, :SILANE, :SULFUR, :SILICA * :SILANE, :SILICA * :SULFUR, :SILANE * :SULFUR ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
:ABRASION << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Tests( 0 ), Effect Details( 0 ),
Lack of Fit( 0 ), Scaled Estimates( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ),
Interaction Plots( 1 )},
Effect Summary( 0 )
)
);
Open("data_table.jmp");
Fit Model(
Y( :weight ),
Effects( :sex, :height, :sex * :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:weight << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Tests( 0 ), Effect Details( 0 ),
Lack of Fit( 0 ), Scaled Estimates( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ),
Interaction Plots( 1 )},
Effect Summary( 0 )
)
);
Code Explanation:
- Open data_table data
- Fit model for ABRASION.
- Include interaction effects.
- Use Standard Least Squares personality.
- Minimal report emphasis.
- Disable most output options.
- Enable Interaction Plots.
- Open data_table data
- Fit model for weight.
- Include interaction effects.
Example 122
Summary: Fits a nominal logistic model to a data table, including effects for country, type, and marital status, and generates two windows with graph boxes featuring log and linear scales.
Code:
dt = Open("data_table.jmp");
dt << Fit Model(
Y( :size ),
Effects( :country, :type, :marital status ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
country( "American", Lock( 0 ), Show( 1 ) ),
Type( "Family", Lock( 0 ), Show( 1 ) ),
marital status( "Married", Lock( 0 ), Show( 1 ) )
)
)
),
SendToReport(
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} )
)
);
x = New Window( "Test", gb1 = Graph Box( FrameSize( 200, 200 ), H Line( 30 ) ), gb2 = Graph Box( FrameSize( 200, 200 ), V Line( 30 ) ) );
gb1[AxisBox( 2 )] << Scale( Log );
gb1[AxisBox( 2 )] << Scale( Linear );
gb2[AxisBox( 1 )] << Scale( Log );
gb2[AxisBox( 1 )] << Scale( Linear );
y = New Window( "Test",
gb1 = Graph Box( FrameSize( 200, 200 ), H Line( -1000, 1000, 30 ) ),
gb2 = Graph Box( FrameSize( 200, 200 ), V Line( 30, -1000, 1000 ) )
);
gb1[AxisBox( 2 )] << Scale( Log );
gb2[AxisBox( 1 )] << Scale( Log );
Code Explanation:
- Open data table;
- Fit nominal logistic model.
- Set response variable: size.
- Include effects: country, type, marital status.
- Run likelihood ratio tests.
- Disable Wald tests.
- Enable profiler.
- Lock and show term values.
- Close whole model test, lack of fit, parameter estimates.
- Create two windows with graph boxes.
- Set horizontal line at y=30 in first window.
- Set vertical line at x=30 in second window.
- Toggle log and linear scales for axes.
- Create another window with graph boxes.
- Set horizontal line from -1000 to 1000 at y=30.
- Set vertical line from 30 to -1000 to 1000.
- Set log scale for axes.
Example 123
Summary: Fits a linear model to a data table, specifying response variables and effects, while configuring output options and disabling summary statistics.
Code:
dt = Open("data_table.jmp");
fit = dt << Fit Model(
Y( :Process 1 ),
Effects,
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:Process 1 << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )},
Effect Summary( 0 )
),
SendToReport(
Dispatch( {"Response Process 1", "Whole Model", "Actual by Predicted Plot"}, "1", ScaleBox,
{Add Ref Line( 14, "Solid", "Light Green", "", 4 )}
),
Dispatch( {"Response Process 1", "Whole Model", "Residual by Predicted Plot"}, "1", ScaleBox,
{Add Ref Line( 14, "Solid", "Light Green", "", 4 )}
)
)
);
cs = fit << Column Switcher( :Process 1, {:Process 1, :Process 2}, Retain Axis Settings( 1 ) );
Code Explanation:
- Open data table.
- Fit linear model.
- Set response variable.
- Define effects.
- Choose personality.
- Set emphasis.
- Configure output options.
- Disable summary of fit.
- Disable analysis of variance.
- Disable parameter estimates.
Example 124
Summary: Fits a linear model to a data table, configuring specific plots and reports while disabling most analysis outputs.
Code:
dt = Open("data_table.jmp");
fit = dt << Fit Model(
Y( :Process 1 ),
Effects,
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:Process 1 << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )},
Effect Summary( 0 )
),
SendToReport(
Dispatch( {"Response Process 1", "Whole Model", "Actual by Predicted Plot"}, "1", ScaleBox,
{Add Ref Line( 14, "Solid", "Light Green", "", 4 )}
),
Dispatch( {"Response Process 1", "Whole Model", "Residual by Predicted Plot"}, "1", ScaleBox,
{Add Ref Line( 14, "Solid", "Light Green", "", 4 )}
)
)
);
cs = fit << Column Switcher( :Process 1, {:Process 1, :Process 2}, Retain Axis Settings( 1 ) );
cs << Next;
Code Explanation:
- Open data table.
- Fit linear model.
- Set model options.
- Run model analysis.
- Disable most reports.
- Enable specific plots.
- Add reference line to actual vs predicted plot.
- Add reference line to residual vs predicted plot.
- Initialize column switcher.
- Switch columns and retain settings.
Example 125
Summary: Fits a linear model to data, emphasizing effect leverage and generating plots for actual by predicted and residual by predicted values.
Code:
dt = Open("data_table.jmp");
fit = dt << Fit Model(
Y( :Process 1 ),
Effects,
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:Process 1 << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )},
Effect Summary( 0 )
),
SendToReport(
Dispatch( {"Response Process 1", "Whole Model", "Actual by Predicted Plot"}, "1", ScaleBox,
{Add Ref Line( 14, "Solid", "Light Green", "", 4 )}
),
Dispatch( {"Response Process 1", "Whole Model", "Residual by Predicted Plot"}, "1", ScaleBox,
{Add Ref Line( 14, "Solid", "Light Green", "", 4 )}
)
)
);
cs = fit << Column Switcher( :Process 1, {:Process 1, :Process 2} );
Code Explanation:
- Open data table.
- Fit linear model.
- Set effect leverage emphasis.
- Hide summary of fit.
- Hide analysis of variance.
- Hide parameter estimates.
- Hide lack of fit.
- Hide scaled estimates.
- Show actual by predicted plot.
- Hide regression plot.
- Show residual by predicted plot.
- Hide studentized residuals plot.
- Show effect leverage plot.
- Hide residual by normal quantiles plot.
- Hide Box Cox transformation.
- Hide effect summary report.
- Add reference line to actual by predicted plot.
- Add reference line to residual by predicted plot.
- Enable column switching for Process 1.
Example 126
Summary: Fits a linear model to a data table, generating plots and summary statistics for analysis.
Code:
dt = Open("data_table.jmp");
fit = dt << Fit Model(
Y( :Process 1 ),
Effects,
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:Process 1 << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )},
Effect Summary( 0 )
),
SendToReport(
Dispatch( {"Response Process 1", "Whole Model", "Actual by Predicted Plot"}, "1", ScaleBox,
{Add Ref Line( 14, "Solid", "Light Green", "", 4 )}
),
Dispatch( {"Response Process 1", "Whole Model", "Residual by Predicted Plot"}, "1", ScaleBox,
{Add Ref Line( 14, "Solid", "Light Green", "", 4 )}
)
)
);
cs = fit << Column Switcher( :Process 1, {:Process 1, :Process 2} );
cs << Next;
Code Explanation:
- Open data table.
- Fit linear model.
- Set response variable.
- Define effects.
- Choose modeling personality.
- Set emphasis.
- Run model with options.
- Disable summary of fit.
- Disable analysis of variance.
- Disable parameter estimates.
- Disable lack of fit.
- Disable scaled estimates.
- Enable actual by predicted plot.
- Disable regression plot.
- Enable residual by predicted plot.
- Disable studentized residuals plot.
- Enable effect leverage plot.
- Disable residual by normal quantiles plot.
- Disable Box Cox transformation.
- Disable effect summary.
- Add reference line to actual by predicted plot.
- Add reference line to residual by predicted plot.
- Switch columns for prediction.
- Move to next column.
Example 127
Summary: Analyze and visualize a diamond pricing model, utilizing Fit Model to screen effects and configure response limits.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Price ),
Effects( :Carat Weight, :Color, :Clarity, :Depth, :Table, :Cut, :Report ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
Price << Response Limits(
{Lower( 2000, 0.01 ), Middle( 3000, 1 ), Upper( 4000, 0.01 ), Goal( "Match Target" ), Importance( 1 )}
),
Arrange in Rows( 4 ),
Term Value(
Carat Weight( 0.8701, Lock( 0 ), Show( 1 ) ),
Color( "K", Lock( 0 ), Show( 1 ) ),
Clarity( "SI2", Lock( 0 ), Show( 1 ) ),
Depth( 61.7115, Lock( 0 ), Show( 1 ) ),
Table( 57.861, Lock( 0 ), Show( 1 ) ),
Cut( "Very Good", Lock( 0 ), Show( 1 ) ),
Report( "AGS", Lock( 0 ), Show( 1 ) )
)
),
:Price << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Sorted Estimates( 0 ), Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 1 ),
Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 1 )},
Automatic Recalc( 1 )
),
Local Data Filter(
Mode( Include( 0 ) ),
Add Filter( columns( :Report ), Where( :Report == "AGS" ), Display( :Report, Size( 160, 30 ), List Display ) )
),
SendToReport(
Dispatch( {"Response Price"}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response Price"}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response Price"}, "Residual by Predicted Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response Price"}, "Studentized Residuals", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response Price"}, "Scaled Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response Price"}, "Prediction Profiler", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit model with Price as response.
- Include multiple effects.
- Use Standard Least Squares personality.
- Emphasize Effect Screening.
- Run Profiler with confidence intervals.
- Set Price response limits.
- Arrange profiler in rows.
- Set term values for each factor.
- Configure report options and local data filter.
Example 128
Summary: Fits a linear model to predict weight, considering age, sex, and height effects, with minimal report emphasis and expanded estimates.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( :weight << {Expanded Estimates( 1 ), Show Prediction Expression( 1 )} ),
SendToReport(
Dispatch( {"Response weight"}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Summary of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Analysis of Variance", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Effect Tests", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight", "Expanded Estimates"}, "Estimate", NumberColBox, {Set Format( "Best", 12 )} )
)
);
Code Explanation:
- Open data table;
- Fit linear model on weight.
- Include age, sex, height effects.
- Use standard least squares personality.
- Minimal report emphasis.
- Run expanded estimates for weight.
- Show prediction expression for weight.
- Close Effect Summary.
- Close Lack Of Fit.
- Close Summary of Fit.
Example 129
Summary: Fits a linear model to data, generating a detailed report with various sections and customizing the display of estimates.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( :weight << {Expanded Estimates( 1 ), Show Prediction Expression( 1 )} ),
SendToReport(
Dispatch( {"Response weight"}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Summary of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Analysis of Variance", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Effect Tests", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight", "Expanded Estimates"}, "Estimate", NumberColBox, {Set Format( "Best", 12 )} )
)
);
New Window( "pictures", H List Box( Tab Page Box( "Picture", obj << Get Picture() ) ) );
Code Explanation:
- Open data table.
- Fit linear model to data.
- Set response variable.
- Add effects to model.
- Choose personality method.
- Set report emphasis.
- Run model with options.
- Close unnecessary report sections.
- Set number format for estimates.
- Create new window with picture.
Example 130
Summary: Fits a model with multiple predictors to analyze relationships between response variable Y and effects Age, Gender, BMI, BP, Total Cholesterol, LDL, HDL, TCH, LTG, Glucose.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Y ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run,
SendToReport( Dispatch( {"Response Y", "Effect Summary"}, "", TableBox, {Set Shade Alternate Rows( 1 )} ) )
);
Code Explanation:
- Open data table;
- Fit model with multiple predictors.
- Set response variable to Y.
- Include Age, Gender, BMI, BP, Total Cholesterol, LDL, HDL, TCH, LTG, Glucose as effects.
- Use Standard Least Squares personality.
- Generate Minimal Report.
- Run the model.
- Access Response Y report.
- Navigate to Effect Summary.
- Enable alternate row shading.
Example 131
Summary: Fits a model to predict weight based on height, grouped by sex, using standard least squares method and reports the results.
Code:
dt = Open("data_table.jmp");
fm = dt << Fit Model( Y( :Weight ), Effects( :Height ), By( :Sex ), Personality( Standard Least Squares ), Run );
Report( fm[1] )["sex=F"] << Close;
Code Explanation:
- Open data table.
- Fit model with weight as response.
- Include height as effect.
- Use sex for grouping.
- Apply standard least squares method.
- Run the model.
- Access first report element.
- Close "sex=F" outline.
Example 132
Summary: Fits a linear model for weight, using height as a predictor and grouping by sex, with standard least squares applied.
Code:
dt = Open("data_table.jmp");
fm = dt << Fit Model( Y( :Weight ), Effects( :Height ), By( :Sex ), Personality( Standard Least Squares ), Run );
Report( fm[1] )["sex=F"] << Close;
Report( fm[2] )["sex=M"] << Close;
Code Explanation:
- Open data table.
- Fit linear model for weight.
- Use height as predictor.
- Group by sex.
- Apply standard least squares.
- Run the model.
- Access report for females.
- Close female report.
- Access report for males.
- Close male report.
Example 133
Summary: Analyze and visualize a model with height as response, including sex as an effect, using standard least squares personality and emphasizing effect leverage.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :height ),
Effects( :sex ),
Personality( Standard Least Squares ),
Emphasis( Effect Leverage ),
Run(
:height << {Lack of Fit( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 ), {:sex << {LSMeans Dunnett(
0.05,
Control Level( "F" ),
Control Differences Chart( 1, Point Options( "Show Needles" ) )
)}}}
),
SendToReport(
Dispatch( {"Response height"}, "Whole Model", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response height", "sex"}, "Leverage Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response height", "sex"}, "Least Squares Means Table", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit model with height as response.
- Include sex as effect.
- Use standard least squares personality.
- Emphasize effect leverage.
- Run model with specified options.
- Disable lack of fit test.
- Enable plot actual by predicted.
- Disable plot regression.
- Enable plot residual by predicted.
- Enable plot effect leverage.
- Perform LSMeans Dunnett for sex.
- Set control level to "F".
- Enable control differences chart with needles.
- Close "Whole Model" outline.
- Close "Leverage Plot" outline.
- Close "Least Squares Means Table" outline.
Example 134
Summary: Runs a MANOVA analysis to compare the means of multiple response variables across treatment groups, with customized formatting for least squares means and overall means.
Code:
dt = Open("data_table.jmp");
Fit Model(
Y( :April AM, :April PM, :May AM, :May PM, :June AM, :June PM ),
Effects( :treatment ),
Personality( "Manova" ),
Run,
SendToReport(
Dispatch( {"Least Squares Means", "Overall Means"}, "2", ScaleBox, {Format( "Custom", Formula( value > 200 ), 12 )} ),
Dispatch( {"Least Squares Means", "treatment"}, "2", ScaleBox, {Format( "Custom", Formula( value > 220 ), 12 )} )
)
);
Code Explanation:
- Open data table;
- Fit Manova model.
- Specify response variables.
- Include treatment effect.
- Set Manova personality.
- Run the analysis.
- Format least squares means.
- Apply custom format.
- Format overall means.
- Apply custom format.
Example 135
Summary: Fits a nominal logistic model to analyze lung cancer data, generating various diagnostic plots and metrics.
Code:
dt = Open("data_table.jmp");
Fit Model(
Freq( :Count ),
Y( :Lung Cancer ),
Effects( :Smoker ),
Personality( "Nominal Logistic" ),
Run(
Positive Level( "Cancer" ),
Likelihood Ratio Tests( 1 ),
Wald Tests( 1 ),
Odds Ratios( 1 ),
ROC Curve( 1 ),
Lift Curve( 1 ),
Confusion Matrix( 1 ),
Profiler( 1, Interaction Profiler( 1 ), Term Value( Smoker( "NonSmoker", Lock( 0 ), Show( 1 ) ) ) )
),
SendToReport(
Dispatch( {"Receiver Operating Characteristic"}, "1", ScaleBox,
{Format( "Custom", Formula( If( Contains( Char( value ), "." ), Char( value ) || "000", Char( value ) || ".000" ) ), 12 )}
),
Dispatch( {"Receiver Operating Characteristic"}, "2", ScaleBox,
{Format( "Custom", Formula( If( Contains( Char( value ), "." ), Char( value ) || "000", Char( value ) || ".000" ) ), 12 )}
)
)
);
Code Explanation:
- Open data table.
- Fit nominal logistic model.
- Set frequency variable.
- Specify response variable.
- Add effect variable.
- Configure positive level.
- Enable likelihood ratio tests.
- Enable Wald tests.
- Enable odds ratios.
- Generate ROC curve.
- Generate lift curve.
- Display confusion matrix.
- Create profiler.
- Customize ROC scale formatting.
Example 136
Summary: Fits a proportional hazard model to analyze survival data, utilizing the Fit Model platform in JMP.
Code:
dt = Open("data_table.jmp");
Fit Model(
Y( :Time ),
Effects( :Cell Type, :Treatment, :Prior, :Age, :Diag Time, :KPS ),
Personality( "Proportional Hazard" ),
Censor( :censor ),
Censor Code( "1" ),
Run( Likelihood Ratio Tests( 1 ), Likelihood Confidence Intervals( 1 ), Risk Ratios( 1 ) ),
SendToReport(
Dispatch( {"Baseline Survival at mean"}, "1", ScaleBox,
{Format(
"Custom",
Formula(
Random Reset( 1 );
Round( Random Uniform( 0, value ), 2 );
),
12
)}
),
Dispatch( {"Baseline Survival at mean"}, "2", ScaleBox, {Format( "Custom", Formula( Round( SinH( value ), 2 ) ), 12 )} )
)
);
Code Explanation:
- Open data table;
- Fit proportional hazard model.
- Set response variable.
- Define effects variables.
- Choose personality type.
- Specify censor variable.
- Set censor code.
- Run likelihood ratio tests.
- Enable confidence intervals.
- Calculate risk ratios.
Example 137
Summary: Fits a proportional hazards model to analyze survival data, incorporating multiple effects variables and censoring information.
Code:
dt = Open("data_table.jmp");
Fit Model(
Y( :Time ),
Effects( :Cell Type, :Treatment, :Prior, :Age, :Diag Time, :KPS ),
Personality( "Proportional Hazard" ),
Censor( :censor ),
Censor Code( "1" ),
Run( Likelihood Ratio Tests( 1 ), Likelihood Confidence Intervals( 1 ), Risk Ratios( 1 ) ),
SendToReport(
Dispatch( {"Baseline Survival at mean"}, "1", ScaleBox, {Format( "Custom", Formula( Char( value ) || " s" ), 12 )} ),
Dispatch( {"Baseline Survival at mean"}, "2", ScaleBox, {Format( "Custom", Formula( Round( Logit( value ), 2 ) ), 12 )} )
)
);
Code Explanation:
- Open data table.
- Fit proportional hazards model.
- Specify response variable.
- Define effects variables.
- Set personality to Proportional Hazard.
- Identify censoring variable.
- Define censor code.
- Request likelihood ratio tests.
- Request likelihood confidence intervals.
- Request risk ratios.
Example 138
Summary: Fits a model with ABRASION and HARDNESS as responses, including SILICA, SILANE, and SULFUR as effects, using Standard Least Squares personality.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :ABRASION, :HARDNESS ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Standard Least Squares ),
Run,
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Response ABRASION", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Response HARDNESS", OutlineBox, {Close( 1 )} )
)
);
obj << profiler( 1 );
obj << surface profiler( 1 );
Code Explanation:
- Open data table.
- Fit model with ABRASION, HARDNESS as responses.
- Include SILICA, SILANE, SULFUR as effects.
- Use Standard Least Squares personality.
- Run the model.
- Close Effect Summary report.
- Close Response ABRASION report.
- Close Response HARDNESS report.
- Launch Profiler for the model.
- Launch Surface Profiler for the model.
Example 139
Summary: Fits a model with two responses and three effects, using standard least squares, and generates reports for effect summary, response abrasion, and response hardness.
Code:
Names Default To Here( 1 );
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :ABRASION, :HARDNESS ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Standard Least Squares ),
Run,
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Response ABRASION", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Response HARDNESS", OutlineBox, {Close( 1 )} )
)
);
obj << profiler( 1 );
obj << surface profiler( 1 );
Code Explanation:
- Set default names.
- Open data_table data
- Fit model with two responses.
- Include three effects.
- Use standard least squares.
- Run the model.
- Close effect summary.
- Close response abrasion.
- Close response hardness.
- Open profiler.
- Open surface profiler.
Example 140
Summary: Fits a model with weight as response, including age, sex, and height as effects, and generates reports for summary of fit, analysis of variance, parameter estimates, and plots actual by predicted and residual by predicted.
Code:
Open("data_table.jmp");
Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:weight << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )}
),
Local Data Filter( Add Filter( columns( :name ), Display( :name, N Items( 15 ), Find( Set Text( "" ) ) ) ) ),
SendToReport(
Dispatch( {"Response weight", "Whole Model", "Actual by Predicted Plot"}, "FitLS Leverage", FrameBox,
Add Pin Annotation(
Seg( Marker Seg( 1 ) ),
Index( 13 ),
Index Row( 13 ),
UniqueID( 13 ),
FoundPt( {354, 236} ),
Origin( {82.2965413533835, 95.1744} ),
RightOfCenter( 0 ),
Tag Line( 1 )
)
),
Dispatch( {"Response weight", "Whole Model", "Residual by Predicted Plot"}, "FitLS Leverage", FrameBox,
Add Pin Annotation(
Seg( Marker Seg( 1 ) ),
Index( 10 ),
Index Row( 10 ),
UniqueID( 10 ),
FoundPt( {361, 767} ),
Origin( {76.7446153846154, -9.89877267803325} ),
RightOfCenter( 0 ),
Tag Line( 1 )
)
)
)
);
Code Explanation:
- Open data table.
- Fit model with weight as response.
- Include age, sex, height as effects.
- Use standard least squares personality.
- Emphasize effect leverage.
- Generate summary of fit report.
- Generate analysis of variance report.
- Generate parameter estimates report.
- Plot actual by predicted.
- Plot residual by predicted.
- Add local data filter for name column.
- Annotate actual by predicted plot.
- Annotate residual by predicted plot.
Example 141
Summary: Fits a Partial Least Squares model to predict Price, considering Carat Weight, Color, Clarity, Depth, Table, and Cut as effects, with KFold validation and NIPALS method.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Price ),
Effects( :Carat Weight, :Color, :Clarity, :Depth, :Table, :Cut ),
No Intercept( 1 ),
Center Polynomials( 0 ),
Personality( "Partial Least Squares" ),
Run(
Initial Number of Factors( 15 ),
Validation Method( KFold( 7 ), Initial Number of Factors( 15 ) ),
Fit( Method( NIPALS ), Number of Factors( 6 ) )
),
SendToReport(
Dispatch( {}, "Model Launch", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "KFold Cross Validation with K=7 and Method=NIPALS Using Fast SVD", OutlineBox, {Close( 1 )} ),
Dispatch( {"NIPALS Fit with 6 Factors Using Fast SVD"}, "X-Y Scores Plots", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit Model dialog initiated.
- Set Price as response variable.
- Include Carat Weight, Color, Clarity, Depth, Table, Cut as effects.
- Disable intercept term.
- Disable centering polynomials.
- Choose Partial Least Squares personality.
- Set initial number of factors to 15.
- Use KFold validation with 7 folds.
- Fit model using NIPALS method with 6 factors.
Example 142
Summary: Analyze and visualize a mixed model with repeated effects, generating a graph builder with interactive elements.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Y ),
Effects( :Quadrant, :Layout, :Quadrant * :Layout ),
Subject( :Wafer ID ),
Repeated Effects( :Quadrant ),
Repeated Structure( "Unstructured" ),
Personality( "Mixed Model" ),
Run( Repeated Effects Covariance Parameter Estimates( 0 ) ),
);
obj << Prediction Formula;
dt << Graph Builder(
Size( 532, 482 ),
Show Control Panel( 0 ),
Variables( X( :Horizontal ), Y( :Vertical ), Wrap( :Layout ), Color( :Pred Formula Y ) ),
Elements( Points( X, Y, Legend( 20 ), Jitter( "Auto" ) ) )
);
Code Explanation:
- Open data table.
- Fit mixed model.
- Include main effects.
- Include interaction effect.
- Specify subject variable.
- Define repeated effects.
- Set unstructured covariance.
- Generate prediction formula.
- Create graph builder.
- Add variables and elements.
Example 143
Summary: Fits a linear model to a data table, specifying effects and personality, and generating various summary statistics and plots.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :Y ),
Effects( :HBars, :Dynamo, :Seat, :Tires, :Gear, :Raincoat, :Brkfast ),
Personality( Standard Least Squares ),
Emphasis( Effect Screening ),
Run(
Profiler( 0 ),
:Y << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Tests( 0 ), Effect Details( 0 ),
Lack of Fit( 0 ), Normal Plot( 1 ), Sorted Estimates( 1 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )}
),
SendToReport( Dispatch( {"Response Y"}, "Sorted Parameter Estimates", OutlineBox, {Close( 1 )} ) )
);
Code Explanation:
- Open data table.
- Define dependent variable.
- Specify model effects.
- Set personality to standard least squares.
- Emphasize effect screening.
- Run fit model.
- Disable profiler.
- Configure summary of fit.
- Enable normal plot.
- Enable sorted estimates.
Example 144
Summary: Analyze a data table to model the relationship between height and weight, with emphasis on effect leverage, using Standard Least Squares personality.
Code:
dt = Open("data_table.jmp");
fm = dt << Fit Model(
Y( :height, :weight ),
Effects,
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:height << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )},
:weight << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )}
),
By( :sex )
);
fm2 = fm << redo analysis;
Code Explanation:
- Open data table.
- Create Fit Model object.
- Set response variables: height, weight.
- Define effects.
- Choose Standard Least Squares personality.
- Set emphasis on Effect Leverage.
- Run analysis for height.
- Display Summary of Fit.
- Display Analysis of Variance.
- Display Parameter Estimates.
Example 145
Summary: Fits a model with two responses, including three effects and standard least squares personality, and runs profiler and surface profiler.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :ABRASION, :HARDNESS ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Standard Least Squares ),
Run( profiler( 1 ), surface profiler( 1 ) ),
);
Code Explanation:
- Open table.
- Fit model with two responses.
- Include three effects.
- Use standard least squares personality.
- Run profiler.
- Run surface profiler.
Example 146
Summary: Fits a model with two responses, including three effects and running profiler and surface profiler, while deleting the first row from the data table.
Code:
Names Default To Here( 1 );
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :ABRASION, :HARDNESS ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Standard Least Squares ),
Run( profiler( 1 ), surface profiler( 1 ) ),
);
Data Table("data_table") << delete rows( [1] );
Code Explanation:
- Set default names.
- Open data table;
- Fit model with two responses.
- Include three effects.
- Use standard least squares.
- Run profiler.
- Run surface profiler.
- Delete first row from data_table.
Example 147
Summary: Runs a MANOVA analysis on the provided data table, generating least squares means and overall means plots with customizable marker sizes.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :Sepal length, :Sepal width, :Petal length, :Petal width ),
Effects( :Species ),
Personality( Manova ),
Run(
Response Function(
Identity, "Intercept" << {Test Details( 1 ), Centroid Plot( 1 )}, "Species" << {Test Details( 1 ), Centroid Plot( 1 )}
)
),
SendToReport(
Dispatch( {"Least Squares Means", "Overall Means"}, "FitManova LSMeans", FrameBox, {Marker Size( 2 )} ),
Dispatch( {"Least Squares Means", "Species"}, "FitManova LSMeans", FrameBox, {Marker Size( 2 )} )
)
);
Code Explanation:
- Open data table;
- Define response variables.
- Specify effect variable.
- Choose MANOVA personality.
- Run model fit.
- Set response function.
- Configure intercept test details.
- Enable intercept centroid plot.
- Configure species test details.
- Enable species centroid plot.
Example 148
Summary: Fits a mixed model to analyze sales data, incorporating # Employees and Assets as effects, with random effects and residual plots.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :Name( "Sales ($M)" ) ),
Effects( :Name( "# Employees" ), :Assets ),
Random Effects( :Type ),
Center Polynomials( 0 ),
Personality( Mixed Model ),
Run( Repeated Effects Covariance Parameter Estimates( 0 ), Residual Plots( 1 ) )
);
Code Explanation:
- Open data table;
- Define Y variable as Sales ($M).
- Include # Employees and Assets as effects.
- Set Type as random effect.
- Disable polynomial centering.
- Choose Mixed Model personality.
- Run model without repeated effects covariance.
- Generate residual plots.
Example 149
Summary: Fits a Nominal Logistic model to analyze the relationship between brand and customer preferences, utilizing frequency column and effects specification.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Freq( :count ),
Y( :brand ),
Effects(
:softness, :previous use, :softness * :previous use, :temperature, :softness * :temperature, :previous use * :temperature,
:softness * :previous use * :temperature
),
Personality( Nominal Logistic ),
Run(
Positive Level( "m" ),
Likelihood Ratio Tests( 1 ),
Wald Tests( 1 ),
Odds Ratios( 1 ),
ROC Curve( 1 ),
Lift Curve( 1 ),
Confusion Matrix( 1 ),
Confidence Intervals( 1 ),
Profiler(
1,
Term Value(
softness( "hard", Lock( 0 ), Show( 1 ) ),
previous use( "no", Lock( 0 ), Show( 1 ) ),
temperature( "low", Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table;
- Fit Nominal Logistic model.
- Set frequency column.
- Specify response variable brand.
- Define effects for model.
- Configure model personality.
- Run model analysis.
- Set positive level to "m".
- Enable Likelihood Ratio Tests.
- Enable Wald Tests.
Example 150
Summary: Fits an ordinal logistic model to a data table, specifying frequency, response, and effect variables, with confidence intervals, likelihood ratio tests, and Wald tests enabled.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Freq( :Count ),
Y( :Response ),
Effects( :Cheese ),
Personality( Ordinal Logistic ),
Run(
Confidence Intervals( 1 ),
Likelihood Ratio Tests( 1 ),
Wald Tests( 1 ),
ROC Curve( 1 ),
Lift Curve( 1 ),
Profiler( 1, Term Value( Cheese( "A", Lock( 0 ), Show( 1 ) ) ) )
)
);
Code Explanation:
- Open data table.
- Define data table variable.
- Fit ordinal logistic model.
- Specify frequency column.
- Set response variable.
- Include effect variable.
- Set model personality.
- Enable confidence intervals.
- Enable likelihood ratio tests.
- Enable Wald tests.
Example 151
Summary: Create and execute a Proportional Hazard model to analyze the relationship between 'Group' and 'days', with censoring based on 'Censor'.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model( Y( :days ), Effects( :Group ), Personality( Proportional Hazard ), Censor( :Censor ), Run( Risk Ratios( 1 ) ) );
Code Explanation:
- Open data table;
- Create Fit Model object.
- Set response variable to "days".
- Add "Group" as effect.
- Select Proportional Hazard personality.
- Specify "Censor" as censoring variable.
- Run the model.
- Generate Risk Ratios report.
Example 152
Summary: Analyze a diamond data table to identify key factors affecting price, using a standard least squares model with effect screening and profiler output.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Price ),
Effects( :Carat Weight, :Color, :Clarity, :Depth, :Table, :Cut, :Report ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
Price << Response Limits(
{Lower( 2000, 0.01 ), Middle( 3000, 1 ), Upper( 4000, 0.01 ), Goal( "Match Target" ), Importance( 1 )}
),
Arrange in Rows( 4 ),
Term Value(
Carat Weight( 0.8701, Lock( 0 ), Show( 1 ) ),
Color( "K", Lock( 0 ), Show( 1 ) ),
Clarity( "SI2", Lock( 0 ), Show( 1 ) ),
Depth( 61.7115, Lock( 0 ), Show( 1 ) ),
Table( 57.861, Lock( 0 ), Show( 1 ) ),
Cut( "Very Good", Lock( 0 ), Show( 1 ) ),
Report( "AGS", Lock( 0 ), Show( 1 ) )
)
),
:Price << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Sorted Estimates( 0 ), Scaled Estimates( 1 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual
by Predicted( 1 ), Plot Studentized Residuals( 1 ),
Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 1 )},
Automatic Recalc( 1 )
),
Local Data Filter( Mode( Include( 0 ) ), Add Filter( columns( :Report ), Where( :Report == "AGS" ) ) )
);
Code Explanation:
- Open data_table data
- Fit model with price as response.
- Include carat weight, color, clarity, depth, table, cut, report as effects.
- Use standard least squares personality.
- Set emphasis on effect screening.
- Run profiler with confidence intervals and desirability functions.
- Set price response limits and goal.
- Arrange profiler terms in rows.
- Define term values for each factor.
- Configure model output options.
Example 153
Summary: Runs a linear regression analysis to model the relationship between 'y' and 'Drug', 'x', and their interaction, with emphasis on effect leverage, and visualizes results through plots of actual vs. predicted values, residuals, and effect leverage.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :y ),
Effects( :Drug, :x, :Drug * :x ),
Personality( Standard Least Squares ),
Emphasis( Effect Leverage ),
Run( :y << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )} )
);
Code Explanation:
- Open data table;
- Define dependent variable y.
- Specify effects: Drug, x, Drug*x.
- Use Standard Least Squares personality.
- Set emphasis on Effect Leverage.
- Run model.
- Plot Actual by Predicted.
- Plot Residual by Predicted.
- Plot Effect Leverage.
Example 154
Summary: Fits a model to predict Percent Reacted based on various effects, including interactions, using Stepwise personality and customized stopping rules.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :Percent Reacted ),
Effects(
:Feed Rate, :Catalyst, :Stir Rate, :Temperature, :Concentration, :Catalyst * :Stir Rate, :Catalyst * :Concentration,
:Feed Rate * :Catalyst, :Feed Rate * :Stir Rate, :Feed Rate * :Temperature, :Feed Rate * :Concentration, :Catalyst * :Temperature,
:Stir Rate * :Temperature, :Stir Rate * :Concentration, :Temperature * :Concentration
),
Personality( Stepwise ),
Run( Stopping Rule( "P-value Threshold" ), Prob to Enter( 0.05 ), Direction( "Mixed" ), Plot Criterion History( 1 ) )
);
Code Explanation:
- Open data table.
- Define response variable.
- Specify model effects.
- Set personality to Stepwise.
- Configure stopping rule.
- Set probability to enter.
- Allow mixed direction.
- Plot criterion history.
- Run the model.
- Store model object.
Example 155
Summary: Fits a Nominal Logistic model to analyze the relationship between 'heat' and 'soak' effects on the 'ready' response, utilizing likelihood ratio tests and inverse prediction.
Code:
Open("data_table.jmp");
Fit Model(
Freq( :count ),
Y( :ready ),
Effects( :heat, :soak ),
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ), Inverse Prediction( Response( 0.9, 0.8 ), Term Value( heat( . ), soak( 2 ) ) ) )
);
Code Explanation:
- Open data table;
- Fit logistic model.
- Use count as frequency.
- Set ready as response.
- Include heat and soak effects.
- Choose Nominal Logistic personality.
- Run likelihood ratio tests.
- Disable Wald tests.
- Perform inverse prediction.
- Set response probabilities 0.9, 0.8.
- Fix heat term at mean.
- Set soak term to 2.
Example 156
Summary: Fits a model with specified effects, generates an effect summary report, and configures a profiler with confidence intervals for term value analysis.
Code:
Open("data_table.jmp");
fm = Fit Model(
Y( :y ),
Effects( :load, :flow, :load * :flow, :speed, :load * :speed, :flow * :speed, :mud, :load * :mud, :flow * :mud, :speed * :mud ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
:y << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Details( 0 ), Lack of Fit( 0 ),
Sorted Estimates( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ),
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
:load( 0, Lock( 0 ), Show( 1 ) ), :flow( 0, Max( 2 ), Lock( 0 ), Show( 1 ) ), :speed( 0, Lock( 0 ), Show( 1 ) ),
:mud( 0, Lock( 0 ), Show( 1 ) )
),
Remember Settings( "Setting 1", Differences Report( 0 ) ),
Term Value(
:load( 0, Lock( 0 ), Show( 1 ) ), :flow( 2, Max( 2 ), Lock( 0 ), Show( 1 ) ), :speed( 0.825, Lock( 0 ), Show( 1 ) ),
:mud( 0.875, Lock( 0 ), Show( 1 ) )
),
Remember Settings( "Setting 2", Differences Report( 1 ) ),
Term Value(
:load( 0, Lock( 0 ), Show( 1 ) ), :flow( 0, Max( 2 ), Lock( 0 ), Show( 1 ) ), :speed( 0, Lock( 0 ), Show( 1 ) ),
:mud( 0, Lock( 0 ), Show( 1 ) )
)
), Cube Plots( 1 ), Interaction Plots( 1 )}
),
SendToReport(
Dispatch( {"Response y"}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response y"}, "Prediction Profiler", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response y"}, "Cube Plot", OutlineBox, {Close( 1 )} )
)
);
rpt = fm << Report();
tb = rpt["Response y", "Interaction Profiles", FrameBox( 17 )];
Code Explanation:
- Open data table;
- Fit model with specified effects.
- Use standard least squares personality.
- Set emphasis on effect screening.
- Disable various fit reports.
- Enable profiler with confidence intervals.
- Set initial term values for profiler.
- Remember first profiler setting.
- Update term values for second setting.
- Remember second profiler setting with differences report.
- Retrieve final report.
- Access interaction profiles frame box.
Example 157
Summary: Fits a linear model to a data table, specifying effects and configuring summary outputs, while also generating cube plots and interaction profiles.
Code:
dt = Open("data_table.jmp");
fm = Fit Model(
Y( :y ),
Effects( :load, :flow, :load * :flow, :speed, :load * :speed, :flow * :speed, :mud, :load * :mud, :flow * :mud, :speed * :mud ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
:y << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Details( 0 ), Lack of Fit( 0 ),
Sorted Estimates( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ),
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
:load( 0, Lock( 0 ), Show( 1 ) ), :flow( 0, Max( 2 ), Lock( 0 ), Show( 1 ) ), :speed( 0, Lock( 0 ), Show( 1 ) ),
:mud( 0, Lock( 0 ), Show( 1 ) )
),
Remember Settings( "Setting 1", Differences Report( 0 ) ),
Term Value(
:load( 0, Lock( 0 ), Show( 1 ) ), :flow( 2, Max( 2 ), Lock( 0 ), Show( 1 ) ), :speed( 0.825, Lock( 0 ), Show( 1 ) ),
:mud( 0.875, Lock( 0 ), Show( 1 ) )
),
Remember Settings( "Setting 2", Differences Report( 1 ) ),
Term Value(
:load( 0, Lock( 0 ), Show( 1 ) ), :flow( 0, Max( 2 ), Lock( 0 ), Show( 1 ) ), :speed( 0, Lock( 0 ), Show( 1 ) ),
:mud( 0, Lock( 0 ), Show( 1 ) )
)
), Cube Plots( 1 ), Interaction Plots( 1 )}
),
SendToReport(
Dispatch( {"Response y"}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response y"}, "Prediction Profiler", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response y"}, "Cube Plot", OutlineBox, {Close( 1 )} )
)
);
rpt = fm << Report();
tb = rpt["Response y", "Interaction Profiles", FrameBox( 17 )];
tb << Text Color( "Red" );
Code Explanation:
- Open data table.
- Fit linear model.
- Define response variable.
- Specify effects.
- Set personality to SLR.
- Set emphasis to screening.
- Configure summary outputs.
- Enable profiler with settings.
- Generate cube plots.
- Generate interaction plots.
- Close effect summary.
- Close prediction profiler.
- Close cube plot.
- Access interaction profiles.
- Change text color to red.
Example 158
Summary: Fits a model to predict response variable 'y' using main effects and interactions, with Standard Least Squares personality and emphasis on Effect Screening.
Code:
dt = Open("data_table.jmp");
Fit Model(
Y( :y ),
Effects( :load, :flow, :load * :flow, :speed, :load * :speed, :flow * :speed, :mud, :load * :mud, :flow * :mud, :speed * :mud ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
:y << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Details( 0 ), Lack of Fit( 0 ),
Sorted Estimates( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ),
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
:load( 0, Lock( 0 ), Show( 1 ) ), :flow( 0, Max( 2 ), Lock( 0 ), Show( 1 ) ), :speed( 0, Lock( 0 ), Show( 1 ) ),
:mud( 0, Lock( 0 ), Show( 1 ) )
),
Remember Settings( "Setting 1", Differences Report( 0 ) ),
Term Value(
:load( 0, Lock( 0 ), Show( 1 ) ), :flow( 2, Max( 2 ), Lock( 0 ), Show( 1 ) ), :speed( 0.825, Lock( 0 ), Show( 1 ) ),
:mud( 0.875, Lock( 0 ), Show( 1 ) )
),
Remember Settings( "Setting 2", Differences Report( 1 ) ),
Term Value(
:load( 0, Lock( 0 ), Show( 1 ) ), :flow( 0, Max( 2 ), Lock( 0 ), Show( 1 ) ), :speed( 0, Lock( 0 ), Show( 1 ) ),
:mud( 0, Lock( 0 ), Show( 1 ) )
)
), Cube Plots( 1 ), Interaction Plots( 1 )}
),
SendToReport(
Dispatch( {"Response y"}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response y"}, "Prediction Profiler", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response y"}, "Cube Plot", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit model with response "y".
- Include main effects and interactions.
- Use Standard Least Squares personality.
- Emphasize Effect Screening.
- Disable most reports and plots.
- Enable Profiler with confidence intervals.
- Set initial term values for load, flow, speed, mud.
- Remember first setting.
- Set new term values for load, flow, speed, mud.
- Remember second setting.
- Close Effect Summary, Prediction Profiler, Cube Plot.
Example 159
Summary: Fits an ordinal logistic model to analyze the relationship between Frequency of Teeth Cleaning and demographic factors, including Gender, Birth Year, Single Status, and Age Group.
Code:
Open("data_table.jmp") << Fit Model(
Y( :Frequency of Teeth Cleaning ),
Effects( :Gender, :Birth Year, :Single Status, :Age Group ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler(
1,
Term Value(
Gender( 1, Lock( 0 ), Show( 1 ) ),
Birth Year( 1971.5, Lock( 0 ), Show( 1 ) ),
Single Status( 1, Lock( 0 ), Show( 1 ) ),
Age Group( 1, Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table;
- Fit Model dialog initiated.
- Set response variable: Frequency of Teeth Cleaning.
- Add effects: Gender, Birth Year, Single Status, Age Group.
- Select Ordinal Logistic personality.
- Run the model.
- Enable Likelihood Ratio Tests.
- Launch Profiler.
- Configure profiler settings.
- Set initial term values and show all terms.
Example 160
Summary: Runs the Fit Model process to analyze the relationship between Date, Time, Shift, and time2 variables in a data table, utilizing Nominal Logistic personality and profiling options.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Date ),
Effects( :Time, :Shift, :"Date/Time"n, :time2 ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
Time( 43260, Lock( 0 ), Show( 1 ) ),
Shift( "B", Lock( 0 ), Show( 1 ) ),
"Date/Time"n( 2882156400, Lock( 0 ), Show( 1 ) ),
time2( 54000, Lock( 0 ), Show( 1 ) )
)
)
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Initiate Fit Model process.
- Set Y variable as Date.
- Include effects: Time, Shift, Date/Time, time2.
- Use Nominal Logistic personality.
- Run model with specified options.
- Enable Likelihood Ratio Tests.
- Disable Wald Tests.
- Launch Profiler with settings.
- Close Effect Summary, Whole Model Test, Parameter Estimates reports.
Example 161
Summary: Fits a nominal logistic model to analyze the relationship between response variable ID and effects variables Female Binary and Multiple Choice Year1, with profiler enabled for term value analysis.
Code:
Open("data_table.jmp");
Fit Model(
Y( :ID ),
Effects( :Female Binary, :Multiple Choice Year1 ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 0 ),
Wald Tests( 1 ),
Profiler( 1, Term Value( Female Binary( 0.343, Lock( 0 ), Show( 1 ) ), Multiple Choice Year1( 5.9287, Lock( 0 ), Show( 1 ) ) ) )
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Wald Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit nominal logistic model.
- Set response variable.
- Include effects variables.
- Enable likelihood ratio tests.
- Enable Wald tests.
- Enable profiler.
- Set term values.
- Lock term values.
- Display profiler.
Example 162
Summary: Fits a Nominal Logistic model to analyze the relationship between Day of Week and various effects, including Month, Day of Month, Elapsed Time, Arrival Delay, and Distance.
Code:
Open("data_table.jmp") << Fit Model(
Y( :Day of Week ),
Effects( :Month, :Day of Month, :Elapsed Time, :Arrival Delay, :Distance ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 0 ),
Wald Tests( 1 ),
Profiler(
1,
Term Value(
Month( "Jan", Lock( 0 ), Show( 1 ) ),
Day of Month( 1, Lock( 0 ), Show( 1 ) ),
Elapsed Time( 139.32, Lock( 0 ), Show( 1 ) ),
Arrival Delay( 9.6, Lock( 0 ), Show( 1 ) ),
Distance( 847.7, Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table;
- Fit Nominal Logistic model.
- Set response variable: Day of Week.
- Include effects: Month, Day of Month, Elapsed Time, Arrival Delay, Distance.
- Disable Likelihood Ratio Tests.
- Enable Wald Tests.
- Launch Profiler.
- Set term values for each effect.
- Lock terms: Jan, 1, 139.32, 9.6, 847.7.
- Display all terms in profiler.
Example 163
Summary: Fits a Nominal Logistic model to analyze the relationship between response variable CROP and effects S1, S3, while generating various reports for effect summary, whole model test, lack of fit, parameter estimates, and likelihood ratio tests.
Code:
Open("data_table.jmp");
Fit Model(
Y( :CROP ),
Effects( :S1, :S3 ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler( 1, Term Value( S1( 48.08, Lock( 0 ), Show( 1 ) ), S3( 31.38, Lock( 0 ), Show( 1 ) ) ) )
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit Nominal Logistic model.
- Set response variable CROP.
- Include effects S1, S3.
- Enable Likelihood Ratio Tests.
- Disable Wald Tests.
- Launch Profiler.
- Set initial values for S1, S3.
- Display Profiler for S1, S3.
- Close Effect Summary, Whole Model Test, Lack Of Fit, Parameter Estimates, Effect Likelihood Ratio Tests reports.
Example 164
Summary: Fits a Nominal Logistic model to predict Clarity based on multiple effects, including Carat Weight, Color, Depth, Table, Cut, and Report, while enabling Likelihood Ratio Tests and running a profiler with initial term values.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Clarity ),
Effects( :Carat Weight, :Color, :Depth, :Table, :Cut, :Report ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
Carat Weight( 0.8701, Lock( 0 ), Show( 1 ) ),
Color( "J", Lock( 0 ), Show( 1 ) ),
Depth( 61.7115, Lock( 0 ), Show( 1 ) ),
Table( 57.861, Lock( 0 ), Show( 1 ) ),
Cut( "Good", Lock( 0 ), Show( 1 ) ),
Report( "AGS", Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table;
- Fit Nominal Logistic model.
- Set Clarity as response.
- Include multiple effects.
- Enable Likelihood Ratio Tests.
- Disable Wald Tests.
- Run Profiler.
- Set initial term values.
- Lock and show Carat Weight.
- Lock and show Color.
Example 165
Summary: Fits a Nominal Logistic model to analyze the relationship between Handedness and Analysis, BBQ, and Pie effects.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Handedness ),
Effects( :Analysis, :BBQ, :Pie ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
Analysis( "Generalized Regression", Lock( 0 ), Show( 1 ) ),
BBQ( "Both", Lock( 0 ), Show( 1 ) ),
Pie( "2.718", Lock( 0 ), Show( 1 ) )
)
)
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit Nominal Logistic model.
- Set response variable: Handedness.
- Include effects: Analysis, BBQ, Pie.
- Enable Likelihood Ratio Tests.
- Disable Wald Tests.
- Create Profiler.
- Configure Analysis term settings.
- Configure BBQ term settings.
- Configure Pie term settings.
Example 166
Summary: Fits a Nominal Logistic model to predict Species based on Sepal length, Sepal width, Petal length, and Petal width, with likelihood ratio tests enabled and Wald tests disabled.
Code:
Open("data_table.jmp") << Fit Model(
Y( :Species ),
Effects( :Sepal length, :Sepal width, :Petal length, :Petal width ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
Sepal length( 5.8433, Lock( 0 ), Show( 1 ) ),
Sepal width( 3.0573, Lock( 0 ), Show( 1 ) ),
Petal length( 3.758, Lock( 0 ), Show( 1 ) ),
Petal width( 1.1993, Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table;
- Fit Nominal Logistic model.
- Set response variable Species.
- Include predictor variables.
- Enable Likelihood Ratio Tests.
- Disable Wald Tests.
- Launch Profiler.
- Set term values.
- Display all terms.
- Unlock term values.
Example 167
Summary: Fits a nominal logistic model to analyze the relationship between sex and log(weight) in a data table, with interactive profiling capabilities.
Code:
Open("data_table.jmp");
Fit Model(
Y( :name ),
Effects( :sex, Log( :weight ) ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler( 1, Term Value( sex( "F", Lock( 0 ), Show( 1 ) ), weight( 141.86, Lock( 0 ), Show( 1 ) ) ) )
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} ),
Dispatch( {"Prediction Profiler"}, "Profiler", FrameBox, {Frame Size( 167, 145 )} ),
Dispatch( {"Prediction Profiler"}, "Profiler", FrameBox( 3 ), {Frame Size( 167, 145 )} )
)
);
Code Explanation:
- Open data table.
- Fit nominal logistic model.
- Set response variable.
- Include effects: sex and log(weight).
- Enable likelihood ratio tests.
- Disable Wald tests.
- Open profiler for sex and weight.
- Set initial values for sex and weight.
- Close effect summary.
- Close whole model test.
- Close lack of fit.
- Close parameter estimates.
- Close effect likelihood ratio tests.
- Resize prediction profiler frames.
Example 168
Summary: Fits a nominal logistic model to a data table, specifying effect variables and configuring term values for profiling.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :country ),
Effects( :sex, :marital status, :age, :size, :type ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
sex( "Female", Lock( 0 ), Show( 1 ) ),
marital status( "Married", Lock( 0 ), Show( 1 ) ),
age( 30.719, Lock( 0 ), Show( 1 ) ),
size( "Large", Lock( 0 ), Show( 1 ) ),
Type( "Family", Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table.
- Fit nominal logistic model.
- Set response variable.
- Specify effect variables.
- Enable likelihood ratio tests.
- Disable Wald tests.
- Launch profiler.
- Configure term values.
- Lock terms for profiling.
- Display all terms in profiler.
Example 169
Summary: Fits a nominal logistic model to analyze geographic data, with interactive profiling and likelihood ratio tests.
Code:
Open("data_table.jmp");
Fit Model(
Y( :SAS Country Office ),
Effects( :Latitude, :Longitude, :City ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
Latitude( 36.7, Min( -33.3333333333333 ), Max( 66.6666666666667 ), Lock( 0 ), Show( 1 ) ),
Longitude( 69.2, Lock( 0 ), Show( 1 ) ),
City( "Budapest", Lock( 0 ), Show( 1 ) )
)
)
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} ),
Dispatch( {"Prediction Profiler"}, "1", ScaleBox,
{Min( -33.3333333333333 ), Max( 66.6666666666667 ), Inc( 20 ), Minor Ticks( 1 )}
)
)
);
Code Explanation:
- Open data table;
- Fit nominal logistic model.
- Set response variable.
- Add predictor effects.
- Enable likelihood ratio tests.
- Disable Wald tests.
- Initialize profiler.
- Set term values for predictors.
- Configure profiler display.
- Close unnecessary report sections.
Example 170
Summary: Runs a Nominal Logistic regression analysis to model the relationship between sex and length, basilar, zygomat, and postorb variables, with profiling enabled for each term.
Code:
Open("data_table.jmp") << Fit Model(
Y( :sex ),
Effects( :length, :basilar, :zygomat, :postorb ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
Length( 6454.2, Lock( 0 ), Show( 1 ) ),
basilar( 4916.17, Lock( 0 ), Show( 1 ) ),
zygomat( 3259.92, Lock( 0 ), Show( 1 ) ),
postorb( 1091.85, Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table;
- Initiate Fit Model platform.
- Set response variable: sex.
- Include effects: length, basilar, zygomat, postorb.
- Choose Nominal Logistic personality.
- Run model analysis.
- Perform Likelihood Ratio Tests.
- Disable Wald Tests.
- Launch Profiler.
- Configure Profiler settings for each term.
Example 171
Summary: Runs a Nominal Logistic regression analysis on the JOB response variable, considering effects of BAD, LOAN, VALUE, DEBTINC, and REASON, with profiling enabled.
Code:
Open("data_table.jmp") << Fit Model(
Validation( :Validation ),
Y( :JOB ),
Effects( :BAD, :LOAN, :VALUE, :DEBTINC, :REASON ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value(
BAD( 0, Lock( 0 ), Show( 1 ) ),
LOAN( 19370, Lock( 0 ), Show( 1 ) ),
VALUE( 104180, Lock( 0 ), Show( 1 ) ),
DEBTINC( 34.11, Lock( 0 ), Show( 1 ) ),
REASON( "DebtCon", Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table;
- Initiate Fit Model platform.
- Specify validation column.
- Set response variable as JOB.
- Define effects: BAD, LOAN, VALUE, DEBTINC, REASON.
- Choose Nominal Logistic personality.
- Execute model run.
- Perform Likelihood Ratio Tests.
- Disable Wald Tests.
- Launch Profiler with specified term values.
Example 172
Summary: Fits a Nominal Logistic model to a data table, with specific effects and tests configured for analysis.
Code:
Open("data_table.jmp");
Fit Model(
Y( :"中文 (Simplified)"n ),
Effects( :age ),
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 0 ), Wald Tests( 1 ), Profiler( 1, Term Value( age( 15, Lock( 0 ), Show( 1 ) ) ) ) ),
SendToReport(
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Wald Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table.
- Fit Nominal Logistic model.
- Set response variable.
- Add age effect.
- Configure Likelihood Ratio Tests.
- Enable Wald Tests.
- Create Profiler for age.
- Set age value to 15.
- Unlock age value.
- Show age in profiler.
Example 173
Summary: Fits an ordinal logistic model to a data table, including predictor effects and likelihood ratio tests, with profiler output and report dispatch.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Number of Engines ),
Effects( :Longitude, :Fatal ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler( 1, Term Value( Longitude( -104.46, Lock( 0 ), Show( 1 ) ), Fatal( 0, Lock( 0 ), Show( 1 ) ) ) )
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Set response variable.
- Include predictor effects.
- Configure model personality.
- Run likelihood ratio tests.
- Activate profiler.
- Set term values.
- Display profiler.
- Close unnecessary reports.
Example 174
Summary: Fits an ordinal logistic model to a data table, specifying weight and response variables, defining effects, configuring likelihood ratio tests, and enabling profiler reports.
Code:
Open("data_table.jmp");
Fit Model(
Weight( :Date ),
Y( :Quarter ),
Effects( :Rooms, :Year ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler( 1, Term Value( Rooms( 77650, Lock( 0 ), Show( 1 ) ), Year( 2005, Lock( 0 ), Show( 1 ) ) ) )
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Specify weight variable.
- Set response variable.
- Define model effects.
- Configure likelihood ratio tests.
- Enable profiler.
- Set term values for Rooms and Year.
- Lock Rooms term value.
- Show profiler report.
Example 175
Summary: Fits an ordinal logistic model to a data table, including effects for height and sex, with likelihood ratio tests and profiler settings.
Code:
Open("data_table.jmp");
Fit Model(
Y( :age ),
Effects( :height, :sex ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler( 1, Term Value( height( 62.55, Lock( 0 ), Show( 1 ) ), sex( "F", Lock( 0 ), Show( 1 ) ) ) )
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Set response variable as age.
- Include height and sex as effects.
- Enable likelihood ratio tests.
- Launch profiler with specific settings.
- Set height value to 62.55.
- Set sex value to "F".
- Close effect summary report.
- Close whole model test report.
- Close lack of fit report.
- Close parameter estimates report.
- Close effect likelihood ratio tests report.
Example 176
Summary: Fits an ordinal logistic model to a data table, with likelihood ratio tests and profiler enabled for detailed analysis.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Air Bags Standard ),
Effects(
:Vehicle Category, :"Minimum Price ($1000)"n, :"City Mileage (MPG)"n, :Drive Train Type, :Manual Transmission Available,
:RPM at Max Horsepower
),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler(
1,
Term Value(
Vehicle Category( "Compact", Lock( 0 ), Show( 1 ) ),
"Minimum Price ($1000)"n( 28.85, Lock( 0 ), Show( 1 ) ),
"City Mileage (MPG)"n( 22.366, Lock( 0 ), Show( 1 ) ),
Drive Train Type( 0, Lock( 0 ), Show( 1 ) ),
Manual Transmission Available( 0, Lock( 0 ), Show( 1 ) ),
RPM at Max Horsepower( 5280.6, Lock( 0 ), Show( 1 ) )
)
)
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Set response variable.
- Define predictor effects.
- Specify ordinal logistic personality.
- Run model with likelihood ratio tests.
- Enable profiler.
- Set term values for profiler.
- Close effect summary report.
- Close whole model test report.
- Close lack of fit report.
- Close parameter estimates report.
- Close effect likelihood ratio tests report.
Example 177
Summary: Fits an ordinal logistic model to a data table, generating effect summaries and likelihood ratio tests, while configuring term values and locking them for display.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Step ID ),
Effects( :Pattern ID, :Duration ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler( 1, Term Value( Pattern ID( 2, Lock( 0 ), Show( 1 ) ), Duration( 206.48, Lock( 0 ), Show( 1 ) ) ) )
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table.
- Fit ordinal logistic model.
- Specify response variable.
- Add effect variables.
- Configure model personality.
- Run likelihood ratio tests.
- Enable profiler.
- Set term values.
- Lock term values.
- Display term values.
Example 178
Summary: Fits an Ordinal Logistic model to a data table, enabling likelihood ratio tests and prediction profiling with a locked term value.
Code:
Open("data_table.jmp") << Fit Model(
Freq( :Count ),
Y( :Response ),
Effects( :Cheese ),
Personality( "Ordinal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Profiler( 1, Term Value( Cheese( "B", Lock( 0 ), Show( 1 ) ) ) ) ),
SendToReport( Dispatch( {"Prediction Profiler"}, "Profiler", FrameBox, {Frame Size( 247, 208 )} ) )
);
Code Explanation:
- Open data table;
- Initiate Fit Model platform.
- Set frequency variable.
- Define response variable.
- Add categorical effect.
- Choose Ordinal Logistic personality.
- Run model with specified options.
- Request likelihood ratio tests.
- Enable prediction profiler.
- Lock term value for "B".
Example 179
Summary: Fits an ordinal logistic model to a data table, enabling likelihood ratio tests and profiling for four effects.
Code:
Open("data_table.jmp") << Fit Model(
Y( :Response ),
Effects( :A, :B, :C, :D ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler(
1,
Term Value(
A( 5.778, Lock( 0 ), Show( 1 ) ),
B( 5.778, Lock( 0 ), Show( 1 ) ),
C( 5.778, Lock( 0 ), Show( 1 ) ),
D( 5.778, Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Set response variable.
- Include four effects.
- Enable likelihood ratio tests.
- Launch profiler.
- Set term values.
- Unlock terms.
- Display terms.
- Execute script.
Example 180
Summary: Fits an ordinal logistic model to a data table, specifying response and effects variables, and generates various reports for analysis.
Code:
Open("data_table.jmp") << Fit Model(
Y( :Response ),
Effects( :A, :B, :C, :D ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler(
1,
Term Value(
A( 13.48, Lock( 0 ), Show( 1 ) ),
B( 4.25, Lock( 0 ), Show( 1 ) ),
C( 5.778, Lock( 0 ), Show( 1 ) ),
D( 5.778, Lock( 0 ), Show( 1 ) )
)
)
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} ),
Dispatch( {"Prediction Profiler"}, "10000", ScaleBox,
{Min( 0.0641025641025641 ), Max( 1.06410256410256 ), Inc( 1 ), Minor Ticks( 0 )}
)
)
);
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Specify response variable.
- Include effects A, B, C, D.
- Run likelihood ratio tests.
- Launch profiler.
- Set term values for A, B, C, D.
- Close effect summary.
- Close whole model test.
- Close lack of fit.
Example 181
Summary: Fits an ordinal logistic model to a data table, specifying response and predictor variables, and generating a profiler with term values.
Code:
Open("data_table.jmp") << Fit Model(
Y( :Grades ),
Effects( :Gender, :Grade, :Age, :Sports, :Money ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler(
1,
Term Value(
Gender( "girl", Lock( 0 ), Show( 1 ) ),
Grade( 5.1339, Lock( 0 ), Show( 1 ) ),
Age( 13, Lock( 0 ), Show( 1 ) ),
Sports( 3, Lock( 0 ), Show( 1 ) ),
Money( 4, Lock( 0 ), Show( 1 ) )
)
)
)
);
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Set response variable.
- Define predictor effects.
- Configure model personality.
- Run model analysis.
- Perform likelihood ratio tests.
- Generate profiler.
- Set term values.
- Display all terms.
Example 182
Summary: Fits an Ordinal Logistic model to a data table, including effects for Brush After Waking Up, Brush After Meal, and Brush, with likelihood ratio tests and profiler settings.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Floss ),
Effects( :Brush After Waking Up, :Brush After Meal, :Brush ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler(
1,
Term Value(
Brush After Waking Up( 0, Lock( 0 ), Show( 1 ) ),
Brush After Meal( 1, Lock( 0 ), Show( 1 ) ),
Brush( 3, Lock( 0 ), Show( 1 ) )
)
)
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit Ordinal Logistic model.
- Set response variable Floss.
- Include effects: Brush After Waking Up, Brush After Meal, Brush.
- Enable Likelihood Ratio Tests.
- Launch Profiler.
- Set Brush After Waking Up value to 0.
- Set Brush After Meal value to 1.
- Set Brush value to 3.
- Close unnecessary reports.
Example 183
Summary: Fits an ordinal logistic model to a data table, generating reports for effect summary, whole model test, lack of fit, parameter estimates, and likelihood ratio tests.
Code:
Open("data_table.jmp");
Fit Model(
Y( :Thread Wear ),
Effects( :Lot Number, :Method, :"Size of Load (lbs)"n, :Sand blasted?, :"Starch Content (%)"n ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler(
1,
Term Value(
Lot Number( 4, Lock( 0 ), Show( 1 ) ),
Method( "Alpha Amalyze",
Lock( 0 ),
Show( 1 )
),
"Size of Load (lbs)"n( 182.26, Lock( 0 ), Show( 1 ) ),
Sand blasted?( "no", Lock( 0 ), Show( 1 ) ),
"Starch Content (%)"n( 30.5, Lock( 0 ), Show( 1 ) )
)
)
),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Specify response variable.
- Define effects for analysis.
- Set personality to ordinal logistic.
- Run likelihood ratio tests.
- Create profiler.
- Set term values for profiler.
- Lock certain terms in profiler.
- Close unnecessary reports.
Example 184
Summary: Fits an ordinal logistic model to a data table, performing likelihood ratio tests and profiling the term value for Salt.
Code:
Open("data_table.jmp") << Fit Model(
Y( :Taste Test ),
Effects( :Salt & RS, :Salt * :Salt ),
Personality( "Ordinal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Profiler( 1, Term Value( Salt( 1.5, Lock( 0 ), Show( 1 ) ) ) ) )
);
Code Explanation:
- Open data table.
- Initiate Fit Model.
- Set response variable.
- Define effects.
- Choose Ordinal Logistic personality.
- Run model.
- Perform likelihood ratio tests.
- Enable profiler.
- Set term value for Salt.
- Display profiler.
Example 185
Summary: Runs a comprehensive analysis of the relationship between fish species and environmental factors, using a Fit Model script to generate effect summaries, studentized residuals, and box-cox transformations.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :Rating ),
Effects(
:Mullet & RS & Mixture, :Sheepshead & RS & Mixture, :Croaker & RS & Mixture, :Mullet * :Sheepshead, :Mullet * :Croaker,
:Mullet * :Temperature, :Sheepshead * :Croaker, :Sheepshead * :Temperature, :Croaker * :Temperature,
:Mullet * :Sheepshead * :Croaker, :Mullet * :Sheepshead * :Temperature, :Mullet * :Croaker * :Temperature,
:Sheepshead * :Croaker * :Temperature, :Mullet * :Sheepshead * :Croaker * :Temperature
),
No Intercept,
Center Polynomials( 0 ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 0 ),
Rating << Response Limits(
{Lower( 3.5, 0.066 ), Middle( 4.5, 0.5 ), Upper( 5.5, 0.9819 ), Goal( "Maximize" ), Importance( 1 )}
),
Maximize and Remember,
Term Value(
Mullet( 0.5, Lock( 0 ), Show( 1 ) ),
Sheepshead( 0.291622074467057, Lock( 0 ), Show( 1 ) ),
Croaker( 0.208377925532948, Lock( 0 ), Show( 1 ) ),
Temperature( 400, Lock( 0 ), Show( 1 ) )
)
),
:Rating << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Effect Details( 0 ), Lack of Fit( 0 ),
Sorted Estimates( 1 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 1 ), Plot Effect Leverage( 0 ), Box Cox Y Transformation( 1 ), Interaction Plots( 1 )}
),
SendToReport(
Dispatch( {"Response Rating"}, "Actual by Predicted Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response Rating"}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response Rating"}, "Studentized Residuals", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response Rating"}, "Box-Cox Transformations", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response Rating"}, "Sorted Parameter Estimates", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Define model with Rating as Y.
- Include multiple effects in model.
- Exclude intercept from model.
- Set polynomial centering to 0.
- Use Standard Least Squares personality.
- Emphasize effect screening.
- Run profiler with confidence intervals.
- Set response limits for Rating.
- Maximize and remember settings.
Example 186
Summary: Fits a linear mixed-effects model to analyze miles as a response variable, incorporating species, season, and interaction effects with subject:species as random effect.
Code:
dt = Open("data_table.jmp");
dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run(
:miles << {Summary of Fit( 1 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Interaction Plots( 1 )}
)
);
Code Explanation:
- Open data table;
- Fit model with miles as response.
- Include species, season, and interaction effects.
- Specify subject:species as random effect.
- Set no bounds for parameters.
- Use Standard Least Squares personality.
- Employ REML method.
- Request minimal report.
- Generate summary of fit.
- Enable interaction plots.
Example 187
Summary: Fits a mixed-effects model to analyze miles data, incorporating species and season effects, with REML estimation and minimal reporting.
Code:
Open("data_table.jmp") << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Convergence Limit( 0.0001 ),
Emphasis( "Minimal Report" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value( species( "COYOTE", Lock( 0 ), Show( 1 ) ), season( "fall", Lock( 0 ), Show( 1 ) ) )
),
:miles << {Summary of Fit( 1 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 )}
)
);
Code Explanation:
- Open data table;
- Fit a model with miles as response.
- Include species, season, and interaction effects.
- Define subject[:species] as random effects.
- Use Standard Least Squares personality.
- Employ REML method for estimation.
- Set convergence limit to 0.0001.
- Generate minimal report.
- Launch Profiler with confidence intervals.
- Display profiler for specified term values.
Example 188
Summary: Fits a linear model to predict weight, incorporating age, sex, and height effects, with emphasis on effect leverage, and generates plots for actual vs predicted, residual vs predicted, and effect leverage.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
Profiler(
1,
Term Value( age( 12, Lock( 0 ), Show( 1 ) ), sex( "F", Lock( 0 ), Show( 1 ) ), height( 62.55, Lock( 0 ), Show( 1 ) ) )
),
Cube Plots( 1 ),
:weight << {Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )}
),
SendToReport(
Dispatch( {"Response weight", "Prediction Profiler"}, "Profiler", FrameBox, {Frame Size( 161, 140 )} ),
Dispatch( {"Response weight", "Prediction Profiler"}, "Profiler", FrameBox( 3 ), {Frame Size( 161, 140 )} ),
Dispatch( {"Response weight", "Prediction Profiler"}, "Profiler", FrameBox( 5 ), {Frame Size( 161, 140 )} )
)
);
Code Explanation:
- Open data table;
- Fit linear model on weight.
- Include age, sex, height effects.
- Set personality to Standard Least Squares.
- Emphasize effect leverage.
- Run profiler for age, sex, height.
- Generate cube plots.
- Plot actual vs predicted for weight.
- Plot residual vs predicted for weight.
- Plot effect leverage for weight.
Example 189
Summary: Create and execute a Fit Model object to analyze data, specifying response variables S1 and S3, adding CROP as an effect, and running with MANOVA personality.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :S1, :S3 ),
Effects( :CROP ),
Personality( Manova ),
Run(
Response Function( Sum, Repeated( 1 ), Title( "Between Subjects" ) ),
Response Function( Contrast, Repeated( 2 ), Prefix( "Time*" ), Title( "Within Subjects" ) )
)
);
Code Explanation:
- Open data table;
- Create Fit Model object.
- Set response variables S1, S3.
- Add CROP as effect.
- Choose MANOVA personality.
- Run model.
- Define Between Subjects response function.
- Set Sum contrast type.
- Repeat 1 time.
- Title "Between Subjects".
Example 190
Summary: Generates a mixed model analysis to fit the relationship between Sales ($M) and # Employees, with Assets as an effect, using Type as a random effect, and generating residual plots.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :Name( "Sales ($M)" ) ),
Effects( :Name( "# Employees" ), :Assets ),
Random Effects( :Type ),
Center Polynomials( 0 ),
Personality( Mixed Model ),
Run( Residual Plots( 1 ) )
);
Code Explanation:
- Open data table;
- Fit mixed model analysis.
- Set Sales ($M) as response.
- Include # Employees and Assets as effects.
- Add Type as random effect.
- Disable polynomial centering.
- Use mixed model personality.
- Generate residual plots.
Example 191
Summary: Fits a linear model to predict weight based on age, sex, and height, with emphasis on effect leverage and visualization of plots.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Emphasis( Effect Leverage ),
Run(
:weight << {Normal Plot( 1 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ),
Plot Effect Leverage( 1 )}
)
);
Code Explanation:
- Open data table;
- Assign table to variable "dt under test".
- Create Fit Model object.
- Set response variable to "weight".
- Add effects: "age", "sex", "height".
- Use Standard Least Squares personality.
- Emphasize Effect Leverage.
- Run model with specified plots.
- Plot Normal Plot for weight.
- Plot Actual by Predicted for weight.
Example 192
Summary: Fits two models with transformed variables RunPulse and Oxy, using standard least squares personality and emphasizing minimal leverage.
Code:
dt = Open("data_table.jmp");
varlist = {:RstPulse, :MaxPulse};
Fit Model(
Y( Eval( varlist ) ),
Effects(
Transform Column( "X", Formula( 1 / :RunPulse + 20 ) ),
Transform Column( "X", Formula( 1 / :RunPulse + 20 ) ) * Transform Column( "X", Formula( 1 / :RunPulse + 20 ) )
),
Center Polynomials( 0 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Leverage" ),
Run( Eval( varlist ) << {Lack of Fit( 0 ), Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 0 )} )
);
Fit Model(
Y( Eval( varlist ) ),
Effects(
Transform Column( "X", Formula( 1 / :Oxy + 1000 ) ),
Transform Column( "X", Formula( 1 / :Oxy + 1000 ) ) * Transform Column( "X", Formula( 1 / :Oxy + 1000 ) )
),
Center Polynomials( 0 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Leverage" ),
Run( Eval( varlist ) << {Lack of Fit( 0 ), Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 0 )} )
);
Code Explanation:
- Open data table;
- Define variable list.
- Fit model with transformed RunPulse.
- Include squared transformed RunPulse effect.
- Set center polynomials to 0.
- Use standard least squares personality.
- Emphasize minimal leverage.
- Run model with specified plots.
- Fit model with transformed Oxy.
- Include squared transformed Oxy effect.
Example 193
Summary: Fits a model with specified effects and personalities, generating reports and clicking on button boxes to interact with the results.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :ABRASION, MODULUS ),
Effects(
:SILICA & RS, :SILANE & RS, :SULFUR & RS, :SILICA * :SILICA, :SILICA * :SILANE, :SILANE * :SILANE, :SILICA * :SULFUR,
:SILANE * :SULFUR, :SULFUR * :SULFUR
),
Personality( "Stepwise" ),
Run()
);
Report( obj[1] )[Button Box( 2 )] << Click;
rpt2 = Report( obj[1] )[Button Box( 6 )] << Click;
Report( obj[2] )[Button Box( 2 )] << click;
rpt2 = Report( obj[2] )[Button Box( 6 )] << click;
Fit Group[1] << Profiler( 1 );
rpt = Fit Group[1] << parent;
Close( dt, no save );
b test3 = {Number Edit Box( width( 9 ), decimal( 99 ), fmtdecimal( -1 ), Number( 47.536 ) ), Number Edit Box(
width( 9 ),
decimal( 99 ),
fmtdecimal( -1 ),
Number( 78.112 )
)};
Code Explanation:
- Open data table;
- Fit model with ABRASION and MODULUS as responses.
- Include specified effects in the model.
- Use Stepwise personality for fitting.
- Run the model.
- Click on second button box in report.
- Click on sixth button box in report.
- Click on second button box in second report.
- Click on sixth button box in second report.
- Create profiler for the first fit group.
Example 194
Summary: Fits a linear model to predict weight based on age, sex, and height, with interactive plots for actual vs. predicted values, residuals, and effect leverage.
Code:
dt = Open("data_table.jmp");
fm = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Run Model( :weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )} )
);
fm << Automatic Recalc( 1 );
dt << Select Where( :sex == "M" );
dt << Hide and Exclude( 1 );
Code Explanation:
- Open data table.
- Fit linear model.
- Set response variable.
- Add predictor variables.
- Choose personality method.
- Run model with plots.
- Enable automatic recalculation.
- Select rows by condition.
- Hide and exclude selected rows.
Example 195
Summary: Fits a loglinear variance model to analyze Salary data, incorporating Years at Current Employer and I am working on my career as effects, and then visualizes the results using the Profiler.
Code:
dt = Open("data_table.jmp");
fm = dt << Fit Model(
Y( :Salary ),
Effects( :Years at Current Employer ),
LogVariance Effects( :I am working on my career ),
Personality( "Loglinear Variance" ),
Run
);
dt << Delete Columns( {12, 13} );
fm << Profiler;
Code Explanation:
- Open data table.
- Fit loglinear variance model.
- Specify Salary as response.
- Include Years at Current Employer effect.
- Add I am working on my career as log variance effect.
- Run the model.
- Delete columns 12 and 13.
- Open profiler for the model.
Example 196
Summary: Fits a Partial Least Squares model to a data table, using NIPALS method with 1 factor and generating various diagnostic plots.
Code:
dt under test = Open("data_table.jmp");
obj = Fit Model(
Y( :y ),
Effects( :Drug, :x, :Drug * :x ),
No Intercept,
Personality( Partial Least Squares ),
Run(
Validation Method( KFold( 7 ), Initial Number of Factors( 6 ) ),
Fit(
Method( NIPALS ),
Number of Factors( 1 ),
Variable Importance Plot( 1 ),
Distance Plots( 1 ),
Diagnostics Plots( 1 ),
Profiler( 1 ),
Overlay Loadings Plots( 1 ),
VIP vs Coefficients Plots( 1 ),
Percent Variation Plots( 1 ),
T Square Plot( 1 ),
Overlay Coefficients Plots( 1 )
)
),
SendToReport(
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Percent Variation Explained for X Effects"}, "1", ScaleBox,
{Rotated Labels( "Vertical" )}
),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Percent Variation Explained for Y Responses"}, "1", ScaleBox,
{Rotated Labels( "Vertical" )}
),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "X Loading Plot"}, "1", ScaleBox, {Rotated Labels( "Vertical" )} ),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Y Loading Plot"}, "1", ScaleBox, {Rotated Labels( "Vertical" )} ),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Variable Importance Plot"}, "1", ScaleBox, {Rotated Labels( "Vertical" )} ),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Coefficient Plot for Centered and Scaled Data"}, "1", ScaleBox,
{Rotated Labels( "Vertical" )}
),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Coefficient Plot for Original Data"}, "1", ScaleBox,
{Rotated Labels( "Vertical" )}
)
)
);
Code Explanation:
- Open data table.
- Fit model using Partial Least Squares.
- Set response variable as :y.
- Include effects: :Drug, :x, and interaction :Drug * :x.
- Exclude intercept from model.
- Use K-Fold validation with 7 folds.
- Specify initial number of factors as 6.
- Apply NIPALS method.
- Set number of factors to 1.
- Generate various diagnostic plots.
Example 197
Summary: Fits and publishes a linear regression model to predict weight based on age, sex, and height, with minimal report output.
Code:
dt = Open("data_table.jmp");
obj = Fit Model( Y( :weight ), Effects( :age, :sex, :height ), Personality( Standard Least Squares ), Emphasis( "Minimal Report" ), Run );
mp1 = obj << Publish Prediction Formula;
mp2 = obj << Publish Prediction Formula;
Code Explanation:
- Open data table.
- Fit linear regression model.
- Set response variable.
- Define predictor variables.
- Choose regression personality.
- Minimize report output.
- Run the model.
- Publish prediction formula.
- Publish prediction formula again.
- Save published formulas.
Example 198
Summary: Analyze a linear regression model, publishing prediction formulas and performing partition analysis on a data table.
Code:
source = Open("data_table.jmp");
obj = Fit Model( Y( :weight ), Effects( :age, :sex, :height ), Personality( Standard Least Squares ), Emphasis( "Minimal Report" ), Run );
mp1 = obj << Publish Prediction Formula;
obj = Partition( Y( :weight ), X( :sex, :age, :height ), Split Best( 3 ) );
mp2 = obj << Publish Prediction Formula;
source << New Column( "Test", Formula( :height + :weight ) );
Code Explanation:
- Open data table.
- Fit linear regression model.
- Publish prediction formula.
- Perform partition analysis.
- Publish prediction formula.
- Create new column.
- Define column formula.
Example 199
Summary: Fits an ordinal logistic model to a data table, enabling likelihood ratio tests, ROC curve, lift curve, confusion matrix, and profiler analysis.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Freq( :Count ),
Y( :Response ),
Effects( :Cheese ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
ROC Curve( 1 ),
Lift Curve( 1 ),
Confusion Matrix( 1 ),
Profiler( 1, Term Value( Cheese( "A", Lock( 0 ), Show( 1 ) ) ) )
)
);
:Count << Set Property( "Missing Value Codes", 999 );
:Count << Set Values( [999, 999, 999] );
obj2 = obj << Redo Analysis;
rpt = obj2 << Report;
Code Explanation:
- Open data_table data
- Fit ordinal logistic model.
- Configure likelihood ratio tests.
- Enable ROC curve.
- Enable lift curve.
- Enable confusion matrix.
- Enable profiler.
- Set missing value codes.
- Modify count values.
- Redo analysis.
- Generate report.
Example 200
Summary: Fits and creates reports for a proportional hazard model to analyze the relationship between various factors and time-to-event data, with censoring options and likelihood tests.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :Time ),
Effects( :Cell Type, :Treatment, :Prior, :Age, :Diag Time, :KPS ),
Personality( "Proportional Hazard" ),
Censor( :censor ),
Censor Code( "1" ),
Run( Likelihood Ratio Tests( 1 ), Likelihood Confidence Intervals( 1 ), Risk Ratios( 1 ) )
);
:Time << Set Property( "Missing Value Codes", 0 );
:Time << Set Values( [0, 0, 0] );
obj2 = obj << Redo Analysis;
rpt = obj2 << Report;
Code Explanation:
- Open data table.
- Fit proportional hazard model.
- Specify response variable.
- Define model effects.
- Set censoring options.
- Configure likelihood tests.
- Modify missing value codes.
- Update time values.
- Redo analysis.
- Generate report.
Example 201
Summary: Fits a nominal logistic model to analyze lung cancer data, including smoker effect and configuring various model options.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Freq( :Count ),
Y( :Lung Cancer ),
Effects( :Smoker ),
Personality( "Nominal Logistic" ),
Run(
Positive Level( "Cancer" ),
Likelihood Ratio Tests( 1 ),
Wald Tests( 1 ),
Odds Ratios( 1 ),
ROC Curve( 1 ),
Lift Curve( 1 ),
Confusion Matrix( 1 ),
Profiler( 1, Interaction Profiler( 1 ), Term Value( Smoker( "NonSmoker", Lock( 0 ), Show( 1 ) ) ) )
)
);
:Count << Set Property( "Missing Value Codes", 999 );
:Count << Set Values( [999] );
obj2 = obj << Redo Analysis;
rpt = obj2 << Report;
Code Explanation:
- Open table.
- Fit nominal logistic model.
- Set frequency column.
- Specify response variable.
- Include smoker effect.
- Configure model options.
- Set positive level.
- Enable likelihood ratio tests.
- Enable Wald tests.
- Enable odds ratios.
Example 202
Summary: Fits a model with specified effects, excluding intercept and centering polynomials, using stepwise personality and K-Fold Crossvalidation for data_table.jmp.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :Y ),
Effects( :p1 & RS & Mixture, :p2 & RS & Mixture, :p3 & RS & Mixture, :p1 * :p2, :p1 * :p3, :p2 * :p3 ),
No Intercept( 1 ),
Center Polynomials( 0 ),
Personality( "Stepwise" ),
Run( Name( "K-Fold Crossvalidation" )(5), Plot Criterion History( 1 ), Plot RSquare History( 1 ) )
);
:Y << Set Property( "Missing Value Codes", 999 );
:Y << Set Values( [999] );
rpt1 = obj << Report;
actN1 = (rpt1[Number Col Box( 3 )][1]);
obj2 = obj << Redo Analysis;
rpt = obj2 << Report;
actN = (rpt[Number Col Box( 3 )][1]);
Code Explanation:
- Open data_table data
- Fit model with specified effects.
- Exclude intercept from model.
- Disable centering polynomials.
- Use stepwise personality.
- Perform K-Fold Crossvalidation.
- Plot criterion history.
- Plot R-Square history.
- Set missing value code for Y.
- Set Y values to missing code.
Example 203
Summary: Runs a loglinear variance analysis with specified effects, response limits, and profiler settings to optimize Shrinkage, while locking MoldTemp and Screw Speed at 0.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :Shrinkage ),
Effects( :MoldTemp, :Screw Speed, :MoldTemp * :Screw Speed ),
LogVariance Effects( :Hold Time & LogVariance ),
Personality( "Loglinear Variance" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
Prediction Intervals( 1 ),
Shrinkage << Response Limits(
{Lower( 0, 0.066 ), Middle( 35, 0.5 ), Upper( 70, 0.9819 ), Goal( "Maximize" ), Importance( 0.5 )}
),
Shrinkage Std Dev << Response Limits(
{Lower( -1, 0.9819 ), Middle( 3, 0.5 ), Upper( 7, 0.066 ), Goal( "Minimize" ), Importance( 1 )}
),
Term Value( MoldTemp( 0, Lock( 0 ), Show( 1 ) ), Screw Speed( 0, Lock( 0 ), Show( 1 ) ), Hold Time( 0, Lock( 0 ), Show( 1 ) ) )
)
)
);
:Shrinkage << Set Property( "Missing Value Codes", 999 );
:Shrinkage << Set Values( [999] );
obj2 = obj << Redo Analysis;
rpt = obj2 << Report;
expr = rpt[FrameBox( 1 )] << Get Journal;
p = "y(" + Pat Arb() >? actN + ",10,32,60,4,15,26,60,8,12";
Pat Match( expr, p );
Code Explanation:
- Open data table;
- Fit model with specified effects.
- Configure loglinear variance personality.
- Run profiler with various settings.
- Set response limits for Shrinkage.
- Set response limits for Shrinkage Std Dev.
- Lock MoldTemp and Screw Speed at 0.
- Redo analysis with updated settings.
- Retrieve report from new analysis.
- Extract journal from first frame box.
Example 204
Summary: Fits a robust model to predict Age and Weight based on Runtime, RunPulse, RstPulse, and MaxPulse variables, using Response Screening personality.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :Age, :Weight ),
Effects( :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
Robust Fit( 1 ),
Personality( "Response Screening" ),
Run
);
obj << save script to report;
rpt = Report( obj );
txt2 = rpt[Outline Box( "Fit Response Screening" )][Text Box( 2 )] << get text;
b txt2 = "Robust Fit";
Close( dt, no save );
ut relative epsilon = 1e-10;
Code Explanation:
- Open data_table data
- Define Fit Model object.
- Set response variables: Age, Weight.
- Add effects: Runtime, RunPulse, RstPulse, MaxPulse.
- Enable robust fit.
- Use Response Screening personality.
- Run the model.
- Save script to report.
- Extract report content.
- Close data table without saving.
Example 205
Summary: Fits and creates reports for two models with different robust fit settings, extracting count values from each report.
Code:
dt1 = Open("data_table.jmp");
obj1 = dt1 << Fit Model(
Y( :log2in_TMS1, :log2in_CG4847, :log2in_Adh ),
Effects( :channel, :sex, :line, :age, :sex * :line, :sex * :age, :line * :age, :sex * :line * :age ),
Personality( Response Screening ),
Robust Fit( 1 ),
Run()
);
obj1 << Overall Report( 1 );
rpt1 = obj1 << report;
count1 = rpt1["Overall Fit"][Number Col Box( "Count" )] << get as matrix;
obj2 = dt1 << Fit Model(
Y( :log2in_TMS1, :log2in_CG4847, :log2in_Adh ),
Effects( :channel, :sex, :line, :age, :sex * :line, :sex * :age, :line * :age, :sex * :line * :age ),
Personality( Response Screening ),
Robust Fit( 0 ),
Run()
);
obj2 << Overall Report( 1 );
rpt2 = obj2 << report;
count2 = rpt2["Overall Fit"][Number Col Box( "Count" )] << get as matrix;
Code Explanation:
- Open data table.
- Fit model with robust fit.
- Generate overall report.
- Extract count from report.
- Fit model without robust fit.
- Generate overall report.
- Extract count from report.
Example 206
Summary: Analyzes and creates reports for a response screening model for ABRASION and HARDNESS, extracting overall fit report matrices and generating minimal reports for each variable.
Code:
dt1 = Open("data_table.jmp");
obj = dt1 << Fit Model(
Y( :ABRASION, :HARDNESS ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Response Screening ),
Run( Overall Report( 1 ) )
);
rpt = Report( obj );
mat3 = rpt["Overall Fit"][Table Box( 1 )] << get as matrix;
obj2 = dt1 << Fit Model(
Y( :ABRASION ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run(),
);
rpt2 = Report( obj2 );
obj3 = dt1 << Fit Model(
Y( :HARDNESS ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run(),
);
rpt3 = Report( obj3 );
overall_fratio = [28.2729062923768, 22.9359458381486];
overall_pval = [0.0000012449144342723, 0.0000048880142218544];
overall_lw = [5.90486049756455, 5.31086753916814];
overall_fdrpval = [0.0000024898288685446, 0.0000048880142218544];
overall_fdrlw = [5.60383050190058, 5.31086753916814];
Close( dt1, no save );
count_mat = [];
Code Explanation:
- Open data table.
- Fit response screening model for ABRASION and HARDNESS.
- Extract overall fit report matrix.
- Fit standard least squares model for ABRASION.
- Generate minimal report for ABRASION model.
- Fit standard least squares model for HARDNESS.
- Generate minimal report for HARDNESS model.
- Define overall F-ratio, p-value, and lower width arrays.
- Close data table without saving.
- Initialize empty count matrix.
Example 207
Summary: Analyze and visualize least squares means for a response screening model, filtering data by sex and age, and extracting standard error values.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Effects( :Sex, :Oxy ), Personality( "Response Screening" ), Y( :Weight, :Age ), run );
obj1 << save Least Squares Means;
LSMEAN = Data Table("data_table");
W_F = LSMEAN << Get Rows Where( :Y == "Weight" & :Level == "F" );
W_M = LSMEAN << Get Rows Where( :Y == "Weight" & :Level == "M" );
A_F = LSMEAN << Get Rows Where( :Y == "Age" & :Level == "F" );
A_M = LSMEAN << Get Rows Where( :Y == "Age" & :Level == "M" );
LSM = LSMEAN:LSMeans[W_F |/ W_M |/ A_F |/ A_M];
SE = LSMEAN:StdError[W_F |/ W_M |/ A_F |/ A_M];
obj2 = dt << Fit Model(
Y( :Weight, :Age ),
Effects( :Sex, :Oxy ),
Personality( "Standard Least Squares" ),
Emphasis( Effect Leverage ),
run
);
Code Explanation:
- Open data table;
- Fit Response Screening model.
- Save Least Squares Means.
- Retrieve LSMeans Table.
- Filter Weight for females.
- Filter Weight for males.
- Filter Age for females.
- Filter Age for males.
- Extract LSMeans values.
- Extract StdError values.
- Fit Standard Least Squares model.
Example 208
Summary: Fits a model to predict height based on weight and sex, then saves and filters least squares means for female and male heights.
Code:
dt1 = Open("data_table.jmp");
obj1 = dt1 << Fit Model( Effects( :weight, :sex ), Personality( Response Screening ), Y( :height ), run );
obj1 << save Least Squares Means;
LSMEAN = Data Table("data_table");
H_F = LSMEAN << Get Rows Where( :Y == "height" & :Level == "F" );
H_M = LSMEAN << Get Rows Where( :Y == "height" & :Level == "M" );
Code Explanation:
- Open table.
- Fit model.
- Save least squares means.
- Access LSMeans table.
- Filter rows for female height.
- Filter rows for male height.
Example 209
Summary: Analyze SO2 data by fitting a response screening model, saving least squares means, and filtering rows for specific levels.
Code:
dt2 = Open("data_table.jmp");
obj2 = dt2 << Fit Model( Effects( :CO, :Region ), Personality( "Response Screening" ), Y( :SO2 ), run );
obj2 << save Least Squares Means;
LSMEAN = Data Table("data_table");
S_C = LSMEAN << Get Rows Where( :Y == "SO2" & :Level == "C" );
S_MW = LSMEAN << Get Rows Where( :Y == "SO2" & :Level == "MW" );
S_N = LSMEAN << Get Rows Where( :Y == "SO2" & :Level == "N" );
S_S = LSMEAN << Get Rows Where( :Y == "SO2" & :Level == "S" );
S_TX = LSMEAN << Get Rows Where( :Y == "SO2" & :Level == "TX" );
S_W = LSMEAN << Get Rows Where( :Y == "SO2" & :Level == "W" );
Code Explanation:
- Open data table;
- Fit response screening model.
- Save least squares means.
- Access LSMeans Table.
- Filter rows for SO2 and C level.
- Filter rows for SO2 and MW level.
- Filter rows for SO2 and N level.
- Filter rows for SO2 and S level.
- Filter rows for SO2 and TX level.
- Filter rows for SO2 and W level.
Example 210
Summary: Fits a robust model to predict Age and Weight based on Runtime, RunPulse, RstPulse, and MaxPulse effects, utilizing Response Screening personality.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :Age, :Weight ),
Effects( :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
Robust Fit( 1 ),
Personality( "Response Screening" ),
Run
);
obj << save script to report;
rpt = Report( obj );
txt2 = rpt[Outline Box( "Fit Response Screening" )][Text Box( 2 )] << get text;
b txt2 = "Robust Fit";
Code Explanation:
- Open data_table data
- Fit model with Age, Weight.
- Include Runtime, RunPulse, RstPulse, MaxPulse effects.
- Use robust fit method.
- Apply Response Screening personality.
- Execute the model fit.
- Save script to report.
- Generate report from object.
- Extract text from second Text Box.
- Check if text contains "Robust Fit".
Example 211
Summary: Fits and creates reports for multiple linear models for ABRASION and HARDNESS responses, with SILICA, SILANE, and SULFUR as effects, using Response Screening personality and minimal reports.
Code:
dt1 = Open("data_table.jmp");
obj = dt1 << Fit Model(
Y( :ABRASION, :HARDNESS ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Response Screening ),
Run( Overall Report( 1 ) )
);
rpt = Report( obj );
mat3 = rpt["Overall Fit"][Table Box( 1 )] << get as matrix;
obj2 = dt1 << Fit Model(
Y( :ABRASION ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run(),
);
rpt2 = Report( obj2 );
obj3 = dt1 << Fit Model(
Y( :HARDNESS ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run(),
);
rpt3 = Report( obj3 );
overall_fratio = [28.2729062923768, 22.9359458381486];
overall_pval = [0.0000012449144342723, 0.0000048880142218544];
overall_lw = [5.90486049756455, 5.31086753916814];
overall_fdrpval = [0.0000024898288685446, 0.0000048880142218544];
overall_fdrlw = [5.60383050190058, 5.31086753916814];
Code Explanation:
- Open data table;
- Fit model with ABRASION and HARDNESS as responses.
- Include SILICA, SILANE, SULFUR as effects.
- Use Response Screening personality.
- Generate overall report.
- Extract overall fit matrix.
- Fit model for ABRASION using Standard Least Squares.
- Generate minimal report.
- Fit model for HARDNESS using Standard Least Squares.
- Generate minimal report.
Example 212
Summary: Fits and creates reports for two models with different fit types, utilizing Response Screening personality and extracting effect test results as matrices.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Effects( :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
Personality( "Response Screening" ),
Y( :Age, :Weight ),
Robust Fit( 1 ),
Run
);
rpt = obj << report;
colnames = rpt["Effect Tests"][Table Box( 1 )] << get names;
tests1 = rpt["Effect Tests"][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model(
Effects( :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
Personality( "Response Screening" ),
Y( :Age, :Weight ),
Cauchy Fit( 1 ),
Run
);
rpt2 = obj2 << report;
colnames2 = rpt2["Effect Tests"][Table Box( 1 )] << get names;
tests2 = rpt2["Effect Tests"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit model with specified effects.
- Set personality to Response Screening.
- Define response variables: Age, Weight.
- Enable robust fitting.
- Run the first model.
- Retrieve report from first model.
- Extract column names from effect tests.
- Get effect test results as matrix.
- Repeat steps 2-9 with Cauchy fit instead of robust fit.
Example 213
Summary: Fits and creates reports for a response screening model, extracting effect tests and sorting by F Ratio.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :ABRASION, :MODULUS ),
Effects( :SILICA, :SILANE, :SULFUR ),
Switch( :ELONG, :HARDNESS ),
Personality( "Response Screening" ),
Run
);
rpt = obj << report;
rpt["Effect Tests"][Table Box( 1 )] << Sort by Column( "F Ratio" );
b col1 = rpt["Effect Tests"][Table Box( 1 )][String Col Box( 1 )] << get;
b col2 = rpt["Effect Tests"][Table Box( 1 )][String Col Box( 2 )] << get;
b col3 = rpt["Effect Tests"][Table Box( 1 )][String Col Box( 3 )] << get;
b mtrx1 = rpt["Effect Tests"][Table Box( 1 )] << get as matrix;
dt2 = obj << Save Effect Tests;
dt3 = dt2 << Sort( By( :F Ratio ), Order( Descending ) );
col1 = dt3:Y << get values;
col2 = dt3:Switch << get values;
col3 = dt3:Effect << get values;
mtrx1 = dt3 << get as matrix;
Close( dt, no save );
Code Explanation:
- Open data table;
- Fit response screening model.
- Set Y variables: ABRASION, MODULUS.
- Include effects: SILICA, SILANE, SULFUR.
- Use ELONG to switch personality.
- Run the model.
- Extract report object.
- Sort effect tests by F Ratio.
- Retrieve columns from effect tests table.
- Save effect tests to new dataset.
- Sort new dataset by F Ratio descending.
- Extract sorted column values.
- Convert sorted data to matrix.
- Close original dataset without saving.
Example 214
Summary: Fits a response screening model to data, extracting effect tests reports, and re-fitting the model with modified data selection.
Code:
dt1 = Open("data_table.jmp");
dt1:v1[1 :: 3] = .;
dt1:ls[4 :: 6] = .;
obj1 = dt1 << Fit Model( Y( :ls ), Effects( :v1 ), Personality( "Response Screening" ), Run );
rpt1 = obj1 << report;
test1 = rpt1["Effect Tests"][Table Box( 1 )] << get as matrix;
dt1 << Clear Row States;
dt1 << Select Rows( 1 :: 6 );
dt1 << Exclude( 1 );
obj2 = dt1 << Fit Model( Y( :ls ), Effects( :v1 ), Personality( "Response Screening" ), Run );
rpt2 = obj2 << report;
test2 = rpt2["Effect Tests"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Set first three v1 values to missing.
- Set fourth to sixth ls values to missing.
- Fit response screening model with ls as Y and v1 as effect.
- Extract effect tests report from first model.
- Clear row states in data table.
- Select first six rows in data table.
- Exclude first row from selection.
- Fit response screening model again with ls as Y and v1 as effect.
- Extract effect tests report from second model.
Example 215
Summary: Runs the Fit Model dialog to analyze miles data, specifying species, season, and interaction effects with random subject[:species] effects, and generates a report.
Code:
dt = Open("data_table.jmp");
dlg = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Response Screening" ),
);
dlgrpt = dlg << report;
Try(
check0 = dlgrpt[Button Box( 1 )] << get button name;
check1 = dlgrpt[Button Box( 2 )] << get button name;
check2 = dlgrpt[Button Box( 3 )] << get button name;
check3 = dlgrpt[Button Box( 4 )] << get button name;
check4 = dlgrpt[Button Box( 5 )] << get button name;
check5 = dlgrpt[Button Box( 6 )] << get button name;
check6 = dlgrpt[TabListBox( 1 )][Tab Page Box( 1 )] << get title;
check7 = dlgrpt[TabListBox( 1 )][Tab Page Box( 2 )] << get title;
check8 = dlgrpt[TabListBox( 1 )][Tab Page Box( 2 )][Button Box( 4 )] << get button name;
check9 = dlgrpt[TabListBox( 1 )][Tab Page Box( 2 )][Text Box( 2 )] << get text;
);
IsPro = 1;
log1 = Log Capture(
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Response Screening" ),
Run
)
);
If( IsPro,
rpt = obj << report;
title1 = rpt[Outline Box( 1 )] << get title;
title2 = rpt[Outline Box( 2 )] << get title;
title3 = rpt[Outline Box( 3 )] << get title;
title4 = rpt[Outline Box( 4 )] << get title;
title5 = rpt[Outline Box( 5 )] << get title;
title6 = rpt[Outline Box( 6 )] << get title;
title7 = rpt[Outline Box( 7 )] << get title;
,
);
Code Explanation:
- Open data table;
- Launch Fit Model dialog.
- Set response variable to miles.
- Add species, season, and interaction effects.
- Specify subject[:species] as random effects.
- Use Response Screening personality.
- Generate report from dialog.
- Attempt to retrieve button names and titles.
- Set IsPro to 1.
- Capture log of Fit Model run.
Example 216
Summary: Fits and creates reports for a linear model with age as response, including effects for sex and marital status, and subgroups by country, size, and type.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :age ),
Effects( :sex, :marital status ),
Personality( "Response Screening" ),
Subgroup( :country, :size, :type ),
Run( Unthreaded, Overall Report( 1 ) )
);
rpt1 = obj1 << report;
effecttests = rpt1["Effect Tests"][Table Box( 1 )] << get as matrix;
test subgroup = rpt1["Effect Tests"][String Col Box( "Subgroup" )] << get;
effect label = rpt1["Effect Tests"][String Col Box( "Effect" )] << get;
sig rpt = rpt1["FDR PValue Plot Effects"][Table Box( 1 )] << get as matrix;
sig rpt colname = rpt1["FDR PValue Plot Effects"][Table Box( 1 )] << get names;
sig rpt label = rpt1["FDR PValue Plot Effects"][String Col Box( 1 )] << get;
parmest = rpt1["Parameter Estimates"][Table Box( 1 )] << get as matrix;
overallfit = rpt1["OverallFit"][Table Box( 1 )] << get as matrix;
obj1 << Least Squares Means( 1 );
lsmeans = rpt1["Least Squares Means"][Table Box( 1 )] << get as matrix;
dt effecttests = obj1 << Save Effect Tests;
dt effecttests2 = dt effecttests << Sort( By( :FDR Logworth ), Order( Descending ), );
s1 = Random Integer( 1, 20 );
dt effecttests << Select Where( Row() == s1 );
s2 = (dt effecttests << get as matrix)[s1, 0];
s3 = rpt1["Effect Tests"][Table Box( 1 )] << get selected rows;
s4 = ((dt tmp = rpt1["Effect Tests"][Table Box( 1 )] << Make into data table) << get as matrix)[s3, 0];
Close( dt tmp, no save );
Close( dt effecttests, no save );
Close( dt effecttests2, no save );
dt overallfit = obj1 << Save Overall Fit;
dt overallfit2 = dt overallfit << Sort( By( :RSquare ), Order( Descending ), );
Close( dt overallfit, no save );
Close( dt overallfit2, no save );
dt estimates = obj1 << Save Estimates;
Close( dt estimates, no save );
dt lsmeans = obj1 << Save Least Squares Means;
Close( dt lsmeans, no save );
dt lsmeans diff = obj1 << Save LSMeans Differences;
Code Explanation:
- Open data table;
- Fit model with age as response.
- Include sex and marital status effects.
- Use Response Screening personality.
- Define subgroups by country, size, type.
- Run model unthreaded, show overall report.
- Extract effect tests report.
- Get effect test matrix, subgroup, labels.
- Extract FDR PValue plot effects.
- Get parameter estimates, overall fit.
Example 217
Summary: Analyze and visualize a fitted model, extracting effect tests, parameter estimates, and FDR PValue plot effects from a JMP data table.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :age ),
Effects( :sex, :marital status ),
Personality( "Response Screening" ),
Subgroup( :country, :size, :type ),
Run( Unthreaded, Overall Report( 1 ) )
);
rpt1 = obj1 << report;
effecttests = rpt1["Effect Tests"][Table Box( 1 )] << get as matrix;
test subgroup = rpt1["Effect Tests"][String Col Box( "Subgroup" )] << get;
effect label = rpt1["Effect Tests"][String Col Box( "Effect" )] << get;
sig rpt = rpt1["FDR PValue Plot Effects"][Table Box( 1 )] << get as matrix;
sig rpt colname = rpt1["FDR PValue Plot Effects"][Table Box( 1 )] << get names;
sig rpt label = rpt1["FDR PValue Plot Effects"][String Col Box( 1 )] << get;
parmest = rpt1["Parameter Estimates"][Table Box( 1 )] << get as matrix;
overallfit = rpt1["OverallFit"][Table Box( 1 )] << get as matrix;
obj1 << Least Squares Means( 1 );
lsmeans = rpt1["Least Squares Means"][Table Box( 1 )] << get as matrix;
dt effecttests = obj1 << Save Effect Tests;
dt effecttests2 = dt effecttests << Sort( By( :FDR Logworth ), Order( Descending ), );
s1 = Random Integer( 1, 20 );
dt effecttests << Select Where( Row() == s1 );
s2 = (dt effecttests << get as matrix)[s1, 0];
s3 = rpt1["Effect Tests"][Table Box( 1 )] << get selected rows;
s4 = ((dt tmp = rpt1["Effect Tests"][Table Box( 1 )] << Make into data table) << get as matrix)[s3, 0];
Code Explanation:
- Open table.
- Fit model with response screening.
- Extract effect tests report.
- Get effect tests matrix.
- Get subgroup names.
- Get effect labels.
- Extract FDR PValue plot effects.
- Get FDR PValue plot column names.
- Get FDR PValue plot labels.
- Extract parameter estimates.
Example 218
Summary: Fits and creates reports for multiple linear regression models with varying robustness and switching techniques, utilizing JMP's Fit Model platform.
Code:
dt = Open("data_table.jmp");
dt:LDL[3 :: 10] = .;
obj1 = dt << Fit Model( Y( :Y ), Effects( :Gender, :BMI, :BP, :LDL ), Personality( "Response Screening" ), Robust Fit( 1 ), Run );
rpt1 = obj1 << report;
test1 = rpt1["Effect Tests"][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model( Y( :Y ), Effects( :Gender, :BMI, :BP ), Switch( :LDL ), Personality( "Response Screening" ), Robust Fit( 1 ), Run );
rpt2 = obj2 << report;
test2 = rpt2["Effect Tests"][Table Box( 1 )] << get as matrix;
obj3 = dt << Fit Model( Y( :Y ), Effects( :Gender, :BMI, :BP, :LDL ), Personality( "Response Screening" ), Cauchy Fit( 1 ), Run );
rpt3 = obj3 << report;
test3 = rpt3["Effect Tests"][Table Box( 1 )] << get as matrix;
obj4 = dt << Fit Model( Y( :Y ), Effects( :Gender, :BMI, :BP ), Switch( :LDL ), Personality( "Response Screening" ), Cauchy Fit( 1 ), Run );
rpt4 = obj4 << report;
test4 = rpt4["Effect Tests"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Set LDL values 3-10 to missing.
- Fit model with Gender, BMI, BP, LDL.
- Use Response Screening personality.
- Enable Robust Fit.
- Run the model.
- Extract Effect Tests report.
- Store results in test1.
- Fit model with Gender, BMI, BP.
- Include LDL with Switch.
- Use Response Screening personality.
- Enable Robust Fit.
- Run the model.
- Extract Effect Tests report.
- Store results in test2.
- Fit model with Gender, BMI, BP, LDL.
- Use Response Screening personality.
- Enable Cauchy Fit.
- Run the model.
- Extract Effect Tests report.
- Store results in test3.
- Fit model with Gender, BMI, BP.
- Include LDL with Switch.
- Use Response Screening personality.
- Enable Cauchy Fit.
- Run the model.
- Extract Effect Tests report.
- Store results in test4.
Example 219
Summary: Fits a model to a data table, extracting effect tests reports, and calculating FDR-adjusted p-values for multiple responses.
Code:
dt1 = Open("data_table.jmp");
obj1 = Fit Model(
Y( :log2in_TMS1, :log2in_CG4847, :log2in_Adh ),
Effects( :sex, :age, :sex * :age ),
Personality( Response Screening ),
Run( Overall Report( 1 ) )
);
rpt1 = Report( obj1 );
pval1 = rpt1[Outline Box( "Effect Tests" )][Number Col Box( 2 )] << get as matrix;
pval1 = [1.85315633052524e-17, 0.0071580086985955, 0.47325845287857, 0.398869746093294, 0.454490666280177, 0.536170020793328,
0.93428866011056, 0.737894301019547, 0.89528622789438];
obj2 = dt1 << Fit Model(
Y( :log2in_TMS1, :log2in_CG4847, :log2in_Adh ),
Effects( :sex, :age, :sex * :age ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run(),
);
rpt2 = Report( obj2 );
ylst = {"log2in_TMS1", "log2in_CG4847", "log2in_Adh"};
pval2 = [];
For( i = 1, i <= N Items( ylst ), i++,
ylabel = "Response " || ylst[i];
pval2 |/= (rpt2[Outline Box( ylabel )][Outline Box( "Effect Tests" )][Number Col Box( 6 )] << get as matrix);
);
pval2;
pval2 = [1.85315633052524e-17, 0.0071580086985955, 0.47325845287857, 0.398869746093294, 0.454490666280177, 0.536170020793328,
0.93428866011056, 0.737894301019547, 0.89528622789438];
lw = -Log( pval2 ) / Log( 10 );
fdr pval2 = [0.804255031189991, 0.934288660110561, 0.804255031189991, 1.66784069747265e-16, 0.934288660110561, 0.0322110391436796,
0.804255031189991, 0.934288660110561, 0.804255031189991];
fdr lw = -Log( fdr pval2 ) / (Log( 10 ));
rank frac = Loc Sorted( Sort Ascending( fdr pval2 ), fdr pval2 ) / N Rows( fdr pval2 );
Code Explanation:
- Open data table.
- Fit model with response screening.
- Extract effect tests report.
- Assign fixed p-values.
- Fit model with standard least squares.
- Extract effect tests report.
- Initialize response list.
- Initialize p-values list.
- Loop through responses.
- Extract and append p-values.
Example 220
Summary: Fits and analyzes a generalized linear mixed model, extracting random effects covariance parameters, fixed effects parameter estimates, standard errors, tests, and prediction formula.
Code:
dt = Open("data_table.jmp");
obj1 = Fit Model(
Y( :Y ),
Effects( :Age & Excluded, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Random Effects( :Gender, :BP & BSpline( 3, Degree( 3 ) ) ),
Personality( "Generalized Linear Mixed Model" ),
Run
);
rpt1 = obj1 << report;
covparms = rpt1["Random Effects Covariance Parameter Estimates"][Table Box( 1 )] << get as matrix;
parmest1 = rpt1["Fixed Effects Parameter Estimates"][Tab Page Box( 1 )][Table Box( 1 )] << get as matrix;
scl = rpt1["Fixed Effects Parameter Estimates"][Table Box( 2 )] << get as matrix;
tests3 = rpt1["Fixed Effects Tests"][Table Box( 1 )] << get as matrix;
obj1 << (Fit[1] << Sequential Tests( 1 ));
tests1 = rpt1["Sequential (Type1) Tests"][Table Box( 1 )] << get as matrix;
obj1 << (Fit[1] << Prediction Formula);
obj1 << (Fit[1] << Standard Error of Predicted);
obj1 << (Fit[1] << Mean Confidence Interval);
obj1 << (Fit[1] << Save Residual Formula);
obj1 << (Fit[1] << Prediction and Interval Formulas);
obj1 << (Fit[1] << Conditional Prediction Formula);
obj1 << (Fit[1] << Standard Error of Conditional Predicted);
obj1 << (Fit[1] << Conditional Mean CI);
obj1 << (Fit[1] << Save Conditional Residual Formula);
saved1 = (dt << get as matrix)[0, 13 :: 25];
obj1 << Save Script to Report;
savedscript1 = rpt1[Text Box( 1 )] << get text;
obj1 << (Fit[1] << Covariance of Fixed Effects( 1 ));
covb = rpt1["Covariance of Fixed Effects"][Matrix Box( 1 )] << get;
obj1 << (Fit[1] << Correlation of Fixed Effects( 1 ));
corrb = rpt1["Correlation of Fixed Effects"][Matrix Box( 1 )] << get;
Code Explanation:
- Open data table;
- Fit generalized linear mixed model.
- Extract random effects covariance parameters.
- Extract fixed effects parameter estimates.
- Extract fixed effects standard errors.
- Extract fixed effects tests.
- Perform sequential tests.
- Extract sequential tests results.
- Generate prediction formula.
- Save script to report.
Example 221
Summary: Fits loglinear variance models to analyze height data, grouping by age and saving residuals.
Code:
dt = Open("data_table.jmp");
dt:height[38 :: 40] = .;
Fit Model(
Y( :height ),
Effects( :weight & LogVariance ),
Personality( Loglinear Variance ),
By( :age ),
Run Model( Save Columns( Residuals ) )
);
Fit Model(
Y( :height ),
Effects( :weight & LogVariance ),
Personality( Loglinear Variance ),
By( :age ),
Run Model( Save Columns( Residuals ) )
);
Code Explanation:
- Open data table;
- Set height values 38-40 to missing.
- Fit loglinear variance model.
- Use height as response variable.
- Include weight & LogVariance effect.
- Group by age.
- Save residuals to dataset.
- Repeat steps 3-7.
Example 222
Summary: Fits a log-linear variance model to predict shrinkage, incorporating MoldTemp, Screw Speed, and interaction effects, with prediction profiler generation and confidence interval extraction.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Shrinkage ),
Effects( :MoldTemp, :Screw Speed, :MoldTemp * :Screw Speed, :Hold Time & LogVariance ),
Personality( Loglinear Variance ),
Run( Profiler( 1, Confidence Intervals( 1 ), Prediction Intervals( 1 ), Desirability Functions( 0 ) ) )
);
rpt = obj << report;
obj << Save Columns( Prediction Formula, Mean Confidence Interval, Indiv Confidence Interval, Std Dev Formula );
b test1 = (dt << get as matrix)[20, 9 :: 13];
pred1 = rpt["Prediction Profiler"][AxisBox( 1 )][Text Box( 2 )] << get text;
ci1 = (rpt["Prediction Profiler"][AxisBox( 1 )][Text Box( 3 )] << get text) || (rpt["Prediction Profiler"][AxisBox( 1 )][Text Box( 4 )] <<
get text);
pi1 = rpt["Prediction Profiler"][AxisBox( 1 )][Text Box( 5 )] << get text;
pred2 = rpt["Prediction Profiler"][AxisBox( 2 )][Text Box( 2 )] << get text;
b test2 = (dt << get as matrix)[20, 14];
ci2 = (rpt["Prediction Profiler"][AxisBox( 2 )][Text Box( 3 )] << get text) || (rpt["Prediction Profiler"][AxisBox( 2 )][Text Box( 4 )] <<
get text);
pi2 = rpt["Prediction Profiler"][AxisBox( 2 )][Text Box( 5 )] << get text;
Code Explanation:
- Open data_table data
- Fit log-linear variance model.
- Include Shrinkage as response.
- Add MoldTemp, Screw Speed, and interaction effects.
- Enable Hold Time & LogVariance.
- Generate prediction profiler.
- Extract report object.
- Save prediction formulas and confidence intervals.
- Retrieve specific coefficients from data table.
- Extract prediction and interval texts from profiler.
Example 223
Summary: Fits a linear model to a data table, extracting parameter estimates and uncoded estimates.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Number Popped ),
Effects( :Time, :Power, :Time * :Power, :Time * :Time, :Power * :Power ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run()
);
rpt1 = obj1 << report;
est1 = rpt1["Parameter Estimates"][Number Col Box( "Estimate" )] << get as matrix;
uncoded est1 = rpt1[Number Col Box( "Uncoded Estimate" )] << get as matrix;
obj1 << Prediction formula;
test1 = Items( Char( Simplify Expr( dt:Pred Formula Number Popped << get formula ), "+" ) );
b uncoded est1 = [-2687.92062050198, 792.113681198563, 356.777416178866, -14.0833420977742, -74.88343240098, -20.6392935079174];
Code Explanation:
- Open data table.
- Fit linear model.
- Set response variable.
- Define model effects.
- Choose personality.
- Set emphasis.
- Run the model.
- Get report object.
- Extract parameter estimates.
- Extract uncoded estimates.
Example 224
Summary: Fits a linear model, retrieving and updating effect summary reports, and enabling/disabling checkboxes in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model( Y( :y ), Effects( :Drug, :x, :Drug * :x ), Personality( "Standard Least Squares" ), Run( FDR( 1 ) ) );
rpt = Report( obj );
show1 = rpt[Outline Box( "Whole Model" )][If Box( 1 )] << get;
ckbox = rpt[Outline Box( "Effect Summary" )][CheckBoxBox( 1 )] << get;
obj << Effect Summary( 0 );
show2 = (rpt[Outline Box( "Effect Summary" )] << Parent) << get;
obj << Effect Summary( 1 );
Code Explanation:
- Open data table;
- Fit linear model.
- Retrieve whole model report.
- Retrieve effect summary checkbox state.
- Disable effect summary.
- Retrieve updated effect summary report.
- Enable effect summary.
Example 225
Summary: Fits and creates reports for two models with ls as response, utilizing Fit Model and Report features in JMP.
Code:
dt1 = Open("data_table.jmp");
obj1 = Fit Model(
Y( :ls ),
Emphasis( "Minimal Report" ),
Effects(
Grouped(
: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
)
),
Run
);
rpt1 = obj1 << report;
obj2 = Fit Model(
Y( :ls ),
Emphasis( "Minimal Report" ),
Effects(
: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
),
Run
);
rpt2 = obj2 << report;
parmest1 = rpt1[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix;
parmest2 = rpt2[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit model with ls as response.
- Set emphasis to minimal report.
- Group all variables as effects.
- Run the first model.
- Retrieve report from first model.
- Fit another model with ls as response.
- Set emphasis to minimal report.
- List all variables as effects.
- Run the second model and retrieve its report.
Example 226
Summary: Fits a model to a transformed response variable, incorporating multiple effects and generating a minimal report with confidence and prediction intervals.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( Transform Column( "Log[Y]", Formula( Log( :Y ) ) ) ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1, Confidence Intervals( 1 ), Prediction Intervals( 1 ), Arrange in Rows( 4 ), Set to Data in Row( 2 ) ) )
);
obj << Save Columns( Prediction Formula, Mean Confidence Limit Formula, Indiv Confidence Limit Formula );
rpt = obj << report;
pred1 = rpt["Prediction Profiler"][Text Box( 2 )] << get text;
ci1 = (rpt["Prediction Profiler"][Text Box( 3 )] << get text) || (rpt["Prediction Profiler"][Text Box( 4 )] << get text);
pi1 = rpt["Prediction Profiler"][Text Box( 5 )] << get text;
b test1 = (dt << get as matrix)[2, 13 :: 17];
Code Explanation:
- Open data table;
- Fit model using transformed Y.
- Include multiple effects in model.
- Use Standard Least Squares personality.
- Generate minimal report.
- Run profiler with confidence and prediction intervals.
- Save prediction and confidence limit formulas.
- Retrieve report object.
- Extract prediction profiler text.
- Concatenate confidence interval texts.
- Extract prediction interval text.
- Get beta test results from dataset.
Example 227
Summary: Fits a model with specified effects and generates a prediction profiler report, including confidence and prediction intervals.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Y ),
Freq( :Gender ),
Effects( :Age, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1, Confidence Intervals( 1 ), Prediction Intervals( 1 ), Arrange in Rows( 4 ), Set to Data in Row( 2 ) ) )
);
obj << Save Columns( Prediction Formula, Mean Confidence Limit Formula, Indiv Confidence Limit Formula );
rpt = obj << report;
pred1 = rpt["Prediction Profiler"][Text Box( 2 )] << get text;
ci1 = (rpt["Prediction Profiler"][Text Box( 3 )] << get text) || (rpt["Prediction Profiler"][Text Box( 4 )] << get text);
pi1 = rpt["Prediction Profiler"][Text Box( 5 )] << get text;
b test1 = (dt << get as matrix)[2, 13 :: 17];
Code Explanation:
- Open data table;
- Fit model with Y as response.
- Use Gender as frequency.
- Include specified effects in model.
- Choose Standard Least Squares personality.
- Generate minimal report.
- Run profiler with confidence and prediction intervals.
- Save prediction and confidence limit formulas.
- Extract prediction profiler report.
- Retrieve text from specific text boxes.
Example 228
Summary: Fits a linear model to predict continuous outcomes, utilizing multiple effects and confidence intervals, while generating reports with minimal emphasis.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Y ),
Weight( :Gender ),
Effects( :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1, Confidence Intervals( 1 ), Prediction Intervals( 1 ), Arrange in Rows( 4 ), Set to Data in Row( 1 ) ) )
);
obj << Save Columns( Prediction Formula, Mean Confidence Limit Formula, Indiv Confidence Limit Formula );
rpt = obj << report;
pred1 = rpt["Prediction Profiler"][Text Box( 2 )] << get text;
ci1 = (rpt["Prediction Profiler"][Text Box( 3 )] << get text) || (rpt["Prediction Profiler"][Text Box( 4 )] << get text);
pi1 = rpt["Prediction Profiler"][Text Box( 5 )] << get text;
b test1 = (dt << get as matrix)[1, 13 :: 17];
Code Explanation:
- Open data table;
- Fit linear model.
- Specify response variable Y.
- Use Gender as weight.
- Include multiple effects.
- Choose Standard Least Squares personality.
- Minimal report emphasis.
- Run profiler with intervals.
- Save prediction columns.
- Extract profiler texts.
Example 229
Summary: Fits a linear model to data, generating prediction columns and saving them for further analysis.
Code:
dt = Open("data_table.jmp");
dlg = dt << Fit Model( Y( :y ), Effects( :Drug, :x, :Drug * :x ), Personality( Standard Least Squares ), Emphasis( Effect Screening ) );
obj = dlg << Run Model(
:y << {Scaled Estimates( 1 ), Plot Actual by Predicted( 1 ), Plot Regression( 1 ), Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 ), Sequential Tests( 1 ), Press( 1 ), Durbin Watson Test( 1 )}
);
obj << save columns(
predicted values, residuals, mean confidence interval, indiv confidence interval, studentized residuals, hats, std error of predicted,
std error of residual, std error of individual, cook's d influence
);
rpt = Report( obj );
fitstat = rpt[Outline Box( "Summary of Fit" )][Table Box( 1 )] << get as matrix;
obj << Analysis of Variance( 1 );
anova1 = rpt[Outline Box( "Analysis of Variance" )][Table Box( 1 )] << get as matrix;
anova2 = rpt[Outline Box( "Analysis of Variance" )][Number Col Box( 4 )] << get as matrix;
anova3 = rpt[Outline Box( "Analysis of Variance" )][Number Col Box( 5 )] << get as matrix;
parms = rpt[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix;
type3 = rpt[Outline Box( "Effect Tests" )][Table Box( 1 )] << get as matrix;
b eta2 = type3[0, 3] :/ anova1[3, 2];
b omega2 = (type3[0, 3] - type3[0, 2] :* anova1[2, 3]) / (anova1[3, 2] + anova1[2, 3]);
type1 = rpt[Outline Box( "Sequential (Type 1) Tests" )][Table Box( 1 )] << get as matrix;
press = rpt[Outline Box( "Press" )][Table Box( 1 )] << get as matrix;
dw = rpt[Outline Box( "Durbin-Watson" )][Table Box( 1 )] << get as matrix;
obj << Plot Effect Leverage( 1 );
obj << Plot Residual by Normal Quantiles( 1 );
plot y1 = (rpt[Outline Box( "Residual Normal Quantile Plot" )][FrameBox( 1 )] << Find Seg( Marker Seg( 1 ) )) << get y values;
plot x1 = (rpt[Outline Box( "Residual Normal Quantile Plot" )][FrameBox( 1 )] << Find Seg( Marker Seg( 1 ) )) << get x values;
Code Explanation:
- Open data table;
- Launch Fit Model dialog.
- Set response variable.
- Specify model effects.
- Choose Standard Least Squares personality.
- Emphasize effect screening.
- Run the model.
- Save prediction columns.
- Retrieve report object.
- Extract summary of fit statistics.
Example 230
Summary: Creates and analyzes a linear model to predict weight based on age, sex, and height, with optional Box-Cox transformation.
Code:
Open("data_table.jmp");
obj1 = Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run
);
rpt1 = obj1 << report;
check1 = (rpt1["Box-Cox Transformations"] << parent) << Get;
If( check1 == 0,
obj1 << Box Cox Y Transformation( 1 );
check2 = (rpt1["Box-Cox Transformations"] << parent) << Get;
);
Code Explanation:
- Open data table.
- Create Fit Model object.
- Set response variable.
- Add effect variables.
- Choose personality.
- Set emphasis.
- Run the model.
- Generate report object.
- Check for Box-Cox transformation.
- Apply Box-Cox transformation if needed.
Example 231
Summary: Fits a standard least squares model with effect screening, retrieving and extracting the Box-Cox transformations section from the report.
Code:
dt2 = Open("data_table.jmp");
obj2 = Fit Model(
Y( :Y ),
Effects( :load, :flow, :load * :flow, :speed, :load * :speed, :flow * :speed, :mud, :load * :mud, :flow * :mud, :speed * :mud ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run
);
rpt2 = obj2 << report;
check1 = (rpt2["Box-Cox Transformations"] << parent) << Get;
title1 = (rpt2["Box-Cox Transformations"] << parent)[Outline Box( 1 )] << get title;
Code Explanation:
- Open data table;
- Fit standard least squares model.
- Specify response variable.
- Define model effects.
- Set emphasis on effect screening.
- Run the model.
- Retrieve model report.
- Extract Box-Cox transformations section.
- Get parent container.
- Fetch outline box title.
Example 232
Summary: Fits two models with different response variables and effects, generating reports and checking for Box-Cox transformations.
Code:
dt1 = Open("data_table.jmp");
obj1 = Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run
);
rpt1 = obj1 << report;
check1 = (rpt1["Box-Cox Transformations"] << parent) << Get;
If( check1 == 0,
obj1 << Box Cox Y Transformation( 1 );
check2 = (rpt1["Box-Cox Transformations"] << parent) << Get;
);
Close( dt1, no save );
dt2 = Open("data_table.jmp");
obj2 = Fit Model(
Y( :Y ),
Effects( :load, :flow, :load * :flow, :speed, :load * :speed, :flow * :speed, :mud, :load * :mud, :flow * :mud, :speed * :mud ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run
);
rpt2 = obj2 << report;
check1 = (rpt2["Box-Cox Transformations"] << parent) << Get;
title1 = (rpt2["Box-Cox Transformations"] << parent)[Outline Box( 1 )] << get title;
Code Explanation:
- Open data table;
- Fit model with weight as response.
- Include age, sex, height as effects.
- Use Standard Least Squares personality.
- Emphasize Effect Screening.
- Run the model.
- Retrieve report object.
- Check for Box-Cox transformations.
- Apply Box-Cox transformation if none.
- Close data_table dataset without saving.
- Open data table;
- Fit model with Y as response.
- Include specified effects.
- Use Standard Least Squares personality.
- Emphasize Effect Screening.
- Run the model.
- Retrieve report object.
- Check for Box-Cox transformations.
- Get title of Box-Cox transformations outline box.
Example 233
Summary: Analyze and visualize a linear model to compare slopes for Fiber Gr*Sugars, including Student's t pairwise comparisons and Tukey HSD all-pairwise differences.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Calories ),
Effects( :Fiber Gr, :Sugars, :Fiber Gr * :Sugars ),
Random Effects( :Manufacturer ),
Center Polynomials( 0 ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
);
rpt = obj << report;
obj << Compare Slopes(
Effect( :Fiber Gr * :Sugars ),
Student's t( 1, All Pairwise Comparisons Scatterplot( 0 ) ),
Comparisons with Control(
1,
Control Level( "Fiber Gr: High" ),
Comparisons with Control Decision Chart( Control Differences Chart( 1, Point Options( "Show Needles" ) ) )
),
Tukey HSD( 1 ),
Equivalence Tests( 0.001 )
);
slope est = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Slope Estimates"][Table Box( 1 )] << get as matrix;
slope diff t = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Student's t All Pairwise Comparisons"]["All Pairwise Differences"][
Table Box( 1 )] << get as matrix;
slope diff ctrl level = Substitute( rpt["Slope Comparisons for Fiber Gr*Sugars"]["Comparisons with Control"][Text Box( 3 )] << get text,
"Control = ", "",
", ", ""
);
slope diff ctrl level1 = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Differences from Control"][String Col Box( 1 )] << get;
slope diff ctrl level2 = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Differences from Control"][String Col Box( 2 )] << get;
slope diff ctrl = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Comparisons with Control"]["Differences from Control"][Table Box( 1 )] <<
get as matrix;
dunnett q1 = Parse( Substitute( rpt[Outline Box( "Comparisons with Control" )][Text Box( 1 )] << get text, "Quantile = ", "", ", ", "" ) );
slope diff tukey = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Tukey HSD All Pairwise Comparisons"]["All Pairwise Differences"][
Table Box( 1 )] << get as matrix;
tukey q1 = Parse( Substitute( rpt["Tukey HSD All Pairwise Comparisons"][Text Box( 1 )] << get text, "Quantile = ", "", ", ", "" ) );
Code Explanation:
- Open data table;
- Fit model with Calories as response.
- Include Fiber Gr, Sugars, and interaction effect.
- Add Manufacturer as random effect.
- Use Standard Least Squares personality.
- Employ REML method.
- Generate model report.
- Compare slopes for Fiber Gr*Sugars.
- Perform Student's t pairwise comparisons.
- Conduct Tukey HSD comparisons.
Example 234
Summary: Fits and creates reports for a linear model to predict weight based on height, with sex as an effect and age as a grouping variable, using Standard Least Squares personality.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :weight, :height ),
Effects( :sex ),
By( :age ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" )
);
obj2 = obj1 << Run( Fit Separately );
rpt2 = obj2 << report;
title1 = rpt2[1][Outline Box( 1 )] << get title;
title2 = rpt2[2][Outline Box( 1 )] << get title;
Close( dt, no save );
b saved best = [740.461721909822, 740.791126828611, 736.56998547995, 736.829557986967, 732.142283958934, 732.804580938359, 731.6879311151,
728.449599328476, 733.409803934388, 729.725512315114, 728.313734937804, 733.269357052251, 733.406234386125, 729.828804971495,
734.55491998591, 728.816933896644, 730.52111208449, 730.328952567045, 732.081558215028, 723.136567133826, 728.105562830131,
727.713075354822, 729.118759182372, 727.555293483343, 730.964933294099, 727.774874932873, 728.702692632588, 721.287134162021,
721.014293217693, 721.333716806471, 718.482044098266];
b saved specific = [68.3425980468971, 68.8039925999582, 63.2646411090245, 63.5832389388707, 58.2187967048493, 58.9296237366239,
57.7394541737309, 54.506846986677, 59.5920721294783, 55.7433321332399, 54.3778947787684, 59.4372314774295, 59.5881283400142,
55.8454919211671, 60.8803397193425, 54.858074984139, 56.5384039971999, 56.3446337648044, 58.1543439569268, 49.8198778116537,
54.1813039928387, 53.813878977695, 55.1495191467358, 53.6673483421066, 56.9902523352468, 53.8714546648772, 54.7484368159972,
48.3443471429808, 48.1328392111724, 48.3806132336711, 46.2411805553648];
Code Explanation:
- Open data table;
- Fit model with weight and height as Y.
- Include sex as effect.
- Group by age.
- Use Standard Least Squares personality.
- Minimal report emphasis.
- Run fit separately.
- Get report object.
- Extract first outline box title.
- Extract second outline box title.
- Close table without saving.
Example 235
Summary: Create and execute a fit model object with inverse prediction for weight, incorporating effects of age, sex, and height, and generating a minimal report.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( Log( :weight ) ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run(
:weight << {Inverse Prediction(
Confidence Level( 0.95 ),
Response( 10, 50, 100, 150 ),
Term Value( age( "14" ), sex( "M" ), height( . ) )
)}
)
);
b y function = {Y Function( Exp( 1.64795562681825 + 0.0457945886355865 * X ), X )};
rpt = Report( obj );
Code Explanation:
- Open data table.
- Create fit model object.
- Set response variable to log(weight).
- Add effects: age, sex, height.
- Use standard least squares personality.
- Generate minimal report.
- Run inverse prediction for weight.
- Set confidence level to 95%.
- Define response values: 10, 50, 100, 150.
- Set term values: age=14, sex=M, height=missing.
Example 236
Summary: Runs a linear regression analysis to model the relationship between yield and popcorn batch, utilizing Standard Least Squares personality and minimal report emphasis.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :yield ),
Effects( :popcorn, :batch, :popcorn * :batch ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run( :yield << {{:popcorn * :batch << {LSMeans Plot( 1 )}}} )
);
rpt = Report( obj );
Code Explanation:
- Open data table;
- Initiate Fit Model platform.
- Set response variable to "yield".
- Include "popcorn", "batch", and interaction effects.
- Choose Standard Least Squares personality.
- Request minimal report emphasis.
- Run model with LSMeans plot for interaction.
- Retrieve report object.
Example 237
Summary: Fits a linear model with weight as response, including age, sex, and height as effects, using standard least squares personality and generating a minimal report.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run()
);
obj1 << Automatic Recalc( 1 );
obj1 << Save Script to Report;
rpt1 = obj1 << report;
test1 = Substitute( (rpt1[Text Box( 1 )] << get text), "\!N", "", "\!n", "", "\!r", "", "\!b", "", "\!t", "", " ", "" );
Close( dt, no save );
b term1 = "TermRuntimeRunPulseRuntime*RunPulseRuntime*RunPulse*(Runtime-RunPulse)";
Code Explanation:
- Open data table;
- Fit linear model with weight as response.
- Include age, sex, height as effects.
- Use standard least squares personality.
- Generate minimal report.
- Run the model.
- Enable automatic recalculation.
- Save script to report.
- Extract report content.
- Close dataset without saving.
Example 238
Summary: Analyze and visualize mean weight and height by sex, utilizing a Fit Model script to generate confidence intervals and formulas.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( Log( :weight ) ),
Effects( :height ),
By( :sex ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run
);
obj1[1] << Save Columns( mean confidence interval( 1 ) );
obj1[2] << Save Columns( mean confidence interval( 1 ) );
b lcl mean = dt:Name( "Lower 95% Mean weight By sex" ) << get values;
b ucl mean = dt:Name( "Upper 95% Mean weight By sex" ) << get values;
dt << Delete Column( :Name( "Lower 95% Mean weight By sex" ) );
dt << Delete Column( :Name( "Upper 95% Mean weight By sex" ) );
obj1[1] << Save Columns( mean confidence limit formula( 1 ) );
obj1[2] << Save Columns( mean confidence limit formula( 1 ) );
lcl mean = dt:Name( "Lower 95% Mean weight By sex" ) << get values;
ucl mean = dt:Name( "Upper 95% Mean weight By sex" ) << get values;
obj2 = dt << Fit Model(
Y( :height ),
Effects( :weight, :age, :weight * :age ),
By( :sex ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run( :height << {Lack of Fit( 0 ), Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ), Plot Effect Leverage( 1 )} ),
);
obj2[1] << Save Columns( mean confidence interval( 1 ) );
obj2[2] << Save Columns( mean confidence interval( 1 ) );
b lcl mean = dt:Name( "Lower 95% Mean height By sex" ) << get values;
b ucl mean = dt:Name( "Upper 95% Mean height By sex" ) << get values;
dt << Delete Column( :Name( "Lower 95% Mean height By sex" ) );
dt << Delete Column( :Name( "Upper 95% Mean height By sex" ) );
obj2[1] << Save Columns( mean confidence limit formula( 1 ) );
obj2[2] << Save Columns( mean confidence limit formula( 1 ) );
lcl mean = dt:Name( "Lower 95% Mean height By sex" ) << get values;
ucl mean = dt:Name( "Upper 95% Mean height By sex" ) << get values;
Code Explanation:
- Open data table.
- Fit model for log(weight).
- Use height as effect.
- Group by sex.
- Use standard least squares personality.
- Create minimal report.
- Run the model.
- Save mean confidence intervals.
- Retrieve confidence interval values.
- Delete temporary columns.
- Save mean confidence limit formulas.
- Retrieve confidence limit formula values.
- Fit another model for height.
- Include weight, age, and interaction.
- Group by sex.
- Use standard least squares personality.
- Create minimal report.
- Customize plot options.
- Run the model.
- Save mean confidence intervals.
- Retrieve confidence interval values.
- Delete temporary columns.
- Save mean confidence limit formulas.
- Retrieve confidence limit formula values.
Example 239
Summary: Create and execute a Fit Model object to analyze the relationship between weight, height, and sex, grouped by age, with minimal report emphasis.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :weight, :height ),
Effects( :sex ),
By( :age ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" )
);
obj2 = obj1 << Run( Fit Separately );
rpt2 = obj2 << report;
title1 = rpt2[1][Outline Box( 1 )] << get title;
title2 = rpt2[2][Outline Box( 1 )] << get title;
Code Explanation:
- Open data table;
- Create Fit Model object.
- Set response variables: weight, height.
- Add effect: sex.
- Group by age.
- Use Standard Least Squares personality.
- Emphasize Minimal Report.
- Run model separately.
- Retrieve report object.
- Extract titles from first two outline boxes.
Example 240
Summary: Runs a linear regression analysis to model miles as a function of species, subject, and season using the Fit Model platform in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( Standard Least Squares ),
Run,
);
obj << Parameterized Formula( 1 );
obj << Predicted Values( 1 );
val1 = dt:Pred Param Formula miles << get values;
val2 = dt:Predicted miles << get values;
Code Explanation:
- Open data table;
- Launch Fit Model platform.
- Set miles as response variable.
- Include species, subject, season, interaction effects.
- Choose Standard Least Squares personality.
- Run the model.
- Set parameterized formula.
- Calculate predicted values.
- Retrieve parameterized formula values.
- Retrieve predicted miles values.
Example 241
Summary: Fits a linear model to predict weight based on age and height, with multiple comparisons enabled for age levels.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :weight ),
Effects( :age, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
:weight << {Effect Summary( 0 ), Summary of Fit( 0 ), Lack of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ),
Scaled Estimates( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ),
Multiple Comparisons(
Effect( :age ),
Comparisons with Control(
1,
Control Level( "age:15" ),
Differences from Control( 0 ),
Comparisons with Control Decision Chart(
Control Differences Chart( 1, Show Summary Report( 1 ), Point Options( "Show Needles" ) )
)
)
), {:age << {LSMeans Dunnett(
0.05,
Control Differences Report( 0 ),
Control Level( "15" ),
Control Differences Chart( 1, Show Summary Report( 1 ), Point Options( "Show Needles" ) )
)}}}
)
);
rpt = obj << report;
levels1 = rpt[Outline Box( "LSMeans Differences Dunnett" )][Outline Box( "Control Differences Summary" )][String Col Box( 1 )] << get;
Code Explanation:
- Open table.
- Fit model with weight as response.
- Include age and height as effects.
- Use standard least squares personality.
- Minimal report emphasis.
- Suppress all default reports.
- Enable multiple comparisons for age.
- Compare age levels with control level 15.
- Disable differences from control.
- Show control differences decision chart with needles.
Example 242
Summary: Runs the fitting and prediction of a model with transformed height, incorporating sex, age, and weight effects, using Standard Least Squares personality and Minimal Report emphasis.
Code:
dt = Open("data_table.jmp");
obj1 = Fit Model(
Y( Transform Column( "Square height", Formula( (:height) ^ 2 ) ), ),
Effects( :sex, :age, :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj1 << Prediction Formula( 1 );
obj1 << Predicted Values( 1 );
obj1 << Mean Confidence Interval( 1 );
obj1 << Indiv Confidence Interval( 1 );
obj1 << Mean Confidence Limit Formula( 1 );
obj1 << Indiv Confidence Limit Formula( 1 );
obj2 = Fit Model(
Y( :height ^ 2 ),
Effects( :sex, :age, :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj2 << Prediction Formula( 1 );
obj2 << Predicted Values( 1 );
obj2 << Mean Confidence Interval( 1 );
obj2 << Indiv Confidence Interval( 1 );
obj2 << Mean Confidence Limit Formula( 1 );
obj2 << Indiv Confidence Limit Formula( 1 );
Code Explanation:
- Open data table;
- Create obj1 with transformed height.
- Add sex, age, weight effects.
- Use Standard Least Squares personality.
- Set Minimal Report emphasis.
- Run obj1 model.
- Add Prediction Formula to obj1.
- Add Predicted Values to obj1.
- Add Mean Confidence Interval to obj1.
- Add Indiv Confidence Interval to obj1.
- Add Mean Confidence Limit Formula to obj1.
- Add Indiv Confidence Limit Formula to obj1.
- Create obj2 with squared height.
- Add sex, age, weight effects.
- Use Standard Least Squares personality.
- Set Minimal Report emphasis.
- Run obj2 model.
- Add Prediction Formula to obj2.
- Add Predicted Values to obj2.
- Add Mean Confidence Interval to obj2.
- Add Indiv Confidence Interval to obj2.
- Add Mean Confidence Limit Formula to obj2.
- Add Indiv Confidence Limit Formula to obj2.
Example 243
Summary: Runs the fitting and prediction of a linear model with transformed miles, incorporating species, season, and interaction effects, as well as random effects for subject by species.
Code:
dt = Open("data_table.jmp");
obj1 = Fit Model(
Y( Transform Column( "Square Root[miles]", Formula( Sqrt( :miles ) ) ), ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run
);
obj1 << Prediction Formula( 1 );
obj1 << Predicted Values( 1 );
obj1 << Conditional Pred Formula( 1 );
obj1 << Conditional Pred Values( 1 );
obj1 << Mean Confidence Interval( 1 );
obj1 << Indiv Confidence Interval( 1 );
obj1 << Mean Confidence Limit Formula( 1 );
obj1 << Indiv Confidence Limit Formula( 1 );
obj2 = Fit Model(
Y( Sqrt( :miles ) ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run
);
obj2 << Prediction Formula( 1 );
obj2 << Predicted Values( 1 );
obj2 << Conditional Pred Formula( 1 );
obj2 << Conditional Pred Values( 1 );
obj2 << Mean Confidence Interval( 1 );
obj2 << Indiv Confidence Interval( 1 );
obj2 << Mean Confidence Limit Formula( 1 );
obj2 << Indiv Confidence Limit Formula( 1 );
Code Explanation:
- Open data table;
- Create transformed column for miles.
- Fit model with transformed miles.
- Include species, season, and interaction effects.
- Add random effects for subject by species.
- Use REML method.
- Generate minimal report.
- Enable prediction formula.
- Calculate predicted values.
- Enable conditional prediction formula.
- Calculate conditional predicted values.
- Generate mean confidence interval.
- Generate individual confidence interval.
- Enable mean confidence limit formula.
- Enable individual confidence limit formula.
- Fit another model with original miles.
- Include same effects and random effects.
- Use REML method.
- Generate minimal report.
- Enable prediction formula.
- Calculate predicted values.
- Enable conditional prediction formula.
- Calculate conditional predicted values.
- Generate mean confidence interval.
- Generate individual confidence interval.
- Enable mean confidence limit formula.
- Enable individual confidence limit formula.
Example 244
Summary: Runs the Fit Model process to analyze miles data, defining effects for species, subject nested in species with random effect, season, and interaction between species and season, then generates a report and attempts to extract Sequential Tests outline.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Standard Least Squares" ),
Run
);
obj << Sequential Tests( 1 );
rpt = obj << report;
test1 = Try( rpt[Outline Box( "Response miles" )][Outline Box( "Sequential (Type 1) Tests" )], "Sequential Tests removed for REML" );
Code Explanation:
- Open data table;
- Initiate Fit Model process.
- Set response variable to miles.
- Define effects: species, subject nested in species with random effect, season, interaction between species and season.
- Choose Standard Least Squares personality.
- Run the model.
- Enable Sequential Tests.
- Generate report from model.
- Attempt to extract Sequential Tests outline.
- Handle case where Sequential Tests are missing.
Example 245
Summary: Fits a linear mixed effects model to analyze the relationship between height and age, with sex as a random effect, using REML estimation and minimal reporting.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :height ),
Effects( :age ),
Random Effects( :sex ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run
);
rpt = obj << report;
Code Explanation:
- Open data table.
- Define model object.
- Set response variable.
- Add effect variable.
- Specify random effect.
- Choose personality method.
- Select estimation method.
- Set report emphasis.
- Run the model.
- Retrieve model report.
Example 246
Summary: Create and execute a Fit Model object to analyze the relationship between height and age, with sex as a random effect, using REML method and generating a control differences chart.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :height ),
Effects( :age ),
Random Effects( :sex ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run(
:height << {:age << {LSMeans Dunnett(
0.05,
Control Level( "12" ),
Control Differences Chart( 1, Point Options( "Show Needles" ) )
)}}
)
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Create Fit Model object.
- Set response variable to height.
- Add age as effect.
- Include sex as random effect.
- Use Standard Least Squares personality.
- Employ REML method.
- Request minimal report.
- Run model with LSMeans Dunnett.
- Set significance level to 0.05.
- Define control level as "12".
- Generate control differences chart.
- Show needles on chart.
- Retrieve model report.
Example 247
Summary: Fits a model to the Oxy variable, incorporating effects from Runtime, Weight, RunPulse, RstPulse, and MaxPulse, with minimal reporting and indicator parameterization.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Oxy ),
Effects( :Runtime, :Weight, :RunPulse, :RstPulse, :MaxPulse ),
No Intercept,
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run( :Oxy << {Indicator Parameterization Estimates( 1 )} )
);
rpt = obj << report;
test1 = Try( rpt["Indicator Function Parameterization"] << get title, "None" );
Code Explanation:
- Open data table;
- Fit model to Oxy variable.
- Include Runtime, Weight, RunPulse, RstPulse, MaxPulse effects.
- Exclude intercept term.
- Use standard least squares personality.
- Generate minimal report.
- Set indicator parameterization for Oxy.
- Retrieve model report.
- Attempt to get title of indicator function parameterization.
- Assign result to test1; default to "None" if not found.
Example 248
Summary: Fits three models with different transformations to a data table, including age, sex, and height effects, and generates plots for actual vs predicted, residual vs predicted, and effect leverage.
Code:
dt = Open("data_table.jmp");
obj1a = dt << Fit Model(
Y( 1 / :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Run( :weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )} )
);
rpt1a = obj1a << report;
test1a = rpt1a[Outline Box( "age" )][Outline Box( "Least Squares Means Table" )][Table Box( 1 )] << get as matrix;
obj2a = dt << Fit Model(
Y( Arrhenius( :weight ) ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Run( :weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )} )
);
rpt2a = obj2a << report;
test2a = rpt2a[Outline Box( "age" )][Outline Box( "Least Squares Means Table" )][Table Box( 1 )] << get as matrix;
obj3a = dt << Fit Model(
Y( Arrhenius Inv( :weight ) ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Run( :weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )} )
);
rpt3a = obj3a << report;
test3a = rpt3a[Outline Box( "age" )][Outline Box( "Least Squares Means Table" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit model with inverse weight.
- Include age, sex, height effects.
- Use standard least squares personality.
- Generate actual vs predicted plot.
- Generate residual vs predicted plot.
- Generate effect leverage plot.
- Retrieve report for model.
- Extract age least squares means.
- Repeat steps 2-9 for Arrhenius and Arrhenius Inv transformations.
Example 249
Summary: Fits a linear model to predict loan values based on mortgage due amounts, utilizing standard least squares and minimal report emphasis.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :LOAN ),
Effects( Log( :MORTDUE ) ),
Informative Missing( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run()
);
obj << Prediction Formula;
obj << Predicted Values;
pred1 = dt:Pred Formula LOAN << get values;
pred2 = dt:Predicted LOAN << get values;
Code Explanation:
- Open data table;
- Fit linear model.
- Set response variable.
- Define effect using log.
- Handle missing data.
- Choose standard least squares.
- Minimize report emphasis.
- Execute model fit.
- Generate prediction formula.
- Calculate predicted values.
Example 250
Summary: Fits a linear model to data, predicting loan values based on log-transformed mortgage due and property value, with informative missing handling and standard least squares personality.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :LOAN ),
Effects( Log( :MORTDUE ), Log( :VALUE ), :MORTDUE * :VALUE ),
Informative Missing( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run()
);
obj << Prediction Formula;
obj << Predicted Values;
pred1 = dt:Pred Formula LOAN << get values;
pred2 = dt:Predicted LOAN << get values;
Code Explanation:
- Open data table;
- Fit linear model to data.
- Set Y variable as LOAN.
- Define effects: log(MORTDUE), log(VALUE), MORTDUE*VALUE.
- Enable informative missing handling.
- Use standard least squares personality.
- Generate minimal report.
- Run the model.
- Add prediction formula.
- Extract predicted values.
Example 251
Summary: Fits a linear model with weight as response, including sex and height as effects, and generates a minimal report with multiple comparisons for sex.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
:weight << {Analysis of Variance( 0 ), Lack of Fit( 0 ), Plot Regression( 0 ), Plot Actual by Predicted( 0 ),
Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 ), Multiple Comparisons(
Effect( sex ),
Comparisons with Control(
1,
Control Level( "sex:F" ),
Name( "Calculate P-Values" )(1),
Comparisons with Control Decision Chart( 0 )
)
), {:sex << {LSMeans Dunnett( 0.05, Control Level( "F" ), Control Differences Chart( 0 ) )}}}
)
);
rpt = Report( obj );
b dunnett = [-4.40159873158484 5.42365132639064 -15.3909601712154 6.58776270804572 0.422236591083852];
dunnett1 = rpt[Outline Box( "LSMeans Differences Dunnett" )][Table Box( 1 )] << get as matrix;
dunnett2 = rpt[Outline Box( "Multiple Comparisons for sex" )][Outline Box( "Comparisons with Control" )][
Outline Box( "Differences from Control" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit linear model with weight as response.
- Include sex and height as effects.
- Use standard least squares personality.
- Generate minimal report.
- Disable various analysis options.
- Perform multiple comparisons for sex.
- Compare with control level "sex:F".
- Calculate p-values for comparisons.
- Extract LSMeans differences Dunnett from report.
Example 252
Summary: Runs a custom test script in the Fit Model platform to analyze the relationship between height and weight, with an attempt to crash the software.
Code:
dt = Open("data_table.jmp");
dt << Fit Model( Y( :height ), Effects( :weight ), Add Script( Custom Test( [42], Remove, Make it Crash ) ), Run() );
Code Explanation:
- Open data table.
- Assign table to variable dt.
- Launch Fit Model platform.
- Set response variable to height.
- Add weight as effect.
- Add custom test script.
- Define custom test parameters.
- Remove specified effect.
- Attempt to crash software.
- Execute model fit.
Example 253
Summary: Fits a linear regression model, adding effect leverage pairs, and retrieving column group names from a data table.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :height ), Effects( :sex, weight ), Personality( "Standard Least Squares" ), Run() );
obj1 << Effect Leverage Pairs( 1 );
obj1 << Effect Leverage Pairs( 1 );
obj1 << Effect Leverage Pairs( 1 );
group1 = dt << Get Column Groups Names;
For( i = 1, i <= N Items( group1 ), i++,
colname = dt << Get Column Group( group1[i] );
If( i == 1, , );
);
Code Explanation:
- Open data table.
- Fit linear regression model.
- Add effect leverage pairs.
- Add effect leverage pairs.
- Add effect leverage pairs.
- Get column group names.
- Loop through column groups.
- Get column group for each.
- Conditional statement (no action).
- End loop.
Example 254
Summary: Fits a linear model to predict height, incorporating sex and age effects, with standard least squares personality and effect screening, and generates a report from the model.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :height ),
Effects( :sex, :age, :age * :sex ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run()
);
rpt1 = Report( obj1 );
title1 = "";
Try( title1 = rpt1[Outline Box( "Whole Model" )][Outline Box( "Contour Profiler" )] << get title );
Code Explanation:
- Open data table;
- Fit linear model to height.
- Include sex, age, and interaction effects.
- Use standard least squares personality.
- Focus on effect screening.
- Run the model.
- Generate report from model.
- Initialize title variable.
- Try to get contour profiler title.
- Store title if available.
Example 255
Summary: Fits a model to a data table, using standard least squares and emphasizing minimal report generation.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
By( :age ),
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
Try( dt1 = Report( obj[] )[Table Box( 3 )] << make combined data table );
Code Explanation:
- Open data table;
- Fit model by age.
- Set response variable height.
- Add weight effect.
- Use standard least squares.
- Minimal report emphasis.
- Run the model.
- Try to extract report.
- Access third table box.
- Make combined data table.
Example 256
Summary: Runs a linear regression analysis to model yield based on popcorn, oil amount, batch, and interaction effects, using the Standard Least Squares personality and EMS method.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :yield ),
Effects( :popcorn, :oil amt, :popcorn * :oil amt, :batch, :popcorn * :batch, :oil amt * :batch, :popcorn * :oil amt * :batch & Random ),
NoBounds( 0 ),
Personality( Standard Least Squares ),
Method( EMS ),
Emphasis( Effect Leverage ),
Run
);
rpt = obj << report;
source = rpt[Outline Box( "Effect Summary" )][String Col Box( 1 )] << get;
Close( dt, no save );
b log1 = "Unable to compute the p-value for the Durbin-Watson test statistic.";
Code Explanation:
- Open data table;
- Initiate Fit Model analysis.
- Set yield as dependent variable.
- Include popcorn, oil amt, batch, and interaction effects.
- Disable bounds on parameters.
- Use Standard Least Squares personality.
- Apply EMS method.
- Focus on effect leverage.
- Execute the model fit.
- Retrieve effect summary report.
Example 257
Summary: Fits a model to data, excluding intercept and including specified effects, and generates standard error and predicted values.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Damping ),
Effects(
:CuSO4 & RS & Mixture,
:Na2S2O3 & RS & Mixture,
:Glyoxal & RS & Mixture,
:CuSO4 * :Na2S2O3,
:CuSO4 * :Glyoxal,
:CuSO4 * :Wavelength,
:Na2S2O3 * :Glyoxal,
:Na2S2O3 * :Wavelength,
:Glyoxal * :Wavelength,
Scheffe Cubic( CuSO4, Glyoxal )
),
No Intercept( 1 ),
Run
);
obj << Std Error of Predicted( 1 );
obj << StdErr Pred Formula( 1 );
stderr pred1 = dt:StdErr Pred Damping << get values;
stderr pred2 = dt:PredSE Damping << get values;
obj << Predicted Values( 1 );
obj << Prediction Formula( 1 );
pred1 = dt:Pred Formula Damping << get values;
pred2 = dt:Predicted Damping << get values;
obj << Mean Confidence Interval( 1 );
obj << Mean Confidence Limit Formula( 1 );
mean ci1 = (dt:Lower 95% Mean Damping << get values) || (dt:Upper 95% Mean Damping << get values);
mean ci2 = (dt:Lower 95% Mean Damping 2 << get values) || (dt:Upper 95% Mean Damping 2 << get values);
obj << Indiv Confidence Interval( 1 );
obj << Indiv Confidence Limit Formula( 1 );
indiv ci1 = (dt:Lower 95% Indiv Damping << get values) || (dt:Upper 95% Indiv Damping << get values);
indiv ci2 = (dt:Lower 95% Indiv Damping 2 << get values) || (dt:Upper 95% Indiv Damping 2 << get values);
Close( dt, no save );
b log1 =
"You have entered categorical effects that interact with a main effect (age). These effects have been removed from the analysis.You have entered categorical effects that interact with a main effect (sex). These effects have been removed from the analysis.";
Code Explanation:
- Open data table.
- Fit model with specified effects.
- Exclude intercept from model.
- Run the model.
- Add standard error of predicted.
- Get standard error formula.
- Retrieve standard error values.
- Add predicted values.
- Get prediction formula.
- Retrieve predicted values.
Example 258
Summary: Fits a model to data, performing custom testing, and saving the script to a report in JMP.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj1 << Custom Test( [0 1 1 0 0 0 0 2 0] );
obj1 << Save Script to Report;
rpt1 = Report( obj1 );
text1 = rpt1[Outline Box( "Response weight" )][Text Box( 1 )] << get text;
Code Explanation:
- Open data table.
- Fit model to data.
- Specify response variable.
- Add effects to model.
- Choose personality type.
- Set report emphasis.
- Run the model.
- Perform custom test.
- Save script to report.
- Extract text from report.
Example 259
Summary: Fits a linear model to predict yield, incorporating popcorn, oil amount, and interaction terms, with emphasis on effect leverage.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :yield ),
Effects( :popcorn, :oil amt, :popcorn * :oil amt, :batch, :popcorn * :batch, :oil amt * :batch, :popcorn * :oil amt * :batch & Random ),
NoBounds( 0 ),
Personality( Standard Least Squares ),
Method( EMS ),
Emphasis( Effect Leverage ),
Run
);
rpt = obj << report;
source = rpt[Outline Box( "Effect Summary" )][String Col Box( 1 )] << get;
Code Explanation:
- Open data table;
- Fit model with yield as response.
- Include popcorn, oil amt, and interaction terms.
- Set no bounds for coefficients.
- Use standard least squares personality.
- Employ EMS method.
- Focus on effect leverage emphasis.
- Run the model.
- Retrieve model report.
- Extract effect summary column data.
Example 260
Summary: Fits a model with specified effects, disables intercept term, and retrieves standard error values and predicted values from a data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Damping ),
Effects(
:CuSO4 & RS & Mixture,
:Na2S2O3 & RS & Mixture,
:Glyoxal & RS & Mixture,
:CuSO4 * :Na2S2O3,
:CuSO4 * :Glyoxal,
:CuSO4 * :Wavelength,
:Na2S2O3 * :Glyoxal,
:Na2S2O3 * :Wavelength,
:Glyoxal * :Wavelength,
Scheffe Cubic( CuSO4, Glyoxal )
),
No Intercept( 1 ),
Run
);
obj << Std Error of Predicted( 1 );
obj << StdErr Pred Formula( 1 );
stderr pred1 = dt:StdErr Pred Damping << get values;
stderr pred2 = dt:PredSE Damping << get values;
obj << Predicted Values( 1 );
obj << Prediction Formula( 1 );
pred1 = dt:Pred Formula Damping << get values;
pred2 = dt:Predicted Damping << get values;
obj << Mean Confidence Interval( 1 );
obj << Mean Confidence Limit Formula( 1 );
mean ci1 = (dt:Lower 95% Mean Damping << get values) || (dt:Upper 95% Mean Damping << get values);
mean ci2 = (dt:Lower 95% Mean Damping 2 << get values) || (dt:Upper 95% Mean Damping 2 << get values);
obj << Indiv Confidence Interval( 1 );
obj << Indiv Confidence Limit Formula( 1 );
indiv ci1 = (dt:Lower 95% Indiv Damping << get values) || (dt:Upper 95% Indiv Damping << get values);
indiv ci2 = (dt:Lower 95% Indiv Damping 2 << get values) || (dt:Upper 95% Indiv Damping 2 << get values);
Code Explanation:
- Open data table.
- Fit model with specified effects.
- Disable intercept term.
- Run the model.
- Enable standard error of predicted.
- Enable standard error formula.
- Retrieve standard error values.
- Enable predicted values.
- Enable prediction formula.
- Retrieve predicted values.
Example 261
Summary: Fits and creates reports for two models to analyze relationships between variables in a data table, utilizing the Fit Model platform in JMP.
Code:
dt = Open("data_table.jmp");
obj0 = dt << Fit Model(
Effects(
:Silica & RS, :Sulfur & RS, :Silane & RS, :Silica * :Sulfur, :Silica * :Silane, :Sulfur * :Silane, :Silica * :Silica,
:Sulfur * :Sulfur, :Silane * :Silane
),
Y( :Stretch ),
PERSONALITY( "Standard Least Squares" ),
Error Specification( "Default Estimate" ),
Run( Show All Confidence Intervals( 1 ) )
);
rpt0 = obj0 << report;
obj1 = dt << Fit Model(
Effects(
:Silica & RS, :Sulfur & RS, :Silane & RS, :Silica * :Sulfur, :Silica * :Silane, :Sulfur * :Silane, :Silica * :Silica,
:Sulfur * :Sulfur, :Silane * :Silane
),
Y( :Stretch ),
PERSONALITY( "Standard Least Squares" ),
Error Specification( "Pure Error" ),
Run( Show All Confidence Intervals( 1 ) )
);
rpt1 = obj1 << report;
dtcoding0 = obj0 << Save Coding Table( 1 );
dtcoding1 = obj1 << Save Coding Table( 1 );
xy0 = dtcoding0 << get as matrix;
xy1 = dtcoding1 << get as matrix;
Code Explanation:
- Open data table.
- Fit first model.
- Specify effects for model.
- Set response variable.
- Choose personality.
- Define error specification.
- Run model with confidence intervals.
- Retrieve report from first model.
- Fit second model.
- Retrieve report from second model.
Example 262
Summary: Fits a standard least squares model to predict stretch values, including specified effects and informative missing handling, while generating various statistics and formulas.
Code:
dt = Open("data_table.jmp");
dt:Silica[1 :: 2] = .;
obj = dt << Fit Model(
Y( :Stretch ),
Effects( :Silica & RS, :Sulfur & RS, :Silica * :Silica, :Silica * :Sulfur, :Sulfur * :Sulfur ),
Informative Missing( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj << Std Error of Predicted;
obj << StdErr Pred Formula;
obj << Predicted Values;
obj << Mean Confidence Interval;
obj << Indiv Confidence Interval;
obj << Prediction and Interval Formulas;
obj << StdErr Pred Formula;
obj << Std Error of Predicted;
b test = (dt:StdErr Pred Stretch << get values) || (dt:Predicted Stretch << get values) || (dt:Lower 95% Mean Stretch << get values) || (dt
:Upper 95% Mean Stretch << get values) || (dt:Lower 95% Indiv Stretch << get values) || (dt:Upper 95% Indiv Stretch << get values);
test = (dt:PredSE Stretch << get values) || (dt:Pred Formula Stretch << get values) || (dt:Lower 95% Mean Stretch 2 << get values) || (dt
:Upper 95% Mean Stretch 2 << get values) || (dt:Lower 95% Indiv Stretch 2 << get values) || (dt:Upper 95% Indiv Stretch 2 << get values);
obj << Prediction and Interval Formulas( 0.01 );
alpha1 = Substr( Char( Arg( Arg( (dt:Lower 99% Mean Stretch << get formula), 2 ), 1 ) ), 1, 40 );
Code Explanation:
- Open data table.
- Set first two Silica values to missing.
- Fit standard least squares model.
- Include specified effects in model.
- Use informative missing handling.
- Request minimal report emphasis.
- Run the model.
- Calculate standard error of predicted values.
- Get standard error prediction formula.
- Calculate predicted values.
- Calculate mean confidence intervals.
- Calculate individual confidence intervals.
- Get prediction and interval formulas.
- Get standard error prediction formula again.
- Calculate standard error of predicted values again.
- Concatenate various prediction and interval values.
- Get prediction and interval formulas with alpha 0.01.
- Extract part of the lower 99% mean stretch formula.
Example 263
Summary: Fits a Cox mixture model to data, generating various reports and plots for analysis.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Effects( :p1 & RS & Mixture, :p2 & RS & Mixture, :p3 & RS & Mixture, :p1 * :p2, :p1 * :p3, :p2 * :p3 ),
Y( :Y ),
No Intercept,
PERSONALITY( "Standard Least Squares" ),
Run
);
obj << Analysis of Variance( 1 );
obj << Summary of Fit( 1 );
obj << Cox Mixtures( p1( 0.6615 ), p2( 0.126 ), p3( 0.2125 ) );
obj << Sorted Estimates( 1 );
obj << Scaled Estimates( 1 );
obj << Expanded Estimates( 1 );
obj << Correlation of Estimates( 1 );
obj << Show Prediction Expression( 1 );
obj << Sequential Tests( 1 );
obj << Durbin Watson Test( 1 );
obj << Normal Plot( 1 );
obj << Pareto Plot( 1 );
obj << Bayes Plot( 1 );
obj << Press( 1 );
obj << Plot Residual by Normal Quantiles( 1 );
obj << Plot Residual by Row( 1 );
rpt = obj << report;
Code Explanation:
- Open data table.
- Define effects for model.
- Set response variable.
- Specify no intercept.
- Choose standard least squares personality.
- Run fit model.
- Generate analysis of variance report.
- Display summary of fit report.
- Apply Cox mixtures with specified parameters.
- Show sorted estimates.
Example 264
Summary: Fits a linear model to predict weight, incorporating age, sex, and height effects, while generating a minimal report with prediction profiler text.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
:weight << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ),
Profiler(
1,
Confidence Intervals( 1 ),
Prediction Intervals( 1 ),
Term Value( age( 12, Lock( 0 ), Show( 1 ) ), sex( "F", Lock( 0 ), Show( 1 ) ), height( 62.55, Lock( 0 ), Show( 1 ) ) )
)}
)
);
rpt = obj << report;
pi1 = rpt["Prediction Profiler"][Text Box( 5 )] << get text;
:weight << Format( "Fixed Dec", 9, 4 );
obj2 = obj << Redo Analysis;
rpt2 = obj2 << report;
pi = rpt2["Prediction Profiler"][Text Box( 5 )] << get text;
Code Explanation:
- Open data table;
- Fit linear model to weight.
- Include age, sex, height effects.
- Use standard least squares personality.
- Minimal report emphasis.
- Disable all fit diagnostics plots.
- Enable prediction profiler with intervals.
- Set term values for age, sex, height.
- Get prediction profiler text from first run.
- Format weight column.
- Redo analysis.
- Get prediction profiler text from redo.
Example 265
Summary: Fits a model to predict Price using multiple effects, with emphasis on effect screening and generating a report.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Price ),
Effects( :Carat Weight, :Color, :Clarity, :Depth, :Table, :Cut, :Report ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
Profiler( 0 ),
:Price << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Sorted Estimates( 0 ),
Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ), Scaled Estimates( 0 ),
Multiple Comparisons(
Estimates(
Estimate(
Carat Weight( 0.870104089219332 ),
Color( "J" ),
Clarity( "VS2" ),
Depth( 61.7114869888476 ),
Table( 57.8609665427509 ),
Cut( "Good" ),
Report( "AGS" )
),
Estimate(
Carat Weight( 0.870104089219332 ),
Color( "J" ),
Clarity( "VS1" ),
Depth( 61.7114869888476 ),
Table( 57.8609665427509 ),
Cut( "Good" ),
Report( "AGS" )
),
Estimate(
Carat Weight( 0.870104089219332 ),
Color( "I" ),
Clarity( "VS2" ),
Depth( 61.7114869888476 ),
Table( 57.8609665427509 ),
Cut( "Good" ),
Report( "AGS" )
),
Estimate(
Carat Weight( 0.870104089219332 ),
Color( "I" ),
Clarity( "VS1" ),
Depth( 61.7114869888476 ),
Table( 57.8609665427509 ),
Cut( "Good" ),
Report( "AGS" )
)
),
Comparisons with Overall Average(
1,
Comparisons with Overall Average Decision Chart( ANOM( 1, Point Options( "Show Needles" ) ) )
),
Comparisons with Control(
1,
Control Level( "Color:J, Clarity:VS2" ),
Comparisons with Control Decision Chart( Control Differences Chart( 1, Point Options( "Show Needles" ) ) )
)
)},
Effect Summary( 0 )
)
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Fit Model dialog initiated.
- Set response variable: Price.
- Add effects: Carat Weight, Color, Clarity, Depth, Table, Cut, Report.
- Choose Standard Least Squares personality.
- Set emphasis to Effect Screening.
- Run model with specified options.
- Disable Profiler.
- Configure multiple comparisons.
- Generate report.
Example 266
Summary: Fits a model with height as response, including weight with knots effect, and generates reports for actual vs predicted plots and leverage plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :height ),
Effects( :weight & Knotted( 5 ) ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run
);
rpt = obj << report;
actpred y = (rpt["Actual by Predicted Plot"][FrameBox( 1 )] << Find Seg( MarkerSeg )) << get y values;
actpred x = (rpt["Actual by Predicted Plot"][FrameBox( 1 )] << Find Seg( MarkerSeg )) << get x values;
lvrg y = (rpt["weight&Knotted(5)"]["Leverage Plot"][FrameBox( 1 )] << Find Seg( MarkerSeg )) << get y values;
lvrg x = (rpt["weight&Knotted(5)"]["Leverage Plot"][FrameBox( 1 )] << Find Seg( MarkerSeg )) << get x values;
Close( dt, no save );
b est = [37.8296010642445 4.53897360446876 8.33439547368156 0.0000000005134489894 28.6327669569818 47.0264351715072 0 . 1.61087237620685,
0.254966111160294 0.0496761011584376 5.13257089857158 0.0000093584205799208 0.154312769400396 0.355619452920192 1.33434065274774
5.97510741841139 0.0176299459056118,
-0.0000558994032318075 0.0000212112522052945 -2.63536554517298 0.0122059118583557 -0.0000988774825815848 -0.0000129213238820302
-0.685129431481145 5.97510741841139 0.0000075278296856861];
Code Explanation:
- Open data table.
- Fit model with height as response.
- Include weight with knots effect.
- Use standard least squares personality.
- Emphasize effect leverage.
- Run the model fit.
- Retrieve report object.
- Extract actual vs predicted plot y-values.
- Extract actual vs predicted plot x-values.
- Extract leverage plot y-values.
Example 267
Summary: Fits a model to predict height based on weight, using Standard Least Squares personality and minimal report emphasis.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :height ),
Effects( :weight & Knotted( 3 ) ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
rpt = obj << report;
est = rpt["Parameter Estimates"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Launch Fit Model platform.
- Set response variable to height.
- Add weight with cubic knot effects.
- Use Standard Least Squares personality.
- Minimal Report emphasis selected.
- Run the model.
- Extract report object.
- Access Parameter Estimates table.
- Retrieve estimates as matrix.
Example 268
Summary: Fits a model with height as response, including weight with 5 knots as effect, and generates reports for actual vs predicted plots and leverage plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :height ),
Effects( :weight & Knotted( 5 ) ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run
);
rpt = obj << report;
actpred y = (rpt["Actual by Predicted Plot"][FrameBox( 1 )] << Find Seg( MarkerSeg )) << get y values;
actpred x = (rpt["Actual by Predicted Plot"][FrameBox( 1 )] << Find Seg( MarkerSeg )) << get x values;
lvrg y = (rpt["weight&Knotted(5)"]["Leverage Plot"][FrameBox( 1 )] << Find Seg( MarkerSeg )) << get y values;
lvrg x = (rpt["weight&Knotted(5)"]["Leverage Plot"][FrameBox( 1 )] << Find Seg( MarkerSeg )) << get x values;
Code Explanation:
- Open data table;
- Fit model with height as response.
- Include weight with 5 knots as effect.
- Use Standard Least Squares personality.
- Emphasize Effect Leverage.
- Run the model fit.
- Retrieve report object.
- Extract Actual vs Predicted plot y-values.
- Extract Actual vs Predicted plot x-values.
- Extract Leverage plot y-values.
- Extract Leverage plot x-values.
Example 269
Summary: Analyze and visualize a model fit to predict ABRASION, incorporating multiple effects and user-defined estimates, with minimal report generation and interactive output.
Code:
dt2 = Open("data_table.jmp");
obj2 = dt2 << Fit Model(
Y( :ABRASION ),
Effects(
:SILICA & RS, :SILANE & RS, :SULFUR & RS, :SILICA * :SILICA, :SILANE * :SILICA, :SILANE * :SILANE, :SULFUR * :SILICA,
:SULFUR * :SILANE, :SULFUR * :SULFUR
),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run( :ABRASION << {Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )} )
);
obj2 << Multiple Comparisons(
Estimates(
Estimate( SILICA( 0.6 ), SILANE( 36.32 ), SULFUR( 0.96 ) ),
Estimate( SILICA( 0.6 ), SILANE( 36.32 ), SULFUR( 1.82 ) ),
Estimate( SILICA( 0.6 ), SILANE( 59.97 ), SULFUR( 0.96 ) ),
Estimate( SILICA( 0.6 ), SILANE( 59.97 ), SULFUR( 1.82 ) ),
Estimate( SILICA( 1.94 ), SILANE( 36.32 ), SULFUR( 0.96 ) ),
Estimate( SILICA( 1.94 ), SILANE( 36.32 ), SULFUR( 1.82 ) ),
Estimate( SILICA( 1.94 ), SILANE( 59.97 ), SULFUR( 0.96 ) ),
Estimate( SILICA( 1.94 ), SILANE( 59.97 ), SULFUR( 1.82 ) )
),
Student's t( 1 )
);
rpt3 = obj2 << report;
est2 = rpt3[Outline Box( "Multiple Comparisons for User-Defined estimates" )][Outline Box( "User-Defined Estimates" )][Table Box( 1 )] <<
get as matrix;
diff student DF2 = rpt3[Outline Box( "Student's t All Pairwise Comparisons" )][Text Box( 2 )] << get text;
diff student2 = rpt3[Outline Box( "Student's t All Pairwise Comparisons" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data_table data
- Fit model with ABRASION as response.
- Include multiple effects in model.
- Use standard least squares personality.
- Generate minimal report.
- Disable various plot outputs.
- Perform multiple comparisons.
- Define user-defined estimates.
- Use Student's t test for comparisons.
- Extract multiple comparison results.
Example 270
Summary: Fits a model to predict log weight based on age, sex, and height, generating a minimal report and saving the prediction formula column.
Code:
dt2 = Open("data_table.jmp");
fm2 = dt2 << Fit Model(
Y( Log( :weight ) ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run()
);
fm2 << Save Columns( Prediction Formula );
jmp pred = dt2:Pred Formula weight << get values;
sql2 = As SQL Expr( (dt2:Pred Formula weight << get formula) );
sas1 = Collapse Whitespace( As SAS Expr( (dt2:Pred Formula weight << get formula) ) );
Code Explanation:
- Open data table.
- Fit model with log weight.
- Include age, sex, height effects.
- Use standard least squares personality.
- Generate minimal report.
- Run the model.
- Save prediction formula column.
- Retrieve prediction formula values.
- Convert formula to SQL expression.
- Convert formula to SAS expression.
Example 271
Summary: Generates a prediction formula for log-transformed weight based on age, sex, and height using Fit Model with Standard Least Squares personality.
Code:
b sql2 =
"Exp((1.8912707717926 + ( CASE age WHEN 12 THEN 0 WHEN 13 THEN -0.112749259010382 WHEN 14 THEN -0.22662104932495 WHEN 15 THEN -0.160618417414009 WHEN 16 THEN -0.0711335847058128 WHEN 17 THEN -0.00570382632499081 ELSE NULL END ) + ( CASE sex WHEN 'F' THEN 0.0166940956494036 WHEN 'M' THEN -0.0166940956494036 ELSE NULL END ) + 0.0457945886355865* height ))";
b sas1 =
"RESULT = Exp((1.8912707717926 + ( SELECT (age) WHEN (12) 0 WHEN (13) -0.112749259010382 WHEN (14) -0.22662104932495 WHEN (15) -0.160618417414009 WHEN ( 16) -0.0711335847058128 WHEN (17) -0.00570382632499081 OTHERWISE . END ) + ( SELECT (sex) WHEN ('F') 0.0166940956494036 WHEN ( 'M') -0.0166940956494036 OTHERWISE . END ) + 0.0457945886355865*height));";
dt2 = Open("data_table.jmp");
fm2 = dt2 << Fit Model(
Y( Log( :weight ) ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run()
);
fm2 << Save Columns( Prediction Formula );
jmp pred = dt2:Pred Formula weight << get values;
sql2 = As SQL Expr( (dt2:Pred Formula weight << get formula) );
sas1 = Collapse Whitespace( As SAS Expr( (dt2:Pred Formula weight << get formula) ) );
Code Explanation:
- Define SQL expression.
- Define SAS expression.
- Open data table.
- Fit model using log-transformed weight.
- Include age, sex, height as effects.
- Use standard least squares personality.
- Generate minimal report.
- Run the model.
- Save prediction formula column.
- Extract JMP prediction values.
Example 272
Summary: Fits a model to data, generating reports, and saving residuals for analysis.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
);
rpt1 = obj1 << report;
obj1 << Save Columns( Studentized Residuals );
obj1 << Save Columns( Externally Studentized Residuals );
obj1 << Plot Studentized Residuals( 1 );
b y1 = dt:Studentized Resid miles << get values;
y1 = (rpt1[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Marker Seg( 1 ) )) << Get Y Values;
note1 = rpt1[Outline Box( "Studentized Residuals" )][Text Box( 3 )] << get text;
obj1 << Externally Studentized Residuals( 1 );
test1 = Try( saved = dt:Externally Studentized Residuals miles << get values, "Externally Studentized Residuals not available for REML" );
Code Explanation:
- Open data table.
- Fit model with specified effects.
- Set personality and method.
- Run the model.
- Retrieve model report.
- Save studentized residuals.
- Save externally studentized residuals.
- Plot studentized residuals.
- Extract studentized residual values.
- Extract externally studentized residual values if available.
Example 273
Summary: Fits a model to predict oxygen levels, incorporating specified effects and using standard least squares personality.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Weight( :Weight ),
Y( :Oxy ),
Effects( :Sex, :MaxPulse, :Runtime, :Sex * :MaxPulse, ::Runtime * :Runtime ),
Personality( "Standard Least Squares" ),
Emphasis( Minimal Report ),
Run()
);
obj1 << Indiv Confidence Interval;
obj1 << Indiv Confidence Limit Formula;
indiv lcl1 = dt:Name( "Lower 95% Indiv Oxy" ) << get values;
indiv ucl1 = dt:Name( "Upper 95% Indiv Oxy" ) << get values;
indiv lcl2 = dt:Name( "Lower 95% Indiv Oxy 2" ) << get values;
indiv ucl2 = dt:Name( "Upper 95% Indiv Oxy 2" ) << get values;
Code Explanation:
- Open data_table data
- Fit model using weight.
- Set response variable to oxy.
- Include specified effects.
- Use standard least squares personality.
- Create minimal report.
- Run the model.
- Add individual confidence interval.
- Add confidence limit formula.
- Retrieve lower and upper limits.
Example 274
Summary: Fits a model to predict Oxy levels based on Weight, MaxPulse, Runtime, and Runtime squared effects, grouped by Sex, with individual confidence intervals.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Weight( :Weight ),
Y( :Oxy ),
Effects( MaxPulse, :Runtime, :Runtime * :Runtime ),
By( :Sex ),
Personality( "Standard Least Squares" ),
Emphasis( Minimal Report ),
Run()
);
obj1[1] << Indiv Confidence Interval;
obj1[2] << Indiv Confidence Interval;
indiv lcl1 = dt:Name( "Lower 95% Indiv Oxy By Sex" ) << get values;
indiv ucl1 = dt:Name( "Upper 95% Indiv Oxy By Sex" ) << get values;
obj1[1] << Indiv Confidence Limit Formula;
obj1[2] << Indiv Confidence Limit Formula;
indiv lcl2 = dt:Name( "Lower 95% Indiv Oxy By Sex" ) << get values;
indiv ucl2 = dt:Name( "Upper 95% Indiv Oxy By Sex" ) << get values;
Code Explanation:
- Open data table;
- Fit model with Weight as weight.
- Set Oxy as response variable.
- Include MaxPulse, Runtime, and Runtime squared effects.
- Group by Sex.
- Use Standard Least Squares personality.
- Generate minimal report.
- Run the model.
- Add individual confidence intervals for both groups.
- Retrieve lower and upper confidence interval values.
Example 275
Summary: Fits two MANOVA models with custom response functions and generates centroid plots for the 'drug' effect, retrieving canonical centroid plot reports.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :hist0, :hist1, :hist3 ),
Effects( :drug, :dep1 ),
Personality( "Manova" ),
Run(
Response Function( "Sum" ),
Response Function( "Identity" ),
Response Function( "Contrast" ),
Response Function( "Polynomial" ),
Response Function( "Helmert" ),
Response Function( "Profile" ),
Response Function( "Mean" ),
Response Function( [0.9 0.1 -1, -0.35 1 -0.65], title( "My Custom Test" ) )
)
);
obj1 << (Response["Sum"] << (Effect["drug"] << Centroid Plot( Centroid Circles( 1 ) )));
rpt1 = Report( obj1 );
jrn1 = rpt1[Outline Box( "Canonical Centroid Plot" )] << get journal;
obj2 = dt << Fit Model(
Y( :hist0, :hist1, :hist3 ),
Effects( :drug, :dep1 ),
Personality( "Manova" ),
Set Alpha Level( 0.4 ),
Run(
Response Function( "Sum" ),
Response Function( "Identity" ),
Response Function( "Contrast" ),
Response Function( "Polynomial" ),
Response Function( "Helmert" ),
Response Function( "Profile" ),
Response Function( "Mean" ),
Response Function( [0.9 0.1 -1, -0.35 1 -0.65], title( "My Custom Test" ) )
)
);
obj2 << (Response["Sum"] << (Effect["drug"] << Centroid Plot( Centroid Circles( 1 ) )));
rpt2 = Report( obj2 );
jrn2 = rpt2[Outline Box( "Canonical Centroid Plot" )] << get journal;
Code Explanation:
- Open data table;
- Fit Manova model with specified responses.
- Define multiple response functions.
- Generate centroid plot for "drug" effect.
- Retrieve canonical centroid plot report.
- Fit another Manova model with custom alpha level.
- Define same response functions again.
- Generate centroid plot for "drug" effect.
- Retrieve canonical centroid plot report.
Example 276
Summary: Analyze and visualize a data table by fitting a Manova model, saving canonical scores, and retrieving column group names.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
Effects( :drug, :dep1, :drug * :dep1 ),
Personality( "Manova" ),
Run( Response Function( "Contrast" ) )
);
obj1 << (Response["Contrast"] << (Effect["Whole Model"] << Save Canonical Scores));
obj1 << (Response["Contrast"] << (Effect["Whole Model"] << Save Canonical Scores));
group1 = dt << Get Column Groups Names;
For( i = 1, i <= N Items( group1 ), i++,
colname = dt << Get Column Group( group1[i] );
If( i == 1, , );
);
Code Explanation:
- Open data table;
- Launch Fit Model platform.
- Set response variables.
- Define model effects.
- Select Manova personality.
- Run model with Contrast.
- Save canonical scores for Whole Model.
- Repeat saving canonical scores.
- Retrieve column group names.
- Loop through each group name.
Example 277
Summary: Analyze and visualize a mixed model with specified effects, extracting random effects covariance parameters, fixed effects parameter estimates, scale estimates, and performing sequential tests.
Code:
dt = Open("data_table.jmp");
obj1 = Fit Model(
Y( :Y ),
Effects( :Age & Excluded, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Random Effects( :Gender, :BP & BSpline( 3, Degree( 3 ) ) ),
Personality( "Mixed Model" ),
Run
);
rpt1 = obj1 << report;
covparms = rpt1["Random Effects Covariance Parameter Estimates"][Table Box( 1 )] << get as matrix;
parmest1 = rpt1["Fixed Effects Parameter Estimates"][Tab Page Box( 1 )][Table Box( 1 )] << get as matrix;
scl = rpt1["Fixed Effects Parameter Estimates"][Table Box( 2 )] << get as matrix;
tests3 = rpt1["Fixed Effects Tests"][Table Box( 1 )] << get as matrix;
obj1 << Sequential Tests( 1 );
tests1 = rpt1["Sequential (Type1) Tests"][Table Box( 1 )] << get as matrix;
obj1 << Predictions;
obj1 << Prediction Formula;
obj1 << Standard Error of Predicted;
obj1 << Mean Confidence Interval;
obj1 << Residuals;
obj1 << Prediction and Interval Formulas;
obj1 << Conditional Predictions;
obj1 << Conditional Prediction Formula;
obj1 << Standard Error of Conditional Predicted;
obj1 << Conditional Mean CI;
obj1 << Conditional Residuals;
saved1 = (dt << get as matrix)[0, 13 :: 27];
obj1 << Save Script to Report;
savedscript1 = rpt1[Text Box( 1 )] << get text;
obj1 << Covariance of Fixed Effects( 1 );
covb = rpt1["Covariance of Fixed Effects"][Matrix Box( 1 )] << get;
obj1 << Correlation of Fixed Effects( 1 );
corrb = rpt1["Correlation of Fixed Effects"][Matrix Box( 1 )] << get;
Code Explanation:
- Open data table;
- Fit mixed model with specified effects.
- Extract random effects covariance parameters.
- Extract fixed effects parameter estimates.
- Extract scale estimates.
- Extract fixed effects tests.
- Perform sequential Type1 tests.
- Extract sequential tests results.
- Generate predictions.
- Extract prediction formula.
Example 278
Summary: Fits and creates reports for mixed models with center polynomials, allowing for comparison of fixed effects estimates.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Yield ),
Effects( :Moisture ),
Random Effects( Intercept[:Variety] & Random Coefficients( 1 ), :Moisture[:Variety] & Random Coefficients( 1 ) ),
Personality( "Mixed Model" ),
Center Polynomials( 1 ),
Run
);
rpt1 = obj1 << report;
obj2 = dt << Fit Model(
Y( :Yield ),
Effects( :Moisture ),
Random Effects( Intercept[:Variety] & Random Coefficients( 1 ), :Moisture[:Variety] & Random Coefficients( 1 ) ),
Personality( "Mixed Model" ),
Center Polynomials( 0 ),
Run
);
rpt2 = obj2 << report;
fixed1 = rpt1[Outline Box( "Fixed Effects Parameter Estimates" )][Table Box( 1 )] << get as matrix;
fixed2 = rpt2[Outline Box( "Fixed Effects Parameter Estimates" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit mixed model with center polynomials.
- Retrieve report from first fit.
- Fit mixed model without center polynomials.
- Retrieve report from second fit.
- Extract fixed effects estimates from first report.
- Extract fixed effects estimates from second report.
Example 279
Summary: Fits and creates reports for two mixed models with different polynomial centering settings, extracting fixed effects matrices from each report.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Yield ),
Effects( Polynomial( :Moisture ) ),
Random Effects( Intercept[:Variety] & Random Coefficients( 1 ), :Moisture[:Variety] & Random Coefficients( 1 ) ),
Personality( "Mixed Model" ),
Center Polynomials( 1 ),
Run
);
rpt1 = obj1 << report;
obj2 = dt << Fit Model(
Y( :Yield ),
Effects( Polynomial( :Moisture ) ),
Random Effects( Intercept[:Variety] & Random Coefficients( 1 ), :Moisture[:Variety] & Random Coefficients( 1 ) ),
Personality( "Mixed Model" ),
Center Polynomials( 0 ),
Run
);
rpt2 = obj2 << report;
fixed1 = rpt1[Outline Box( "Fixed Effects Parameter Estimates" )][Table Box( 1 )] << get as matrix;
fixed2 = rpt2[Outline Box( "Fixed Effects Parameter Estimates" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit mixed model with centered polynomials.
- Retrieve report from first fit.
- Fit mixed model without centered polynomials.
- Retrieve report from second fit.
- Extract fixed effects matrix from first report.
- Extract fixed effects matrix from second report.
Example 280
Summary: Fits and creates reports for mixed models with center polynomials, followed by a second fit without center polynomials, and extracts fixed effects estimates from both reports.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Yield ),
Effects( Polynomial( :Moisture ) ),
Random Effects( :Variety * :Moisture ),
Personality( "Mixed Model" ),
Center Polynomials( 1 ),
Run
);
rpt1 = obj1 << report;
obj2 = dt << Fit Model(
Y( :Yield ),
Effects( Polynomial( :Moisture ) ),
Random Effects( :Variety * :Moisture ),
Personality( "Mixed Model" ),
Center Polynomials( 0 ),
Run
);
rpt2 = obj2 << report;
fixed1 = rpt1[Outline Box( "Fixed Effects Parameter Estimates" )][Table Box( 1 )] << get as matrix;
fixed2 = rpt2[Outline Box( "Fixed Effects Parameter Estimates" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit mixed model with center polynomials.
- Retrieve report from first fit.
- Fit mixed model without center polynomials.
- Retrieve report from second fit.
- Extract fixed effects estimates from first report.
- Extract fixed effects estimates from second report.
Example 281
Summary: Fits and creates reports for mixed models with center polynomials and without, extracting fixed effects estimates from the reports.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Yield ),
Effects( Factorial to Degree( :Moisture, :Variety ) ),
Random Effects( Intercept[:Variety] & Random Coefficients( 1 ), :Moisture[:Variety] & Random Coefficients( 1 ) ),
Personality( "Mixed Model" ),
Center Polynomials( 1 ),
Run
);
rpt1 = obj1 << report;
obj2 = dt << Fit Model(
Y( :Yield ),
Effects( Factorial to Degree( :Moisture, :Variety ) ),
Random Effects( Intercept[:Variety] & Random Coefficients( 1 ), :Moisture[:Variety] & Random Coefficients( 1 ) ),
Personality( "Mixed Model" ),
Center Polynomials( 0 ),
Run
);
rpt2 = obj2 << report;
fixed1 = rpt1[Outline Box( "Fixed Effects Parameter Estimates" )][Table Box( 1 )] << get as matrix;
fixed2 = rpt2[Outline Box( "Fixed Effects Parameter Estimates" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit mixed model with center polynomials.
- Retrieve report from first fit.
- Fit mixed model without center polynomials.
- Retrieve report from second fit.
- Extract fixed effects estimates from first report.
- Extract fixed effects estimates from second report.
Example 282
Summary: Analyze and visualize mixed model results, comparing slopes for the interaction between Fiber Gr and Sugars in a data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Calories ),
Effects( :Fiber Gr, :Sugars, :Fiber Gr * :Sugars ),
Random Effects( :Manufacturer ),
Center Polynomials( 0 ),
NoBounds( 1 ),
Personality( "Mixed Model" ),
Run
);
rpt = obj << report;
obj << Compare Slopes(
Effect( :Fiber Gr * :Sugars ),
Student's t( 1, All Pairwise Comparisons Scatterplot( 0 ) ),
Comparisons with Control(
1,
Control Level( "Fiber Gr: High" ),
Comparisons with Control Decision Chart( Control Differences Chart( 1, Point Options( "Show Needles" ) ) )
),
Tukey HSD( 1 ),
Equivalence Tests( 0.001 )
);
slope est = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Slope Estimates"][Table Box( 1 )] << get as matrix;
slope diff t = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Student's t All Pairwise Comparisons"]["All Pairwise Differences"][
Table Box( 1 )] << get as matrix;
slope diff ctrl level = Substitute( rpt["Slope Comparisons for Fiber Gr*Sugars"]["Comparisons with Control"][Text Box( 3 )] << get text,
"Control = ", "",
", ", ""
);
slope diff ctrl level1 = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Differences from Control"][String Col Box( 1 )] << get;
slope diff ctrl level2 = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Differences from Control"][String Col Box( 2 )] << get;
slope diff ctrl = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Comparisons with Control"]["Differences from Control"][Table Box( 1 )] <<
get as matrix;
dunnett q1 = Parse( Substitute( rpt[Outline Box( "Comparisons with Control" )][Text Box( 1 )] << get text, "Quantile = ", "", ", ", "" ) );
slope diff tukey = rpt["Slope Comparisons for Fiber Gr*Sugars"]["Tukey HSD All Pairwise Comparisons"]["All Pairwise Differences"][
Table Box( 1 )] << get as matrix;
tukey q1 = Parse( Substitute( rpt["Tukey HSD All Pairwise Comparisons"][Text Box( 1 )] << get text, "Quantile = ", "", ", ", "" ) );
Code Explanation:
- Open data table;
- Fit mixed model with Calories as response.
- Include Fiber Gr, Sugars, and their interaction as effects.
- Set Manufacturer as random effect.
- Disable polynomial centering.
- Remove bounds constraints.
- Use Mixed Model personality.
- Run the model.
- Generate model report.
- Compare slopes for Fiber Gr*Sugars interaction.
Example 283
Summary: Fits a mixed model with AR(1) repeated structure and captures log output, utilizing the Fit Model platform in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model( Y( :CO2 ), Effects, Personality( "Mixed Model" ), Repeated Structure( "AR(1)" ), Run );
log = Log Capture( obj << Variogram( Exponential( 1 ) ) );
Code Explanation:
- Open data table;
- Initiate Fit Model platform.
- Set CO2 as response variable.
- Define model personality as Mixed Model.
- Specify AR(1) repeated structure.
- Run the model.
- Capture log output.
- Generate variogram plot.
- Use Exponential model for variogram.
- Display variogram results.
Example 284
Summary: Fits and creates reports for a mixed model with random effects, fixed effects, and center polynomials to analyze the relationship between yield and moisture in a dataset.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Yield ),
Effects( :Moisture, :Moisture * :Moisture ),
Random Effects( Intercept[:Variety] & Random Coefficients( 1 ), :Moisture[:Variety] & Random Coefficients( 1 ) ),
Personality( Mixed Model ),
Center Polynomials( 1 ),
Run
);
rpt = obj << report;
randparm = rpt[Outline Box( "Random Effects Covariance Parameter Estimates" )][Number Col Box( "Estimate" )] << get as matrix;
fixed term = rpt[Outline Box( "Fixed Effects Parameter Estimates" )][String Col Box( "Term" )] << get;
Code Explanation:
- Open table.
- Fit mixed model.
- Set response variable.
- Add fixed effects.
- Define random effects.
- Specify personality.
- Center polynomials.
- Run model.
- Retrieve report.
- Extract random parameters.
Example 285
Summary: Fits and creates reports for a mixed model for miles, incorporating prediction formulas and extracting fit statistics.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Center Polynomials( 0 ),
Personality( Mixed Model ),
Run
);
obj1 << Prediction Formula( 1 );
obj2 = dt << Fit Model(
Y( :Pred Formula miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Center Polynomials( 0 ),
Personality( Mixed Model ),
Run
);
rpt2 = obj2 << report;
fitstat = rpt2[Outline Box( "Fit Statistics" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit mixed model for miles.
- Add prediction formula.
- Fit model using prediction formula.
- Generate report from second fit.
- Extract fit statistics table.
- Convert fit statistics to matrix.
Example 286
Summary: Fits a mixed model with spatial anisotropic structure and spherical type, estimating repeated effects covariance parameter estimates.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Yield ),
Effects,
Center Polynomials( 0 ),
Personality( Mixed Model ),
Repeated Effects( :Row, :Column ),
Repeated Structure( "Spatial Anisotropic" ),
Repeated Structure Type( "Spherical" ),
Run(),
);
rpt = obj << report;
parmest = rpt[Outline Box( "Repeated Effects Covariance Parameter Estimates" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open table.
- Fit mixed model.
- Set response variable.
- Specify effects.
- Disable center polynomials.
- Choose mixed personality.
- Define repeated effects.
- Set spatial anisotropic structure.
- Specify spherical type.
- Retrieve parameter estimates.
Example 287
Summary: Fits a mixed-effects model analysis on a data table, specifying treatment effects and repeated measures structure.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Y ),
Effects(
:Treatment, :Month, :Treatment * :Month, :Name( "AM/PM" ), :Treatment * :Name( "AM/PM" ), :Month * :Name( "AM/PM" ),
:Treatment * :Month * :Name( "AM/PM" )
),
Center Polynomials( 0 ),
Personality( "Mixed Model" ),
Subject( :Patient ),
Repeated Effects( :Time ),
Repeated Structure( "Unstructured" ),
Run
);
dt:Y << Set selected;
dt << Delete Columns;
obj << Variogram( 1 );
Code Explanation:
- Open data table;
- Define model.
- Specify response variable.
- Add effects.
- Disable centering polynomials.
- Choose mixed model personality.
- Set subject variable.
- Define repeated effects.
- Select unstructured repeated structure.
- Run the model.
- Select Y column.
- Delete columns.
- Generate variogram.
Example 288
Summary: Create and execute a mixed model fit to predict weight based on age and height, utilizing linear combination of variance components.
Code:
Open("data_table.jmp");
obj = Fit Model( Y( :weight ), Effects( :age, :height ), Personality( "Mixed Model" ), Run( Linear Combination of Variance Components ) );
Code Explanation:
- Open data table;
- Create Fit Model object.
- Set response variable to weight.
- Add age effect.
- Add height effect.
- Choose Mixed Model personality.
- Run model.
- Calculate linear combination of variance components.
Example 289
Summary: Fits a mixed model to analyze the relationship between treatment, month, and AM/PM time on patient outcomes, with diagnostics for repeated measures covariance.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Y ),
Effects(
:Treatment, :Month, :Month * :Treatment, :"AM/PM"n, :Treatment * :"AM/PM"n, :Month * :"AM/PM"n, :Month * :Treatment * :"AM/PM"n
),
NoBounds( 1 ),
Personality( "Mixed Model" ),
Subject( :Patient ),
Repeated Effects( :Time ),
Repeated Structure( "Unstructured" ),
Run
);
obj << Repeated Measures Covariance Diagnostics( 1 );
rpt = obj << report;
r = rpt["Repeated Measures Covariance Diagnostics"]["Covariance Matrix"][Matrix Box( 1 )] << get;
rcorr = rpt["Repeated Measures Covariance Diagnostics"]["Correlation Matrix"][Matrix Box( 1 )] << get;
rpt["Repeated Measures Covariance Diagnostics"]["Correlation Heat Map"][AxisBox( 1 )] << save to column property;
Code Explanation:
- Open data table;
- Fit mixed model.
- Set response variable.
- Define effects for model.
- Remove bounds constraint.
- Specify mixed model personality.
- Define subject variable.
- Define repeated effects.
- Set repeated structure.
- Run the model.
Example 290
Summary: Runs the creation and retrieval of a partial cubic effects list from a data table, utilizing the Fit Model dialog in JMP.
Code:
dt = Open("data_table.jmp");
dlg = dt << Fit Model( Effects( Partial Cubic( :age, :sex, :height ) ) );
effects list = Report( dlg )[Panel Box( 3 )][ListBoxBox( 1 )] << get items;
Code Explanation:
- Open data table;
- Launch Fit Model dialog.
- Add effects: Partial Cubic(age, sex, height).
- Create dialog reference.
- Access report panel.
- Select ListBoxBox item.
- Retrieve selected items.
- Store effects list.
Example 291
Summary: Fits a linear regression model to a data table, retrieving the report, and extracting summary statistics.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Effects( :height ), Y( :weight ), Personality( "Standard Least Squares" ), Emphasis( "Minimal Report" ), Run );
rpt1 = obj1 << report;
n1 = (rpt1[Outline Box( "Summary of Fit" )][Table Box( 1 )] << get as matrix)[5];
Code Explanation:
- Open data table.
- Fit linear regression model.
- Retrieve model report.
- Extract summary of fit outline.
- Access first table box.
- Convert table to matrix.
- Select fifth row value.
- Assign value to n1 variable.
Example 292
Summary: Analyze a data table by fitting a model with height as an effect, grouping by age, and filtering for females, while generating a minimal report without lack of fit test.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Effects( :height ),
Y( :weight ),
by( :age ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Plot Regression( 0 ), Lack of Fit( 0 ) )
);
obj1[1] << Local Data Filter( Add Filter( columns( :sex ), Include( 1 ), Where( :sex == "F" ) ) );
obj1[2] << Local Data Filter( Add Filter( columns( :sex ), Include( 1 ), Where( :sex == "F" ) ) );
obj1[3] << Local Data Filter( Add Filter( columns( :sex ), Include( 1 ), Where( :sex == "F" ) ) );
obj1[4] << Local Data Filter( Add Filter( columns( :sex ), Include( 1 ), Where( :sex == "F" ) ) );
obj1[5] << Local Data Filter( Add Filter( columns( :sex ), Include( 1 ), Where( :sex == "F" ) ) );
obj1[6] << Local Data Filter( Add Filter( columns( :sex ), Include( 1 ), Where( :sex == "F" ) ) );
Code Explanation:
- Open data table;
- Fit model with height effect.
- Set weight as response variable.
- Group by age.
- Use standard least squares personality.
- Generate minimal report.
- Plot regression without plot.
- Exclude lack of fit test.
- Apply local data filter for females.
- Repeat filter application for all subreports.
Example 293
Summary: Runs a linear regression model to analyze the relationship between age, height, and weight, with interactive filtering by sex.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model( Effects( :age ), Y( :height, :weight ), Personality( "Standard Least Squares" ), Emphasis( "Minimal Report" ), Run );
obj << Local Data Filter( Add Filter( columns( :sex ) ) );
Code Explanation:
- Open table.
- Define model effects.
- Specify response variables.
- Set personality type.
- Choose report emphasis.
- Run the model.
- Add local data filter.
- Specify filter columns.
Example 294
Summary: Fits a linear model to a data table, generating two plots: Actual by Predicted and Pareto Plot of Transformed Estimates.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :height, :sex, :age ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( :weight << {Pareto Plot( 1 ), Plot Actual by Predicted( 1 )} )
);
rpt = obj << report;
Try(
plot1 = rpt[Outline Box( "Actual by Predicted Plot" )] << get title;
plot2 = rpt[Outline Box( "Pareto Plot of Transformed Estimates" )] << get title;
);
Code Explanation:
- Open data table;
- Fit linear model.
- Set response variable.
- Include predictor variables.
- Choose standard least squares.
- Minimal report emphasis.
- Run Pareto plot.
- Run actual by predicted plot.
- Retrieve report object.
- Try to get plot titles.
Example 295
Summary: Runs the fitting and running of two linear regression models, one for the overall data set and another by sex, using standard least squares.
Code:
dt1 = Open("data_table.jmp");
obj1 = dt1 << Fit Model( Y( :height ), Effects( :weight ), Personality( "Standard Least Squares" ), Run, Run );
obj2 = dt1 << Fit Model( Y( :height ), Effects( :weight ), By( :sex ), Personality( "Standard Least Squares" ), Run, Run );
Code Explanation:
- Open data table.
- Fit model on height.
- Use weight as effect.
- Apply standard least squares.
- Run the model.
- Repeat model run.
- Create second model object.
- Fit model by sex.
- Apply standard least squares again.
- Run the second model.
Example 296
Summary: Fits a linear model to predict weight based on height, with a local data filter applied to include only female observations.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Effects( :height ), Y( :weight ), Personality( "Standard Least Squares" ), Emphasis( "Minimal Report" ), Run );
obj1 << Local Data Filter( Add Filter( columns( :sex ), Include( 1 ), Where( :sex == "F" ) ) );
Code Explanation:
- Open data table.
- Fit linear model.
- Specify height as effect.
- Set weight as response.
- Choose standard least squares.
- Request minimal report.
- Run the model.
- Add local data filter.
- Filter by sex column.
- Include only females.
Example 297
Summary: Runs a standard least squares model to analyze the relationship between height and weight, with automatic recalculation enabled and specific rows excluded.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Effects( :height ),
Y( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj << Automatic Recalc( 1 );
dt << Select Rows( Index( 2, 4 ) );
dt << Exclude;
Code Explanation:
- Open data table.
- Define model effects.
- Set response variable.
- Choose modeling personality.
- Set report emphasis.
- Run the model.
- Enable automatic recalculation.
- Select specific rows.
- Exclude selected rows.
Example 298
Summary: Fits and creates reports for two linear models with different effects, retrieving selected options from a combo box.
Code:
dt1 = Open("data_table.jmp");
obj1 = dt1 << Fit Model( Y( :ls ), Personality( "Standard Least Squares" ), );
rpt1 = obj1 << report;
test01 = rpt1[Combo Box( 2 )] << get selected;
obj1 << Effects( :v1, :v2, :v3, :v4, :v5 );
test1 = rpt1[Combo Box( 2 )] << get selected;
obj2 = dt1 << Fit Model( Y( :ls ), Personality( "Standard Least Squares" ), );
rpt2 = obj2 << report;
test02 = rpt2[Combo Box( 2 )] << get selected;
obj2 << Effects( :v1, :v2, :v3, :v4, :v5, :v6, :v7, :v8, :v9, :v10, :v11, :v12 );
test2 = rpt2[Combo Box( 2 )] << get selected;
Code Explanation:
- Open data table;
- Fit model with Y: ls.
- Retrieve report object.
- Get selected option from ComboBox.
- Add effects v1-v5 to model.
- Get updated selected option.
- Fit another model with Y: ls.
- Retrieve new report object.
- Get selected option from ComboBox.
- Add effects v1-v12 to model.
Example 299
Summary: Fits a Nominal Logistic model to predict Edibility based on Gills, Rings, and Color, without likelihood ratio tests or Wald tests.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Edibility ),
Target Level( "edible" ),
Effects( :Gills, :Rings, :Color ),
Personality( Nominal Logistic ),
Run( Likelihood Ratio Tests( 0 ), Wald Tests( 0 ) )
);
t1 = Tick Seconds();
obj << Odds Ratios( 1 );
t2 = Tick Seconds();
test = t2 - t1;
Close( dt, no save );
b group1 = {"Prob for sex", "Prob for sex 2", "Prob for sex 3"};
Code Explanation:
- Open data table;
- Launch Fit Model platform.
- Set Edibility as response variable.
- Specify "edible" as target level.
- Include Gills, Rings, Color as effects.
- Choose Nominal Logistic personality.
- Run model without likelihood and Wald tests.
- Record start time.
- Add Odds Ratios to model.
- Record end time and calculate duration.
Example 300
Summary: Fits and saves a nominal logistic model to predict probabilities for specific target levels, incorporating height and weight effects, and retrieving column group names.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :sex ), Target Level( "F" ), Effects( :height, weight ), Personality( Nominal Logistic ), Run() );
obj1 << Save Probability Formula( 1 );
obj1 << Save Probability Formula( 1 );
obj1 << Save Probability Formula( 1 );
group1 = dt << Get Column Groups Names;
b group2 = {"Prob for sex", "Prob for sex 2", "Prob for sex 3", "Prob for age", "Prob for age 2"};
Code Explanation:
- Open data table.
- Fit nominal logistic model.
- Set target level to "F".
- Include height and weight effects.
- Run the model.
- Save probability formula.
- Save probability formula again.
- Save probability formula once more.
- Retrieve column group names.
- Define group names.
Example 301
Summary: Fits an ordinal logistic model, calculation of odds ratios, and report generation for a new test table.
Code:
dt = Open("data_table.jmp");
obj2 = dt << Fit Model( Y( :age ), Effects( :height, weight ), Personality( Ordinal Logistic ), Run() );
obj2 << Save Probability Formula( 1 );
obj2 << Save Probability Formula( 1 );
group2 = dt << Get Column Groups Names;
Close( dt, no save );
dt = New Table( "Test",
New Column( "Y", Character, Nominal, Values( {"A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "B"} ) ),
New Column( "X1", Nominal, Values( [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1] ) ),
New Column( "X2", Nominal, Values( [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] ) ),
New Column( "X3", Nominal, Values( [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] ) )
);
obj = dt << Fit Model( Y( :Y ), Target Level( "A" ), Effects( :X1, :X2, :X3 ), Personality( Nominal Logistic ), Run() );
obj << Odds Ratios( 1 );
rpt = Report( obj );
rpt[Outline Box( "Odds Ratios for X3" )][Number Col Box( 2 )] << Hide( 0 );
chi2 = rpt[Outline Box( "Odds Ratios for X3" )][Number Col Box( 2 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit ordinal logistic model.
- Save probability formula twice.
- Retrieve column group names.
- Close data table without saving.
- Create new test table.
- Fit nominal logistic model.
- Calculate odds ratios.
- Retrieve report object.
- Hide specific report element.
Example 302
Summary: Fits a nominal logistic model to predict car type based on weight, turning circle, and displacement for Japanese data, saving probability formulas and extracting values.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Type ),
Effects( :Weight, :Turning Circle, :Displacement ),
Where( :Country == "Japan" ),
Personality( "Nominal Logistic" ),
Run
);
obj1 << Save Probability Formula( 1 );
b save1 = (dt:Name( "Prob[Sporty] Where" ) << get values) || (dt:Name( "Prob[Small] Where" ) << get values) || (dt
:Name( "Prob[Compact] Where" ) << get values) || (dt:Name( "Prob[Medium] Where" ) << get values) || (dt:Name( "Prob[Large] Where" ) <<
get values);
Code Explanation:
- Open table.
- Fit nominal logistic model.
- Specify response variable.
- Define effect variables.
- Filter data for Japan.
- Use nominal logistic personality.
- Run the model.
- Save probability formula.
- Extract probability values.
- Concatenate probability arrays.
Example 303
Summary: Fits a nominal logistic model to predict car type based on weight, turning circle, and displacement, with data filtered by country 'USA', and saves the probability formula.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Type ),
Effects( :Weight, :Turning Circle, :Displacement ),
Where( :Country == "USA" ),
Personality( "Nominal Logistic" ),
Run
);
obj1 << Save Probability Formula( 1 );
b save2 = (dt:Name( "Prob[Sporty] Where" ) << get values) || (dt:Name( "Prob[Small] Where" ) << get values) || (dt
:Name( "Prob[Compact] Where" ) << get values) || (dt:Name( "Prob[Medium] Where" ) << get values) || (dt:Name( "Prob[Large] Where" ) <<
get values);
Code Explanation:
- Open data table.
- Define model object.
- Set response variable.
- Specify model effects.
- Filter data for USA.
- Choose nominal logistic personality.
- Run the model.
- Save probability formula.
- Extract probability values.
- Combine probability arrays.
Example 304
Summary: Fits a nominal logistic model to a data table, specifying response and effect variables, applying a filter condition, and saving probability formulas.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Type ),
Effects( :Weight, :Turning Circle, :Displacement ),
Where( :Country == "Other" ),
Personality( "Nominal Logistic" ),
Run
);
obj1 << Save Probability Formula( 1 );
b save3 = (dt:Name( "Prob[Sporty] Where" ) << get values) || (dt:Name( "Prob[Small] Where" ) << get values) || (dt
:Name( "Prob[Compact] Where" ) << get values) || (dt:Name( "Prob[Medium] Where" ) << get values) || (dt:Name( "Prob[Large] Where" ) <<
get values);
Code Explanation:
- Open data table.
- Fit nominal logistic model.
- Specify response variable.
- Define effect variables.
- Apply filter condition.
- Set model personality.
- Execute model fit.
- Save probability formula.
- Retrieve probability values.
- Concatenate probability arrays.
Example 305
Summary: Analyze a data table to fit a nominal logistic model by country, generating probability values for different categories and matching countries to specific groups.
Code:
dt = Open("data_table.jmp");
val = dt:Country << get values;
obj = dt << Fit Model(
Y( :Type ),
Effects( :Weight, :Turning Circle, :Displacement ),
by( :Country ),
Personality( "Nominal Logistic" ),
Run
);
obj << Save Probability Formula( 1 );
save = (dt:Name( "Prob[Sporty] By Country" ) << get values) || (dt:Name( "Prob[Small] By Country" ) << get values) || (dt
:Name( "Prob[Compact] By Country" ) << get values) || (dt:Name( "Prob[Medium] By Country" ) << get values) || (dt
:Name( "Prob[Large] By Country" ) << get values);
For( i = 1, i <= N Items( val ), i++,
Match( val[i], "Japan", , "USA", , "Other", )
);
Code Explanation:
- Open data table.
- Retrieve country values.
- Fit nominal logistic model.
- Save probability formula.
- Concatenate probability values.
- Loop through country values.
- Match country to category.
Example 306
Summary: Fits logistic regression models and extracting parameter estimates from a JMP data table, with the ability to switch between target levels.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :ready ), Target Level( "Ready" ), Effects( :heat, soak ), Freq( :count ), Run );
rpt1 = obj1 << report;
note1 = rpt1[Outline Box( "Parameter Estimates" )][Text Box( 1 )] << get text;
obj2 = dt << Fit Model( Y( :ready ), Target Level( "Not Ready" ), Effects( :heat, soak ), Freq( :count ), Choose High Target( 1 ), Run );
rpt2 = obj2 << report;
note2 = rpt2[Outline Box( "Parameter Estimates" )][Text Box( 1 )] << get text;
Close( dt, no save );
b note1 = "Low/High";
Code Explanation:
- Open table.
- Fit logistic regression.
- Extract parameter estimates.
- Fit logistic regression.
- Extract parameter estimates.
- Close table.
- Set note text.
Example 307
Summary: Fits and analyzes nominal logistic models for edible and ordinal logistic models for age, utilizing JMP's Fit Model platform to generate probability formulas and odds ratios.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Edibility ),
Target Level( "edible" ),
Effects( :Gills, :Rings, :Color ),
Personality( Nominal Logistic ),
Run( Likelihood Ratio Tests( 0 ), Wald Tests( 0 ) )
);
t1 = Tick Seconds();
obj << Odds Ratios( 1 );
t2 = Tick Seconds();
test = t2 - t1;
Close( dt, no save );
b group1 = {"Prob for sex", "Prob for sex 2", "Prob for sex 3"};
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :sex ), Target Level( "F" ), Effects( :height, weight ), Personality( Nominal Logistic ), Run() );
obj1 << Save Probability Formula( 1 );
obj1 << Save Probability Formula( 1 );
obj1 << Save Probability Formula( 1 );
group1 = dt << Get Column Groups Names;
b group2 = {"Prob for sex", "Prob for sex 2", "Prob for sex 3", "Prob for age", "Prob for age 2"};
dt = Open("data_table.jmp");
obj2 = dt << Fit Model( Y( :age ), Effects( :height, weight ), Personality( Ordinal Logistic ), Run() );
obj2 << Save Probability Formula( 1 );
obj2 << Save Probability Formula( 1 );
group2 = dt << Get Column Groups Names;
Code Explanation:
- Open data table;
- Fit nominal logistic model.
- Set target level to edible.
- Include Gills, Rings, Color effects.
- Run model with tests disabled.
- Calculate odds ratios.
- Measure time for odds ratios.
- Close data_table.jmp without saving.
- Define probability groups for sex.
- Open data table;
- Fit nominal logistic model for sex.
- Set target level to F.
- Include height, weight effects.
- Run model.
- Save probability formulas.
- Get column group names.
- Define probability groups for age.
- Open data table;
- Fit ordinal logistic model for age.
- Include height, weight effects.
- Run model.
- Save probability formulas.
- Get column group names.
Example 308
Summary: Fits and creates reports for logistic models for 'Ready' and 'Not Ready' states, retrieving parameter estimates from the data table.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :ready ), Target Level( "Ready" ), Effects( :heat, soak ), Freq( :count ), Run );
rpt1 = obj1 << report;
note1 = rpt1[Outline Box( "Parameter Estimates" )][Text Box( 1 )] << get text;
obj2 = dt << Fit Model( Y( :ready ), Target Level( "Not Ready" ), Effects( :heat, soak ), Freq( :count ), Choose High Target( 1 ), Run );
rpt2 = obj2 << report;
note2 = rpt2[Outline Box( "Parameter Estimates" )][Text Box( 1 )] << get text;
Code Explanation:
- Open data table.
- Fit logistic model for "Ready".
- Retrieve parameter estimates.
- Fit logistic model for "Not Ready".
- Retrieve parameter estimates.
Example 309
Summary: Fits a Nominal Logistic model to predict sex based on weight and height, with likelihood ratio tests and Wald tests enabled.
Code:
Open("data_table.jmp");
obj = Fit Model(
Y( :sex ),
Target Level( "F" ),
Effects( :weight, :height ),
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 0 ), Wald Tests( 1 ), Specify Profit Matrix( [1 -1, -1 1, . .], ) )
);
Code Explanation:
- Open data table.
- Fit model using sex as response.
- Set target level to female.
- Include weight and height as effects.
- Use Nominal Logistic personality.
- Run Likelihood Ratio Tests.
- Enable Wald Tests.
- Specify profit matrix for analysis.
Example 310
Summary: Fits and creates reports for a nominal logistic model with indicator parameterization, extracting parameter estimates from the output.
Code:
dt = Open("data_table.jmp");
obj1 = Fit Model(
Y( :Gender ),
Target Level( "F" ),
Effects( :Brush Delimited, :Toothpaste Cost ),
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 0 ), Wald Tests( 0 ), Indicator Parameterization Estimates( 1 ) )
);
rpt1 = obj1 << report;
parm1 = rpt1[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix;
parm2 = rpt1[Outline Box( "Indicator Function Parameterization" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit nominal logistic model.
- Set response variable.
- Specify target level.
- Define effects.
- Choose personality type.
- Run likelihood ratio tests.
- Run Wald tests.
- Enable indicator parameterization.
- Extract parameter estimates.
Example 311
Summary: Fits a Nominal Logistic model to a data table, generating a report with ROC and Lift curves.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Type ),
Effects( :Weight, :Turning Circle, :Displacement, :Horsepower ),
Personality( "Nominal Logistic" ),
Run( Wald Tests( 0 ), ROC Curve( 1 ), Lift Curve( 1 ) )
);
rpt = obj << report;
roc1 = rpt["Receiver Operating Characteristic on Training Data"][Table Box( 1 )] << get as matrix;
lift1 = (rpt["Lift Curve on Training Data"][FrameBox( 1 )] << FindSegs( LineSeg )) << get x values;
Code Explanation:
- Open data table.
- Launch Fit Model platform.
- Set response variable.
- Add predictor variables.
- Choose Nominal Logistic personality.
- Run model with specified options.
- Retrieve model report.
- Extract ROC curve data.
- Extract Lift curve data.
- Get x-values from Lift curve.
Example 312
Summary: Fits a Nominal Logistic model to a data table, specifying response variables and predictor effects while suppressing reports and adding confidence intervals.
Code:
Open("data_table.jmp");
obj = Fit Model(
Y(
:I am working on my career, :I want to see the world, :My home needs some major improvements,
:I have vast interests outside of work, :I want to get my debt under control, :I come from a large family
),
Effects( :Gender, :Birth Year, :Single Status ),
Personality( "Nominal Logistic" ),
Run( Suppress Reports( 1 ) )
);
obj << Confidence Intervals( 1 );
Code Explanation:
- Open data table.
- Fit Nominal Logistic model.
- Specify response variables.
- Define predictor effects.
- Set personality to Nominal Logistic.
- Suppress reports.
- Run the model.
- Add confidence intervals.
Example 313
Summary: Fits and creates reports for a Nominal Logistic model to analyze the relationship between 'country', 'size', and 'type' variables, while controlling for 'marital status' and 'age'.
Code:
dt = Open("data_table.jmp");
dt << Fit Model(
Y( :country, :size, :type ),
Effects( :marital status, :age ),
Personality( "Nominal Logistic" ),
Run( Suppress Reports, Results in Data Tables )
);
dt2 = Data Table("data_table");
dt3 = Data Table("data_table");
dt4 = Data Table("data_table");
val1 = dt2:Y << get values;
colname1 = Column( dt2, 11 ) << get name;
Close( dt2, no save );
Close( dt3, no save );
Close( dt4, no save );
Close( dt, no save );
b y3 count 1 = [8, 8, 6, 6, 5, 5, 3, 3, 0];
b y3 count 0 = [3, 3, 2, 2, 0];
dt = New Table( "Test",
New Column( "y1", numeric, nominal, values( [0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, ., ., ., ., ., ., ., ., 1, 1, 1, 1, 1, 1] ) ),
New Column( "x1", numeric, values( [5, 9, 7, 8, 4, 5, 6, 7, 4, 9, 9, 2, 3, 5, 9, 10, 1, 4, 5, ., ., ., ., ., .] ) )
);
obj1 = dt << Fit Model( Y( :y1 ), Effects( :x1 ), Target Level( "1" ), Run( Decision Threshold( 1 ) ) );
rpt1 = obj1 << report;
Code Explanation:
- Open data table;
- Fit Nominal Logistic model.
- Extract effect tests data.
- Extract parameter estimates data.
- Extract statistics data.
- Close extracted data tables.
- Close original data table.
- Define count arrays.
- Create new "Test" table.
- Fit logistic model on data_table data.
Example 314
Summary: Fits a Nominal Logistic model to predict sex based on age and height, generating a confusion matrix and decision threshold.
Code:
dt = Open("data_table.jmp");
dt:age[3 :: 4] = .;
obj = dt << Fit Model(
Y( :sex ),
Effects( :age, :height ),
Personality( "Nominal Logistic" ),
Run( Confusion Matrix( 1 ), Decision Threshold( 1 ) )
);
rpt = obj << report;
mtrx1 = rpt["Confusion Matrix"][Table Box( 1 )] << get as matrix;
mtrx2 = rpt["Decision Thresholds"]["Training"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Set age values 3-4 to missing.
- Fit Nominal Logistic model.
- Specify sex as response variable.
- Include age and height as effects.
- Generate confusion matrix.
- Display decision threshold.
- Extract confusion matrix data.
- Retrieve decision thresholds data.
Example 315
Summary: Fits multiple logistic models to a data table, extracting decision thresholds, and saving results in data tables.
Code:
Open("data_table.jmp");
obj = Fit Model(
Y(
:I am working on my career, :I want to see the world, :My home needs some major improvements,
:I have vast interests outside of work, :I want to get my debt under control, :I come from a large family
),
Effects( :Gender, :Birth Year, :Single Status ),
Personality( "Nominal Logistic" ),
Run( Suppress Reports( 1 ) )
);
obj << Confidence Intervals( 1 );
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Y Binary ),
Effects( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Personality( "Nominal Logistic" ),
Target Level( "High" ),
Run( Decision Threshold( 1 ) )
);
rpt1 = obj1 << report;
test1 = rpt1["Decision Thresholds"][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model(
Y( :Y Binary ),
Effects( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Personality( "Nominal Logistic" ),
Run( Decision Threshold( 1 ) )
);
rpt2 = obj2 << report;
test2 = rpt2["Decision Thresholds"][Table Box( 1 )] << get as matrix;
Close( dt, no save );
);
dt = Open("data_table.jmp");
dt << Fit Model(
Y( :country, :size, :type ),
Effects( :marital status, :age ),
Personality( "Nominal Logistic" ),
Run( Suppress Reports, Results in Data Tables )
);
dt2 = Data Table("data_table");
dt3 = Data Table("data_table");
dt4 = Data Table("data_table");
val1 = dt2:Y << get values;
colname1 = Column( dt2, 11 ) << get name;
Code Explanation:
- Open data table;
- Fit nominal logistic model.
- Add confidence intervals.
- Check JMP version.
- Open data table;
- Fit model for binary outcome.
- Extract decision thresholds.
- Fit another model for comparison.
- Extract second set of decision thresholds.
- Close data_table.jmp without saving.
- Open data table;
- Fit nominal logistic model.
- Save results in data tables.
- Access "Fit Nom Effect Tests".
- Access "Fit Nom Parameter Estimates".
- Access "Fit Nom Statistics".
- Retrieve Y values.
- Get column name.
Example 316
Summary: Fits and analyzes ordinal logistic models to predict thread wear based on size of load, with confidence intervals, odds ratios, and parameter estimates.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :Thread Wear ), Effects( :"Size of Load (lbs)"n ), Personality( "Ordinal Logistic" ), Run );
obj1 << Confidence Intervals( 1 );
obj1 << Odds Ratios( 1 );
rpt1 = obj1 << report;
parmest1 = rpt1["Parameter Estimates"][Table Box( 1 )] << get as matrix;
unit OR1 = rpt1["Unit Odds Ratios"][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model(
Y( :Thread Wear ),
Effects( :"Size of Load (lbs)"n ),
Personality( "Ordinal Logistic" ),
Set Alpha Level( 0.05 ),
Run
);
obj2 << Confidence Intervals( 0.1 );
rpt2 = obj2 << report;
parmest2 = rpt2["Parameter Estimates"][Table Box( 1 )] << get as matrix;
parmest2 label = rpt2["Parameter Estimates"][Table Box( 1 )] << get names;
obj2 << Odds Ratios( 1 );
unit OR2 = rpt2["Unit Odds Ratios"][Table Box( 1 )] << get as matrix;
unit OR2 label = rpt2["Unit Odds Ratios"][Table Box( 1 )] << get names;
obj3 = dt << Fit Model( Y( :Thread Wear ), Effects( :"Size of Load (lbs)"n ), Personality( "Ordinal Logistic" ), Run );
obj3 << Odds Ratios;
obj3 << Confidence Intervals( 0.1 );
rpt3 = obj3 << report;
unit OR3 = rpt3["Unit Odds Ratios"][Table Box( 1 )] << get as matrix;
unit OR3 label = rpt3["Unit Odds Ratios"][Table Box( 1 )] << get names;
parmest3 = rpt3["Parameter Estimates"][Table Box( 1 )] << get as matrix;
parmest3 label = rpt3["Parameter Estimates"][Table Box( 1 )] << get names;
obj4 = dt << Fit Model(
Y( :Thread Wear ),
Effects( :"Size of Load (lbs)"n ),
Personality( "Ordinal Logistic" ),
Run( Likelihood Ratio Tests( 0 ), Wald Tests( 1 ) )
);
obj4 << Odds Ratios( 1 );
obj4 << Confidence Intervals( 1 );
rpt4 = obj4 << report;
parmest1 = rpt1["Parameter Estimates"][Table Box( 1 )] << get as matrix;
unit OR4 = rpt4["Unit Odds Ratios"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Enable confidence intervals.
- Enable odds ratios.
- Retrieve parameter estimates.
- Retrieve unit odds ratios.
- Fit ordinal logistic model again.
- Set alpha level to 0.05.
- Enable confidence intervals.
- Retrieve parameter estimates and labels.
- Enable odds ratios.
- Retrieve unit odds ratios and labels.
- Fit ordinal logistic model.
- Enable odds ratios.
- Enable confidence intervals.
- Retrieve unit odds ratios and labels.
- Retrieve parameter estimates and labels.
- Fit ordinal logistic model.
- Enable likelihood ratio tests.
- Enable Wald tests.
- Enable odds ratios.
- Enable confidence intervals.
- Retrieve parameter estimates.
- Retrieve unit odds ratios.
Example 317
Summary: Fits an ordinal logistic model to a data table, generating odds ratios and confidence intervals for analysis.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :Thread Wear ), Effects( :"Size of Load (lbs)"n, :Method ), Personality( "Ordinal Logistic" ), Run );
obj1 << Confidence Intervals( 0.1 );
obj1 << Odds Ratios;
rpt1 = obj1 << report;
parmest1 = rpt1["Parameter Estimates"][Table Box( 1 )] << get as matrix;
unit OR1 = rpt1["Unit Odds Ratios"][Table Box( 1 )] << get as matrix;
OR1 = rpt1["Odds Ratios for Method"][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model( Y( :Thread Wear ), Effects( :"Size of Load (lbs)"n, :Method ), Personality( "Ordinal Logistic" ), Run );
obj2 << Odds Ratios;
obj2 << Confidence Intervals( 0.1 );
rpt2 = obj2 << report;
parmest2 = rpt2["Parameter Estimates"][Table Box( 1 )] << get as matrix;
unit OR2 = rpt2["Unit Odds Ratios"][Table Box( 1 )] << get as matrix;
OR2 = rpt2["Odds Ratios for Method"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Set confidence level to 0.1.
- Calculate odds ratios.
- Retrieve parameter estimates.
- Retrieve unit odds ratios.
- Retrieve odds ratios for method.
- Fit ordinal logistic model again.
- Calculate odds ratios.
- Set confidence level to 0.1.
Example 318
Summary: Fits a parametric survival model to a data table, retrieving the title and text from the last window.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model( Personality( "Parametric Survival" ) );
winTtl = Window( N Items( Window() ) - 1 ) << get window title;
winObj = Window( N Items( Window() ) - 1 );
winTxt = winObj[Text Box( 4 )] << get text;
Code Explanation:
- Open data table.
- Fit parametric survival model.
- Get last window title.
- Get last window object.
- Extract text from fourth text box.
Example 319
Summary: Fits two Partial Least Squares models with specified effects and validation methods, generating cross-validation statistics and saving validation results.
Code:
dt1 = Open("data_table.jmp");
obj1 = dt1 << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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
),
Center Polynomials( 0 ),
Personality( "Partial Least Squares" ),
Run(
Set Random Seed( 123 ),
Initial Number of Factors( 15 ),
Validation Method( Holdback( 0.2 ), Initial Number of Factors( 15 ) ),
Fit( Method( NIPALS ) )
),
SendToReport( Dispatch( {}, "Model Launch", OutlineBox, {Close( 1 )} ) )
);
rpt1 = obj1 << report;
fitstat1 = rpt1["Crossvalidation"][Table Box( 1 )] << get as matrix;
obj1 << (Fit[1] << Save Validation);
obj2 = dt1 << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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( :Validation ),
Center Polynomials( 0 ),
Personality( "Partial Least Squares" ),
Run( Fit( Method( NIPALS ) ) ),
SendToReport( Dispatch( {}, "Model Launch", OutlineBox, {Close( 1 )} ) )
);
rpt2 = obj2 << report;
fitstat2 = rpt2["Crossvalidation"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit model with specified effects.
- Use Partial Least Squares personality.
- Set random seed for reproducibility.
- Specify initial number of factors.
- Use holdback validation method.
- Fit model using NIPALS method.
- Close model launch outline box.
- Retrieve cross-validation statistics.
- Save validation results.
Example 320
Summary: Fits and creates reports for partial least squares models with variable importance plots, utilizing leave-one-out validation and multiple factor selection methods.
Code:
dt2 = Open("data_table.jmp");
obj = dt2 << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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
),
Personality( "Partial Least Squares" ),
Run(
Validation Method( "Leave-One-Out" ),
Fit( SVD( Classical ), Method( NIPALS ), Variable Importance Plot( 1 ), Set VIP Threshold( 1.5 ) ),
Fit( SVD( Classical ), Method( SIMPLS ), Number of Factors( 3 ), Variable Importance Plot( 1 ), Set VIP Threshold( 0.95 ) )
)
);
rpt = obj << report;
befAA = Associative Array( Window() << get window title );
obj << (Fit[1] << Make Model Using VIP( 1 ));
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
dl1 = Window( aftlst[1] );
item1 = dl1[ListBoxBox( 7 )] << get items;
dl1 << Close Window;
befAA = Associative Array( Window() << get window title );
obj << (Fit[2] << Make Model Using VIP( 1 ));
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
dl2 = Window( aftlst[1] );
item2 = dl2[ListBoxBox( 7 )] << get items;
dl2 << Close Window;
Code Explanation:
- Open data table.
- Fit partial least squares model.
- Set response variables.
- Include all effects.
- Use leave-one-out validation.
- Fit using classical SVD and NIPALS method.
- Generate variable importance plot.
- Set VIP threshold to 1.5.
- Fit using classical SVD and SIMPLS method.
- Set number of factors to 3.
- Generate variable importance plot.
- Set VIP threshold to 0.95.
- Create model using VIP for first fit.
- Track changes in window titles.
- Extract items from list box.
- Close the window.
- Create model using VIP for second fit.
- Track changes in window titles.
- Extract items from list box.
- Close the window.
Example 321
Summary: Executes two Partial Least Squares (PLS) models with different methods and settings, generating Variable Importance Plots and retrieving items from ListBoxBoxes.
Code:
dt2 = Open("data_table.jmp");
obj = dt2 << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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
),
Personality( "Partial Least Squares" ),
Run(
Validation Method( "Leave-One-Out" ),
Fit( Method( NIPALS ), Variable Importance Plot( 1 ), Set VIP Threshold( 1.5 ) ),
Fit( Method( SIMPLS ), Number of Factors( 3 ), Variable Importance Plot( 1 ), Set VIP Threshold( 0.95 ) )
)
);
rpt = obj << report;
befAA = Associative Array( Window() << get window title );
obj << (Fit[1] << Make Model Using VIP( 1 ));
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
dl1 = Window( aftlst[1] );
item1 = dl1[ListBoxBox( 7 )] << get items;
dl1 << Close Window;
befAA = Associative Array( Window() << get window title );
obj << (Fit[2] << Make Model Using VIP( 1 ));
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
dl2 = Window( aftlst[1] );
item2 = dl2[ListBoxBox( 7 )] << get items;
dl2 << Close Window;
Code Explanation:
- Open data table;
- Launch Fit Model platform.
- Set response variables: ls, ha, dt.
- Include all v1-v27 as effects.
- Choose Partial Least Squares personality.
- Run model with Leave-One-Out validation.
- Fit using NIPALS method.
- Generate Variable Importance Plot.
- Set VIP threshold to 1.5.
- Fit using SIMPLS method.
- Specify 3 factors.
- Generate Variable Importance Plot.
- Set VIP threshold to 0.95.
- Create model using NIPALS VIP.
- Capture window titles before creation.
- Retrieve items from ListBoxBox.
- Close the window.
- Create model using SIMPLS VIP.
- Capture window titles before creation.
- Retrieve items from ListBoxBox.
- Close the window.
Example 322
Summary: Fits a proportional hazard model to analyze the relationship between age, diagnosis time, KPS, and cell type on patient survival time.
Code:
dt2 = Open("data_table.jmp");
SASllike = 1011.7679126;
SASWaldChiSq = [0.3788401066, 0.1171207076, 33.927925265, 17.581698537];
SASage = [-0.005609572, 0.0091138477, 0.9944061321];
SASdiag = [0.0027993762, 0.0081798326, 1.0028032981];
SASkps = [-0.031655029, 0.005434556, 0.9688407461];
SASgroup1 = [1.1749616964, 0.2953908715, 3.2380189137];
SASgroup2 = [0.321381871, 0.2766246669, 1.3790320927];
SASgroup3 = [0.7157058488, 0.2535332216, 2.0456300784];
obj = dt2 << Fit Model(
Y( :Time ),
Effects( :Age, :Diag Time, :KPS, :Cell Type ),
Personality( "Proportional Hazard" ),
Censor( :censor ),
Run Model( Risk Ratios( 1 ) )
);
rpt = obj << report;
vallist = (rpt[Number Col Box( "-LogLikelihood" )] << get as matrix);
vallist = (rpt[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix);
vallist = (rpt[Outline Box( "Effect Likelihood Ratio Tests" )][Table Box( 1 )] << get as matrix);
Code Explanation:
- Open data table.
- Define SAS likelihood value.
- Define SAS Wald Chi-Square values.
- Define SAS age coefficients.
- Define SAS diagnosis coefficients.
- Define SAS KPS coefficients.
- Define SAS group1 coefficients.
- Define SAS group2 coefficients.
- Define SAS group3 coefficients.
- Fit proportional hazard model.
Example 323
Summary: Fits and creates reports for two proportional hazard models, extracting parameter estimates from each model's output.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Time ),
Effects( :Cell Type, :Treatment, :Prior, :Age, :Diag Time, :KPS ),
No Intercept,
Personality( "Proportional Hazard" ),
Censor( :censor ),
Run( Risk Ratios( 1 ) )
);
rpt1 = obj1 << report;
est1 = (rpt1[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix)[0, 1 :: 4];
obj2 = dt << Fit Model(
Y( :Time ),
Effects( :Cell Type, :Treatment, :Prior, :Age, :Diag Time, :KPS ),
Personality( "Proportional Hazard" ),
Censor( :censor ),
Run( Risk Ratios( 1 ) )
);
rpt2 = obj2 << report;
est2 = (rpt2[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix)[0, 1 :: 4];
Code Explanation:
- Open table.
- Fit proportional hazard model.
- Extract parameter estimates.
- Fit proportional hazard model again.
- Extract parameter estimates.
Example 324
Summary: Fits a proportional hazard model to a data table, extracting estimates and converting them to a matrix.
Code:
dt = Open("data_table.jmp");
plat = dt << Fit Model(
Y( :Time ),
Effects( :Treatment, :Cell Type, :Age ),
Censor( :censor ),
Personality( "Proportional Hazard" ),
Run Model
);
r = Report( plat );
Actual = r[Number Col Box( "Estimate" )] << GetAsMatrix;
Code Explanation:
- Open data table.
- Launch Fit Model platform.
- Set response variable.
- Add effects to model.
- Specify censoring variable.
- Choose Proportional Hazard personality.
- Run the model.
- Retrieve report object.
- Extract Estimate column box.
- Convert estimates to matrix.
Example 325
Summary: Fits a proportional hazard model to analyze the relationship between days and group, while accounting for censoring, and generates a report with unit and range risk ratios.
Code:
dt = Open("data_table.jmp");
plat = dt << Fit Model(
Y( :days ),
Effects( :Group ),
Personality( "Proportional Hazard" ),
Censor( :Censor ),
Run( Unit Risk Ratios( 1 ), Range Risk Ratios( 1 ) ),
);
r = Report( plat );
Actual = r["Whole Model"][Table Box( 3 )] << GetAsMatrix;
Code Explanation:
- Open data table.
- Fit proportional hazard model.
- Set response variable.
- Include group effect.
- Specify censor variable.
- Run unit risk ratios.
- Run range risk ratios.
- Retrieve report object.
- Access whole model summary.
- Extract third table box as matrix.
Example 326
Summary: Fits a proportional hazard model to analyze the relationship between Time, Treatment, Cell Type, and Age, while accounting for censoring.
Code:
dt = Open("data_table.jmp");
plat = dt << Fit Model(
Y( :Time ),
Effects( :Treatment, :Cell Type, :Age ),
Censor( :censor ),
Personality( "Proportional Hazard" ),
Run Model( Risk Ratios( 1 ) )
);
r = Report( plat );
Actual = r[Number Col Box( "Estimate" )] << GetAsMatrix;
Code Explanation:
- Open data table.
- Launch Fit Model platform.
- Set response variable.
- Specify model effects.
- Define censor variable.
- Choose proportional hazard personality.
- Run the model with risk ratios.
- Retrieve report object.
- Extract estimate column box.
- Convert estimates to matrix.
Example 327
Summary: Fits a linear model to predict outcomes, extracting variance components, parameter estimates, and test results from a data table.
Code:
dt = Open("data_table.jmp");
obj1 = Fit Model(
Y( :Y ),
Effects( :Age & Excluded, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Random Effects( :Gender, :BP & BSpline( 3, Degree( 3 ) ) ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
);
rpt1 = obj1 << report;
covparms = rpt1["REML Variance Component Estimates"][Table Box( 1 )] << get as matrix;
parmest1 = rpt1["Parameter Estimates"][Table Box( 1 )] << get as matrix;
tests3 = rpt1["Fixed Effect Tests"][Table Box( 1 )] << get as matrix;
obj1 << Predicted Values;
obj1 << Prediction Formula;
obj1 << Std Error of Predicted;
obj1 << StdErr Pred Formula;
obj1 << Mean Confidence Interval;
obj1 << Residuals;
obj1 << Prediction and Interval Formulas;
obj1 << Conditional Pred Values;
obj1 << Conditional Pred Formula;
obj1 << Conditional Mean CI;
obj1 << Conditional Residuals;
saved1 = (dt << get as matrix)[0, 13 :: 27];
obj1 << Save Script to Report;
savedscript1 = rpt1[Text Box( 1 )] << get text;
Code Explanation:
- Open data table;
- Fit linear model.
- Specify response variable.
- Define fixed effects.
- Define random effects.
- Use REML method.
- Generate report.
- Extract variance components.
- Extract parameter estimates.
- Extract test results.
Example 328
Summary: Fits a model with specified effects, using Standard Least Squares personality and REML method, while suppressing certain plots and calculating a contrast CI.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( Standard Least Squares ),
Emphasis( Effect Leverage ),
Method( REML ),
Run(
:miles << {Analysis of Variance( 0 ), Lack of Fit( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 ), {:species * :season << {LSMeans Contrast( [1 0 0 0 -1 0 0 0] )}}}
)
);
rpt = obj << report;
b contrast ci = (3 - 1.15470053837925 * t Quantile( 0.975, 11.1293146824999 )) |/ (3 + 1.15470053837925 *
t Quantile( 0.975, 11.1293146824999 ));
label1 = rpt["Test Detail"][String Col Box( 2 )] << get;
test1 = rpt["Test Detail"][Number Col Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit model with specified effects.
- Use Standard Least Squares personality.
- Focus on Effect Leverage emphasis.
- Employ REML method for fitting.
- Suppress Analysis of Variance.
- Disable Lack of Fit analysis.
- Enable Plot Actual by Predicted.
- Disable other plots.
- Calculate b contrast CI.
Example 329
Summary: Analyze a data table by fitting a model with specified parameters, including effects for sex and weight, and emphasizing effect leverage, while grouping by age.
Code:
dt = Open("data_table.jmp");
dt:height[38 :: 40] = .;
Fit Model(
Y( :height ),
Effects( :sex & Random, :weight ),
Personality( Standard Least Squares ),
Method( REML ),
Emphasis( Effect Leverage ),
By( age ),
Run Model( 1 )
);
dt:height[2] = .;
Code Explanation:
- Open data table.
- Set height values to missing for rows 38-40.
- Fit model with specified parameters.
- Use height as response variable.
- Include sex and weight as effects.
- Use standard least squares personality.
- Apply REML method.
- Focus on effect leverage emphasis.
- Group analysis by age.
- Run the model.
- Set height value to missing for row 2.
Example 330
Summary: Fits a linear model to predict ratings, incorporating machine and person effects, with standard least squares personality, and saves confidence intervals.
Code:
dt = Open("data_table.jmp");
fm = Fit Model(
Y( :rating ),
Effects( :machine, :person & Random, :machine * :person & Random ),
Personality( Standard Least Squares ),
Run Model
);
fm << Save Columns( Mean Confidence Interval, Indiv Confidence Interval, Conditional Mean CI, Conditional Indiv CI );
m = dt << get as matrix;
Code Explanation:
- Open data table;
- Fit model with rating as response.
- Include machine, person, and interaction effects.
- Use standard least squares personality.
- Run the model.
- Save mean confidence interval.
- Save individual confidence interval.
- Save conditional mean confidence interval.
- Save conditional individual confidence interval.
- Convert data table to matrix.
Example 331
Summary: Fits a model to predict ratings, incorporating machine and person effects with randomization, and saving confidence intervals for mean and individual predictions.
Code:
dt = Open("data_table.jmp");
fm = Fit Model(
Y( :rating ),
Effects( :machine, :person & Random, :machine * :person & Random ),
Personality( Standard Least Squares ),
Run Model
);
fm << Save Columns(
Mean Confidence Interval( .01 ),
Indiv Confidence Interval( .01 ),
Conditional Mean CI( .01 ),
Conditional Indiv CI( .01 )
);
rpt = fm << report;
m = dt << get as matrix;
Code Explanation:
- Open data table;
- Fit model with rating as response.
- Include machine, person & Random, and interaction effects.
- Use Standard Least Squares personality.
- Run the model.
- Save mean confidence intervals.
- Save individual confidence intervals.
- Save conditional mean CIs.
- Save conditional individual CIs.
- Get report from model.
Example 332
Summary: Fits a model with specified effects, generating a report, and extracting a prediction profiler outline box.
Code:
dt = Open("data_table.jmp");
fm = Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( Standard Least Squares ),
Run Model
);
fm << Profiler( 1 );
rpt = Report( fm );
jrn = rpt[Outline Box( "Prediction Profiler" )] << get journal;
Code Explanation:
- Open table.
- Fit model with specified effects.
- Use standard least squares personality.
- Run the model.
- Create profiler.
- Generate report from model.
- Extract prediction profiler outline box.
- Get journal from outline box.
Example 333
Summary: Analyze a data table using Fit Model to define a linear mixed effects model, generating minimal reports and saving standard error columns.
Code:
dt = Open("data_table.jmp");
fm = Fit Model(
Y( :Y ),
Effects( :Tenderizer, :Carcass, :Tenderizer * :Carcass & Random, :Roasting Time, :Roasting Time * :Tenderizer ),
Personality( Standard Least Squares ),
Method( REML ),
Set Alpha Level( 0.05 ),
Emphasis( Minimal Report ),
Run(
:Y << {Analysis of Variance( 0 ), Lack of Fit( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
Plot Residual by Predicted( 0 ), Plot Effect Leverage( 1 )}
)
);
fm << Save Columns( StdErr Pred Formula );
fm << Save Columns( Std Error of Predicted );
fcol = dt:PredSE Y << get values;
nfcol = dt:StdErr Pred Y << get values;
form = dt:PredSE Y << Get Property( Formula );
dfz = dt:PredSE Y << Get Property( DF );
Code Explanation:
- Open data table;
- Define model with specified effects.
- Use Standard Least Squares personality.
- Apply REML method.
- Set alpha level to 0.05.
- Generate minimal report.
- Configure analysis options.
- Save standard error columns.
- Retrieve predicted SE values.
- Extract formula and degrees of freedom.
Example 334
Summary: Fits a mixed model to predict weight and height based on age, sex, and random effects, while disabling plots for both responses.
Code:
dt = Open("data_table.jmp");
fm = Fit Model(
Y( :weight, :height ),
Effects( :age, :sex & Random ),
Personality( Standard Least Squares ),
Run(
:weight << {Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )},
:height << {Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )}
)
);
Fit Group[1] << Profiler( 1 );
fg = ((fm[1] << get container) << parent) << parent;
pp = (fg << child) << sib;
jrn = pp << get journal;
Close( dt, No Save );
Try( fg << close window );
If( Contains( JMP Product Name(), "Pro" ) > 0,
b log1 =
"Warning: Fit Least Squares no longer supports radial effects. The Mixed Model personality of Fit Model does fit radial effects in a different way.",
b log1 = "Warning: Fit Least Squares no longer supports radial effects."
);
dt = New Table( "Test",
New Column( "X1", Values( [1, 1, 2, 2, 3, 4, 5, 8, 9] ) ),
New Column( "X2", Values( [1, 4, 2, 15, 34, 41, 15, 80, 50] ) ),
New Column( "Y", Values( [1, 2, 4, 5, 8, 7, 4, 9, 1] ) )
);
log1 = Log Capture(
fm = Fit Model( Y( :Y ), Effects( Radial( :X1, :X2 ) & Random ), Personality( Standard Least Squares ), Method( REML ), Run )
);
Close( dt, No Save );
If( Contains( JMP Product Name(), "Pro" ) > 0,
b log1 =
"Warning: Fit Least Squares no longer supports radial effects. The Mixed Model personality of Fit Model does fit radial effects in a different way.",
b log1 = "Warning: Fit Least Squares no longer supports radial effects."
);
Random Reset( 1111111 );
dt = New Table( "Test2",
AddRows( 100 ),
New Column( "X1", Formula( Random Uniform() ) ),
New Column( "X2", Formula( Random Uniform() ) ),
New Column( "Y", Formula( X1 + X2 + Random Normal() / 5 ) )
);
dt << Run Formulas;
log1 = Log Capture( plat = Fit Model( Y( :Y ), Effects( Radial( :X1, :X2 ) & Random ), Run ) );
Code Explanation:
- Open data table.
- Fit model with weight and height as responses.
- Include age and sex as effects.
- Use standard least squares personality.
- Disable plots for weight and height.
- Create profiler for first fit group.
- Retrieve fit model container.
- Get parent window.
- Close data table without saving.
- Close fit model window if open.
Example 335
Summary: Fits multiple linear models to a data table, extracting X matrices, and calculating hat matrices.
Code:
dt = Open("data_table.jmp");
fm = Fit Model( Y( :Measurement ), Effects(), Run );
x = fm << Get X Matrix;
xpx = fm << Get XPX Inverse;
hmat = x * xpx * x`;
hb = hb0 = Vec Diag( hmat );
fm << Save Columns( Hats );
hact = Column( dt, N Cols( dt ) ) << Get Values;
Try( dt << Delete Column( :h Measurement ) );
fm << close window;
fm1 = Fit Model( Y( :Measurement ), Effects( :Operator & Random, :part# & Random, :Operator * :part# & Random ), Run );
fm1 << Save Columns( Hats );
hact = Column( dt, N Cols( dt ) ) << Get Values;
Try( dt << Delete Column( :h Measurement ) );
fm1 << close window;
fm2 = Fit Model( Y( :Measurement ), Effects( :Operator, :part#, :Operator * :part# ), Run );
fm2 << Save Columns( Hats );
hact = Column( dt, N Cols( dt ) ) << Get Values;
x = fm2 << Get X Matrix;
xpx = fm2 << Get XPX Inverse;
hmat = x * xpx * x`;
hb = Vec Diag( hmat );
Code Explanation:
- Open data table.
- Fit empty model.
- Extract X matrix.
- Compute XPX inverse.
- Calculate hat matrix.
- Extract diagonal elements.
- Save hats to data table.
- Retrieve saved hats.
- Remove existing hat column.
- Close model window.
Example 336
Summary: Fits a model to predict height based on sex, weight, and age, with residuals saved for further analysis.
Code:
dt = Open("data_table.jmp");
dt:height[38 :: 40] = .;
Fit Model(
Y( :height ),
Effects( :sex & Random, :weight ),
Personality( Standard Least Squares ),
Method( REML ),
Emphasis( Effect Leverage ),
By( age ),
Run Model( Save Columns( Residuals ) )
);
Fit Model(
Y( :height ),
Effects( :sex & Random, :weight ),
Personality( Standard Least Squares ),
Method( REML ),
Emphasis( Effect Leverage ),
By( age ),
Run Model( Save Columns( Residuals ) )
);
Code Explanation:
- Open data table;
- Set height values 38-40 to missing.
- Fit model with height as response.
- Include sex & Random, weight as effects.
- Use Standard Least Squares personality.
- Employ REML method.
- Focus on Effect Leverage emphasis.
- Group by age.
- Save residuals to dataset.
- Repeat steps 3-9.
Example 337
Summary: Runs a Fit Model analysis to predict weight and height based on age, sex, and random effects, utilizing Standard Least Squares personality.
Code:
dt = Open("data_table.jmp");
fm = Fit Model(
Y( :weight, :height ),
Effects( :age, :sex & Random ),
Personality( Standard Least Squares ),
Run(
:weight << {Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )},
:height << {Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )}
)
);
Fit Group[1] << Profiler( 1 );
fg = ((fm[1] << get container) << parent) << parent;
pp = (fg << child) << sib;
jrn = pp << get journal;
Code Explanation:
- Open data table;
- Initiate Fit Model platform.
- Set response variables: weight, height.
- Define effects: age, sex as random.
- Use Standard Least Squares personality.
- Disable plots for weight predictions.
- Disable plots for height predictions.
- Create profiler for first model.
- Navigate to model's container.
- Retrieve journal from profiler's parent.
Example 338
Summary: Fits multiple linear models with varying effects, retrieving X matrices, and calculating hat matrices.
Code:
dt = Open("data_table.jmp");
fm0 = Fit Model( Y( :Name( " Y" ) ), Effects(), Run );
x = fm0 << Get X Matrix;
xpx = fm0 << Get XPX Inverse;
hmat = x * xpx * x`;
hb0 = Vec Diag( hmat );
fm0 << Save Columns( Hats );
hact = Column( dt, N Cols( dt ) ) << Get Values;
Try( dt << Delete Column( :h Y ) );
fm0 << close window;
fm = Fit Model( Y( :Name( " Y" ) ), Effects( :Operator, :Part[:Operator] ), Run );
x = fm << Get X Matrix;
xpx = fm << Get XPX Inverse;
hmat = x * xpx * x`;
hb = Vec Diag( hmat );
fm << Save Columns( Hats );
hact = Column( dt, N Cols( dt ) ) << Get Values;
Try( dt << Delete Column( :h Y ) );
fm << close window;
fm1 = Fit Model( Y( :Name( " Y" ) ), Effects( :Operator & Random, :Part[:Operator] & Random ), Run );
fm1 << Save Columns( Hats );
hact = Column( dt, N Cols( dt ) ) << Get Values;
Try( dt << Delete Column( :h Y ) );
fm1 << close window;
Code Explanation:
- Open data table.
- Fit empty model.
- Retrieve X matrix.
- Calculate XPX inverse.
- Compute hat matrix.
- Extract diagonal elements.
- Save hats column.
- Retrieve actual hats.
- Delete existing hats column.
- Close empty model window.
- Fit model with fixed effects.
- Retrieve X matrix.
- Calculate XPX inverse.
- Compute hat matrix.
- Extract diagonal elements.
- Save hats column.
- Retrieve actual hats.
- Delete existing hats column.
- Close fixed effects model window.
- Fit model with random effects.
- Save hats column.
- Retrieve actual hats.
- Delete existing hats column.
- Close random effects model window.
Example 339
Summary: Fits a model to predict height, incorporating age and random weight effects, with conditional predictions enabled for profiling.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :height ),
Effects( :age, :weight & Random ),
Personality( Standard Least Squares ),
Method( REML ),
Emphasis( Effect Leverage ),
Run()
);
obj1 << Profiler( 1, Conditional Predictions( 1 ) );
rpt1 = Report( obj1 );
text1 = rpt1[Outline Box( "Prediction Profiler" )][AxisBox( 3 )] << get text;
Code Explanation:
- Open data table;
- Fit model with height as response.
- Include age and random weight effects.
- Use standard least squares personality.
- Apply REML method.
- Focus on effect leverage.
- Run the model.
- Create profiler for the model.
- Enable conditional predictions.
- Extract text from prediction profiler axis.
Example 340
Summary: Analyze and visualize a linear mixed-effects model to compare LSMeans differences between seasons, utilizing the Fit Model dialog in JMP.
Code:
dt = Open("data_table.jmp");
dlg = dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Standard Least Squares" ),
Method( "REML" )
);
obj = dlg << Run( :season << {LSMeans Tukey HSD( 1 )} );
rpt = obj << report;
q1 = rpt[Outline Box( "Effect Details" )][Outline Box( "season" )][Outline Box( "LSMeans Differences Tukey HSD" )][Numberbox( 2 )] <<
get text;
Code Explanation:
- Open data table;
- Launch Fit Model dialog.
- Set response variable to "miles".
- Add effects: species, subject nested in species random, season, interaction species*season.
- Choose Standard Least Squares personality.
- Use REML method.
- Run model with Tukey HSD for season LSMeans.
- Retrieve model report object.
- Access "Effect Details" outline box.
- Extract text from season LSMeans differences Tukey HSD p-value.
Example 341
Summary: Calculates and visualizes LSMeans differences using Tukey HSD post-hoc test for season, within a Fit Model dialog in JMP.
Code:
b diff = [-2.33333333333333 0.641901111571742 12 -3.63503550822649 0.00341901926308975 0.0156224952339201 0.05 -3.7319157106035
-0.934750956063169 -4.23900652207623 -0.427660144590442,
-1.5 0.641901111571742 12 -2.33680854100274 0.0376028859651221 0.143871279201253 0.05 -2.89858237727017 -0.101417622729834
-3.40567318874289 0.405673188742892,
1.33333333333334 0.641901111571742 12 2.077163147558 0.0599232741765273 0.215115820160972 0.05 -0.0652490439368294 2.7319157106035
-0.572339855409556 3.23900652207623,
0.833333333333335 0.641901111571742 12 1.29822696722375 0.218606218568194 0.58107630466973 0.05 -0.565249043936831 2.2319157106035
-1.07233985540956 2.73900652207623,
3.66666666666667 0.641901111571742 12 5.71219865578449 0.0000972441187268471 0.000487455383364699 0.05 2.2680842893965 5.06524904393684
1.76099347792378 5.57233985540956,
2.83333333333334 0.641901111571742 12 4.41397168856074 0.000844457562111378 0.00405138015228368 0.05 1.43475095606317 4.2319157106035
0.927660144590445 4.73900652207623];
b q1 = (b diff[1, 11] - b diff[1, 1]) :/ b diff[1, 2];
dt = Open("data_table.jmp");
dlg = dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Standard Least Squares" ),
Method( "REML" )
);
obj = dlg << Run( :season << {LSMeans Tukey HSD( 1 )} );
rpt = obj << report;
q1 = rpt[Outline Box( "Effect Details" )][Outline Box( "season" )][Outline Box( "LSMeans Differences Tukey HSD" )][Numberbox( 2 )] <<
get text;
Code Explanation:
- Define matrix
b diff. - Calculate
b q1using matrix elements. - Open data table;
- Launch Fit Model dialog.
- Set response variable to "miles".
- Add effects: species, subject within species (random), season, species*season interaction.
- Choose "Standard Least Squares" personality.
- Use REML method for estimation.
- Run model with Tukey HSD post-hoc test for season.
- Extract LSMeans differences Tukey HSD value.
Example 342
Summary: Fits a linear mixed-effects model to analyze miles as a response variable, incorporating species and season effects, with subject[:species] as a random effect, using REML method and Standard Least Squares personality.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run(
:miles << {Analysis of Variance( 0 ), Lack of Fit( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 ), {:subject[:species] <<
{LSMeans Tukey HSD( 0.05, Ordered Differences Report( 1 ) )}}}
),
SendToReport(
Dispatch( {"Response miles"}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response miles"}, "Summary of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response miles"}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response miles"}, "REML Variance Component Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response miles"}, "Effect Details", OutlineBox, {Close( 0 )} )
)
);
rpt = obj << report;
q1 = Parse( rpt[Outline Box( "subject[species]" )][Outline Box( "LSMeans Differences Tukey HSD" )][NumberBox( 2 )] << get text );
diff1 = rpt[Outline Box( "LSMeans Differences Tukey HSD" )][Table Box( 2 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit model with miles as response.
- Include species, season, and interaction effects.
- Specify subject[:species] as random effect.
- Use Standard Least Squares personality.
- Employ REML method for estimation.
- Minimal report emphasis.
- Suppress analysis outputs.
- Enable LSMeans Tukey HSD for subject[:species].
- Retrieve and parse LSMeans differences text and matrix.
Example 343
Summary: Analyzes and creates reports for a mixed-effects model with random effects for Operator, Part#, and their interaction, using REML method and Tukey HSD for LSMeans differences.
Code:
Open("data_table.jmp");
obj = Fit Model(
Y( :Measurement ),
Random Effects( :Operator, :part#, :Operator * :part# ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Method( "REML" ),
Run(
:Measurement << {{:Operator << {LSMeans Tukey HSD( 0.05 )}, :part# << {LSMeans Tukey HSD( 0.05 )}, :Operator * :part# <<
{LSMeans Tukey HSD( 0.05 )}}}
)
);
rpt = obj << report;
df1 = Parse(
Reverse(
Words( Trim( rpt[Outline Box( "Operator" )][Outline Box( "LSMeans Differences Tukey HSD" )][Text Box( 2 )] << get text ), "=" )
)[1]
);
df2 = Parse(
Reverse( Words( Trim( rpt[Outline Box( "Part#" )][Outline Box( "LSMeans Differences Tukey HSD" )][Text Box( 2 )] << get text ), "=" ) )
[1]
);
df3 = Parse(
Reverse(
Words(
Trim( rpt[Outline Box( "Operator*part#" )][Outline Box( "LSMeans Differences Tukey HSD" )][Text Box( 2 )] << get text ),
"="
)
)[1]
);
Code Explanation:
- Open data file.
- Define model with response variable.
- Specify random effects.
- Set personality to standard least squares.
- Minimize report emphasis.
- Use REML method.
- Run model with LSMeans Tukey HSD.
- Extract report object.
- Parse degrees of freedom for Operator.
- Parse degrees of freedom for Part#.
Example 344
Summary: Analyze and extract degrees of freedom from a fitted model, utilizing REML method and specifying random effects for Operator and Part[Operator].
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :Y ),
Random Effects( :Operator, :Part[:Operator] ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Method( "REML" ),
Run( :Y << {{:Operator << {LSMeans Tukey HSD( 0.05 )}, :Part[:Operator] << {LSMeans Tukey HSD( 0.05 )}}} )
);
rpt = obj << report;
df1 = Parse(
Reverse(
Words( Trim( rpt[Outline Box( "Operator" )][Outline Box( "LSMeans Differences Tukey HSD" )][Text Box( 2 )] << get text ), "=" )
)[1]
);
df2 = Parse(
Reverse(
Words(
Trim( rpt[Outline Box( "Part[Operator]" )][Outline Box( "LSMeans Differences Tukey HSD" )][Text Box( 2 )] << get text ),
"="
)
)[1]
);
Code Explanation:
- Open table.
- Fit model with REML.
- Specify random effects.
- Set personality to SLR.
- Minimize report emphasis.
- Run analysis.
- Extract report object.
- Parse Operator LSMeans.
- Parse Part[Operator] LSMeans.
- Retrieve degrees of freedom.
Example 345
Summary: Fits and creates reports for a linear mixed effects model with random effects for person and machine*person, using Standard Least Squares personality and Tukey HSD for LSMeans.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :rating ),
Effects( :machine ),
Random Effects( :person, :machine * :person ),
Personality( "Standard Least Squares" ),
Run( :rating << {{:person << {LSMeans Tukey HSD( 0.05 )}, :machine * :person << {LSMeans Tukey HSD( 0.05 )}}} )
);
rpt = obj << report;
df1 = Parse(
Reverse(
Words( Trim( rpt[Outline Box( "person" )][Outline Box( "LSMeans Differences Tukey HSD" )][Text Box( 2 )] << get text ), "=" )
)[1]
);
df2 = Parse(
Reverse(
Words(
Trim( rpt[Outline Box( "machine*person" )][Outline Box( "LSMeans Differences Tukey HSD" )][Text Box( 2 )] << get text ),
"="
)
)[1]
);
Code Explanation:
- Open data table;
- Fit model with rating as Y.
- Include machine as effect.
- Add person and machine*person as random effects.
- Use Standard Least Squares personality.
- Run model with Tukey HSD for LSMeans.
- Retrieve model report.
- Extract degrees of freedom for person.
- Extract degrees of freedom for machine*person.
Example 346
Summary: Runs the fitting and profiling of two models with Yield as response, including Moisture as effect and Variety and Moisture:Variety as random effects, using JMP's Fit Model platform.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :Yield ), Effects( :Moisture ), Random Effects( :Variety, :Moisture[:Variety] ), Run );
obj1 << Profiler( 1, Conditional Predictions( 1 ), Simulator( 1 ) );
obj1 << Plot Regression( 0 );
obj1 << Scroll Window;
obj2 = dt << Fit Model( Y( :Yield ), Effects( :Moisture ), Random Effects( :Variety, :Moisture[:Variety] ), Run );
obj2 << Profiler( 1, Simulator( 1 ), Conditional Predictions( 1 ) );
obj2 << Plot Regression( 0 );
obj2 << Scroll Window;
Code Explanation:
- Open data table;
- Fit model with Yield as response.
- Include Moisture as effect.
- Add Variety and Moisture:Variety as random effects.
- Run the model.
- Create profiler with conditional predictions.
- Enable simulator in profiler.
- Disable plot regression.
- Scroll to window.
- Repeat steps 2-9 for another model.
Example 347
Summary: Fits a linear mixed effects model to analyze the relationship between tenderizer, carcass, and roasting time on Y, with random effects for the interaction between tenderizer and carcass.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :Y ),
Effects( :Tenderizer, :Carcass, :Roasting Time, :Roasting Time * :Tenderizer ),
Random Effects( :Tenderizer * :Carcass ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run
);
rpt = obj << report;
note1 = Trim( rpt["Effect Summary"][String Col Box( 2 )] << get text );
note2 = rpt["Effect Summary"][Text Box( 1 )] << get text;
Code Explanation:
- Open table.
- Fit model.
- Set response variable.
- Define fixed effects.
- Define random effects.
- Disable bounds.
- Choose personality.
- Select method.
- Set emphasis.
- Execute model.
Example 348
Summary: Fits multiple models to a data table, extracting report and matrix results, and visualizing the findings.
Code:
dt = Open("data_table.jmp");
obj2 = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex ),
Personality( Stepwise ),
Run( All Possible Models( 6, 15, Heredity Restriction( 1 ) ) )
);
rpt2 = obj2 << report;
test2 = rpt2[Outline Box( "All Possible Models" )][Table Box( 1 )] << get as matrix;
obj4 = dt << Fit Model(
Y( :weight ),
Effects( :height, :sex, :height * :sex ),
Personality( Stepwise ),
Run( All Possible Models( 3, 3, Heredity Restriction( 1 ) ) )
);
rpt4 = obj4 << report;
test4 = rpt4[Outline Box( "All Possible Models" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit model with weight as response.
- Include age and sex as effects.
- Use stepwise personality.
- Run all possible models with specified parameters.
- Extract report from model fit.
- Get matrix of all possible models results.
- Fit another model with weight as response.
- Include height, sex, and interaction as effects.
- Extract matrix of all possible models results.
Example 349
Summary: Fits a model to predict Oxy values based on Runtime, Weight, and RunPulse effects, excluding intercept, using stepwise personality and generating a report.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Oxy ),
Effects( :Runtime, :Weight, :RunPulse ),
No Intercept( 1 ),
Personality( Stepwise ),
Run( All Possible Models( 3, 6 ) )
);
obj << Enter All;
rpt = Report( obj );
rpt[Radio Box( 2 )] << set( 7 );
Code Explanation:
- Open data table;
- Fit model with Oxy as response.
- Include Runtime, Weight, RunPulse effects.
- Exclude intercept from model.
- Use stepwise personality.
- Run all possible models with 3-6 terms.
- Enter all selected models.
- Generate report from model object.
- Set radio box to 7th option.
- End script execution.
Example 350
Summary: Fits a model to predict height based on weight and age, while grouping by sex, using stepwise personality and generating reports with button box interactions.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model( Y( :height ), Effects( :weight, :age ), By( :sex ), Personality( Stepwise ), Run() );
befAA = Associative Array( Window() << get window title );
Report( obj[1] )[Button Box( 2 )] << click;
rpt2 = Report( obj[1] )[Button Box( 6 )] << click;
Report( obj[2] )[Button Box( 2 )] << click;
rpt2 = Report( obj[2] )[Button Box( 6 )] << click;
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Code Explanation:
- Open data table;
- Fit model with height as response.
- Include weight and age as effects.
- Use sex for grouping.
- Apply stepwise personality.
- Run the model.
- Create associative array before analysis.
- Click on second button box in report.
- Click on sixth button box in report.
- Create associative array after analysis.
Example 351
Summary: Fits a model with Oxy and Runtime as Y, including effects for Weight, RunPulse, RstPulse, and MaxPulse, grouped by sex, using Stepwise personality, and then interacts with reports to remove and make models.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model( Y( :Oxy, :Runtime ), Effects( :Weight, :RunPulse, :RstPulse, :MaxPulse ), By( :sex ), Personality( Stepwise ), Run );
befAA = Associative Array( Window() << get window title );
Report( obj[1] )[Button Box( 2 )] << click;
rpt2 = Report( obj[1] )[Button Box( 6 )] << click;
Report( obj[2] )[Button Box( 2 )] << click;
rpt2 = Report( obj[2] )[Button Box( 6 )] << click;
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Code Explanation:
- Open data table;
- Fit model with Oxy, Runtime as Y.
- Include Weight, RunPulse, RstPulse, MaxPulse effects.
- Group by sex variable.
- Use Stepwise personality.
- Run the model.
- Create associative array of current windows.
- Click "Remove" button in first report.
- Click "Make Model" button in first report.
- Click "Remove" button in second report.
- Click "Make Model" button in second report.
- Create associative array of updated windows.
- Remove original windows from updated array.
- Get keys of remaining windows.
Example 352
Summary: Runs stepwise regression analysis with varying stopping rules and probability thresholds, generating reports for each scenario.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Sex ),
Effects( :Age, :Weight, :Oxy, :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
Personality( "Stepwise" ),
Run( Stopping Rule( "P-value Threshold" ), Prob to Leave( 0.35 ), Direction( "Mixed" ), Rules( "No Rules" ) )
);
rpt1 = Report( obj1 );
prob1 = rpt1[Outline Box( "Stepwise Regression Control" )][Number Col Edit Box( 1 )] << get;
rule1 = rpt1[Outline Box( "Stepwise Regression Control" )][Combo Box( 3 )] << get selected;
obj2 = dt << Fit Model(
Y( :Sex ),
Effects( :Age, :Weight, :Oxy, :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
Personality( "Stepwise" ),
Run( Prob to Leave( 0.35 ), Stopping Rule( "P-value Threshold" ), Direction( "Mixed" ), Rules( "Whole Effects" ) )
);
rpt2 = Report( obj2 );
prob2 = rpt2[Outline Box( "Stepwise Regression Control" )][Number Col Edit Box( 1 )] << get;
rule2 = rpt2[Outline Box( "Stepwise Regression Control" )][Combo Box( 3 )] << get selected;
obj3 = dt << Fit Model(
Y( :Sex ),
Effects( :Age, :Weight, :Oxy, :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
Personality( "Stepwise" ),
Run( Prob to Leave( 0.35 ), Direction( "Mixed" ), Stopping Rule( "P-value
Threshold" ), Rules( "Restrict" ) )
);
rpt3 = Report( obj3 );
prob3 = rpt1[Outline Box( "Stepwise Regression Control" )][Number Col Edit Box( 1 )] << get;
rule3 = rpt3[Outline Box( "Stepwise Regression Control" )][Combo Box( 3 )] << get selected;
obj4 = dt << Fit Model(
Y( :Sex ),
Effects( :Age, :Weight, :Oxy, :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
Personality( "Stepwise" ),
Run( Direction( "Mixed" ), Prob to Leave( 0.35 ), Stopping Rule( "P-value
Threshold" ) )
);
rpt4 = Report( obj4 );
prob4 = rpt4[Outline Box( "Stepwise Regression Control" )][Number Col Edit Box( 1 )] << get;
rule4 = rpt4[Outline Box( "Stepwise Regression Control" )][Combo Box( 3 )] << get selected;
Code Explanation:
- Open data table;
- Fit model with Sex as response.
- Use Age, Weight, Oxy, Runtime, RunPulse, RstPulse, MaxPulse as effects.
- Apply Stepwise personality.
- Set stopping rule to P-value Threshold.
- Set Prob to Leave to 0.35.
- Set direction to Mixed.
- Set rules to No Rules.
- Generate report from first model.
- Extract probability threshold and rule from first report.
- Repeat steps 2-10 for different rule settings.
- Extract results for each scenario.
Example 353
Summary: Fits a stepwise model for Speed2, retrieving and extracting summary text and missing values matrix, and refitting the model after excluding selected rows.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :Speed2 ), Effects( :Height, :Weight, :Fat, :Neck, :Bench ), Personality( "Stepwise" ), Run );
rpt1 = Report( obj1 );
txt1 = rpt1[Outline Box( "Stepwise Regression Control" )][String Col Box( 1 )] << get;
miss1 = rpt1[Outline Box( "Stepwise Regression Control" )][Table Box( 1 )] << get as matrix;
r = dt << select rows( [1, 2, 3] );
r << Exclude;
obj2 = dt << Fit Model( Y( :Speed2 ), Effects( :Height, :Weight, :Fat, :Neck, :Bench ), Personality( "Stepwise" ), Run );
rpt2 = Report( obj2 );
txt2 = rpt2[Outline Box( "Stepwise Regression Control" )][String Col Box( 1 )] << get;
miss2 = rpt2[Outline Box( "Stepwise Regression Control" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Fit stepwise model for Speed2.
- Retrieve stepwise report.
- Extract stepwise summary text.
- Extract stepwise missing values matrix.
- Select first three rows.
- Exclude selected rows.
- Refit stepwise model for Speed2.
- Retrieve new stepwise report.
- Extract new stepwise summary text.
Example 354
Summary: Fits a model with stepwise personality, running K-Fold Crossvalidation, and extracting R² values from reports in JMP.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Horsepower ),
Effects( :Weight, :Turning Circle ),
Personality( Stepwise ),
Set Alpha Level( 0.05 ),
Run( Finish, Name( "K-Fold Crossvalidation" )(116) )
);
rpt1 = Report( obj1 );
KfoldR2 = (rpt1[Outline Box( "Step History" )][Table Box( 1 )] << get as matrix)[0, 9];
obj2 = dt << Fit Model(
Y( :Horsepower ),
Effects( :Weight, :Turning Circle ),
Personality( Stepwise ),
Set Alpha Level( 0.05 ),
Run( Name( "K-Fold Crossvalidation" )(116), Finish )
);
rpt2 = Report( obj2 );
KfoldR2 2 = (rpt2[Outline Box( "Step History" )][Table Box( 1 )] << get as matrix)[0, 9];
Code Explanation:
- Open data table.
- Fit model with stepwise personality.
- Set alpha level to 0.05.
- Run K-Fold Crossvalidation.
- Extract R² from report.
- Fit model again with stepwise personality.
- Set alpha level to 0.05.
- Run K-Fold Crossvalidation.
- Extract R² from report.
- Store both R² values.
Example 355
Summary: Runs a stepwise linear regression model to predict height based on age, weight, and their interaction, grouped by sex, using the Fit Model platform in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :height ),
Effects( :age, :weight, :age * :weight ),
Personality( "Stepwise" ),
By( :sex ),
Run( Stopping Rule( "P-value Threshold" ), Direction( "Backward" ) ),
);
obj << Enter all( 1 );
obj << Finish( 1 );
obj << Run Model( 1 );
Close( dt, no save );
b fratio1 = [0, 285681.652644516, 999999, 0.00799966737158615];
b fratio2 = [0, 285681.652644516, 999999, 4.01473373231686];
Code Explanation:
- Open table.
- Define model with height as Y.
- Include age, weight, and interaction.
- Use Stepwise personality.
- Group by sex.
- Set stopping rule and direction.
- Enter all effects.
- Finish model setup.
- Run the model.
- Close table without saving.
Example 356
Summary: Performs the stepwise regression analysis of MaxPulse data, generating reports and extracting statistics.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :MaxPulse ),
Effects(
:Age & RS, :Weight & RS, :Oxy & RS, :Runtime & RS, :Age * :Age, :Age * :Weight, :Weight * :Weight, :Age * :Oxy, :Weight * :Oxy,
:Oxy * :Oxy, :Age * :Runtime, :Weight * :Runtime, :Oxy * :Runtime, :Runtime * :Runtime
),
Personality( "Stepwise" ),
Run
);
rpt1 = obj1 << report;
rpt1[Button Box( 7 )] << click;
stat1 = rpt1[Outline Box( "Stepwise Fit for MaxPulse" )][Table Box( 2 )] << get as matrix;
obj2 = dt << Fit Model(
Y( :MaxPulse ),
Effects(
:Age & RS, :Weight & RS, :Oxy & RS, :Runtime & RS, :Age * :Age, :Age * :Weight, :Weight * :Weight, :Age * :Oxy, :Weight * :Oxy,
:Oxy * :Oxy, :Age * :Runtime, :Weight * :Runtime, :Oxy * :Runtime, :Runtime * :Runtime
),
Personality( "Stepwise" ),
Run( Plot Criterion History( 1 ) )
);
rpt2 = obj2 << report;
rpt2[Button Box( 7 )] << click;
stat2 = rpt2[Outline Box( "Stepwise Fit for MaxPulse" )][Table Box( 2 )] << get as matrix;
obj3 = dt << Fit Model(
Y( :MaxPulse ),
Effects(
:Age & RS, :Weight & RS, :Oxy & RS, :Runtime & RS, :Age * :Age, :Age * :Weight, :Weight * :Weight, :Age * :Oxy, :Weight * :Oxy,
:Oxy * :Oxy, :Age * :Runtime, :Weight * :Runtime, :Oxy * :Runtime, :Runtime * :Runtime
),
Personality( "Stepwise" ),
Run( Plot Criterion History( 1 ) )
);
rpt3 = obj3 << report;
rpt3[Outline Box( "Current Estimates" )] << Close( 1 );
rpt3[Button Box( 7 )] << click;
stat3 = rpt3[Outline Box( "Stepwise Fit for MaxPulse" )][Table Box( 2 )] << get as matrix;
rpt3[Button Box( 9 )] << click;
rpt3[Outline Box( "Step History" )] << Close( 1 );
rpt3[Button Box( 7 )] << click;
Code Explanation:
- Open data table.
- Fit model with MaxPulse as response.
- Use Stepwise personality.
- Run the model.
- Get report object.
- Click on button box 7.
- Extract stepwise fit statistics.
- Fit another model with same settings.
- Plot criterion history.
- Extract stepwise fit statistics again.
Example 357
Summary: Fits a model to predict height using age, weight, and their interaction as predictors, with stepwise selection and backward elimination.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :height ),
Effects( :age, :weight, :age * :weight ),
Personality( "Stepwise" ),
By( :sex ),
Run( Stopping Rule( "P-value Threshold" ), Direction( "Backward" ) ),
);
obj << Enter all( 1 );
obj << Finish( 1 );
obj << Run Model( 1 );
Code Explanation:
- Open data table.
- Fit model using height as response.
- Include age, weight, and interaction effects.
- Use stepwise personality.
- Group analysis by sex.
- Set stopping rule to P-value threshold.
- Perform backward elimination.
- Enter all models.
- Finish model selection.
- Run the selected model.
Example 358
Summary: Performs the stepwise regression analysis for MaxPulse data, generating two reports with statistics and enabling Plot Criterion History.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :MaxPulse ),
Effects(
:Age & RS, :Weight & RS, :Oxy & RS, :Runtime & RS, :Age * :Age, :Age * :Weight, :Weight * :Weight, :Age * :Oxy, :Weight * :Oxy,
:Oxy * :Oxy, :Age * :Runtime, :Weight * :Runtime, :Oxy * :Runtime, :Runtime * :Runtime
),
Personality( "Stepwise" ),
Run
);
rpt1 = obj1 << report;
rpt1[Button Box( 7 )] << click;
stat1 = rpt1[Outline Box( "Stepwise Fit for MaxPulse" )][Table Box( 2 )] << get as matrix;
obj2 = dt << Fit Model(
Y( :MaxPulse ),
Effects(
:Age & RS, :Weight & RS, :Oxy & RS, :Runtime & RS, :Age * :Age, :Age * :Weight, :Weight * :Weight, :Age * :Oxy, :Weight * :Oxy,
:Oxy * :Oxy, :Age * :Runtime, :Weight * :Runtime, :Oxy * :Runtime, :Runtime * :Runtime
),
Personality( "Stepwise" ),
Run( Plot Criterion History( 1 ) )
);
rpt2 = obj2 << report;
rpt2[Button Box( 7 )] << click;
stat2 = rpt2[Outline Box( "Stepwise Fit for MaxPulse" )][Table Box( 2 )] << get as matrix;
obj3 = dt << Fit Model(
Y( :MaxPulse ),
Effects(
:Age & RS, :Weight & RS, :Oxy & RS, :Runtime & RS, :Age * :Age, :Age * :Weight, :Weight * :Weight, :Age * :Oxy, :Weight * :Oxy,
:Oxy * :Oxy, :Age * :Runtime, :Weight * :Runtime, :Oxy * :Runtime, :Runtime * :Runtime
),
Personality( "Stepwise" ),
Run( Plot Criterion History( 1 ) )
);
rpt3 = obj3 << report;
Code Explanation:
- Open data table.
- Fit model with Stepwise personality.
- Retrieve report object.
- Click "Go" button in report.
- Extract statistics from report.
- Fit model again with Stepwise personality.
- Enable Plot Criterion History.
- Retrieve second report object.
- Click "Go" button in second report.
- Extract statistics from second report.
Example 359
Summary: Fits a linear model to predict height based on age, sex, and weight, generating a report with minimal emphasis.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :height ),
Effects( :age, :sex, :weight ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run()
);
rpt = Report( obj );
Code Explanation:
- Open data table.
- Fit linear model.
- Set response variable.
- Add predictor variables.
- Choose personality method.
- Set report emphasis.
- Execute model fit.
- Retrieve report object.
Example 360
Summary: Fits a logistic model to data, generating a report, and performing bootstrap analysis, while also capturing window titles and splitting data by specified columns.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model( Y( :sex ), Effects( :age, :weight, :height ), Personality( Nominal Logistic ), Run() );
rpt = Report( obj );
befAA = Associative Array( Window() << get window title );
rpt[Outline Box( "Fit Details" )][Number Col Box( 1 )] << Bootstrap(
5,
Fractional Weights( 0 ),
Discard Stacked Table if Split Works( 0 )
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
first table = dt;
bt2 = first table << get as matrix;
b last table = first table << Split(
Split By( :sex ),
Split( :height ),
Group( :age ),
Remaining Columns( Drop All ),
Sort by Value Order
);
Code Explanation:
- Open data table.
- Fit logistic model.
- Create report object.
- Capture initial window titles.
- Perform bootstrap analysis.
- Capture updated window titles.
- Remove unchanged titles.
- Extract new window titles.
- Retrieve original data matrix.
- Split data by specified columns.
Example 361
Summary: Fits a loglinear variance model to a data table, predicting shrinkage values, and extracting the predicting property.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Shrinkage ),
Effects( :MoldTemp, :Screw Speed, :MoldTemp * :Screw Speed, :Hold Time & LogVariance ),
Personality( "Loglinear Variance" ),
Run
);
obj << Save Columns( Prediction Formula( 1 ) );
prop1 = dt:Shrinkage Mean << get Property( "Predicting" );
Code Explanation:
- Open data table.
- Define response variable.
- Define effects for model.
- Set model personality.
- Run fit model.
- Save prediction formula.
- Get predicting property.
Example 362
Summary: Fits a multivariate model with MANOVA personality, including main effects and interaction terms, to predict response variables in a JMP data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
Effects( :drug, :dep1, :drug * :dep1 ),
Personality( "Manova" ),
Run( Response Function( "Contrast" ) )
);
obj << Save Predicted( 1 );
prop1 = dt:Pred LogHist0 << get property( "Predicting" );
Code Explanation:
- Open data table;
- Fit multivariate model.
- Set response variables.
- Include main effects.
- Add interaction effect.
- Use MANOVA personality.
- Run contrast analysis.
- Save predicted values.
- Retrieve predicting property.
- Assign to prop1 variable.
Example 363
Summary: Fits a Partial Least Squares model to a data table, specifying effects and retrieving fit measures from the first fit object.
Code:
dt = Open("data_table.jmp");
obj1 = Fit Model(
Y( :Yield ),
Effects(
:Methanol, :Ethanol, :Propanol, :Butanol, :pH, :Time, :Methanol * :Methanol, :Ethanol * :Methanol, :Ethanol * :Ethanol,
:Propanol * :Methanol, :Propanol * :Ethanol, :Propanol * :Propanol, :Butanol * :Methanol, :Butanol * :Ethanol, :Butanol * :Propanol,
:Butanol * :Butanol, :pH * :Methanol, :pH * :Ethanol, :pH * :Propanol, :pH * :Butanol, :pH * :pH, :Time * :Methanol,
:Time * :Ethanol, :Time * :Propanol, :Time * :Butanol, :Time * :pH, :Time * :Time
),
Personality( "Partial Least Squares" ),
Run( Fit )
);
obj1 << (Fit[1] << get measures);
Code Explanation:
- Open data table.
- Define model with response variable.
- Specify effects for analysis.
- Choose Partial Least Squares personality.
- Run the fit model.
- Retrieve fit measures from first fit object.
Example 364
Summary: Analyze and visualize a linear regression model to predict height based on weight, with emphasis on effect leverage and confidence intervals.
Code:
Open("data_table.jmp");
obj = Fit Model(
Y( :height ),
Effects( :weight ),
Personality( Standard Least Squares ),
Emphasis( Effect Leverage ),
Run Model(
:height << {Plot Actual by Predicted( 1 ), Plot Regression( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )}
)
);
obj << prediction formula;
obj << stdErr pred formula;
obj = Profiler(
Y( :Pred Formula height, :PredSE height ),
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
Pred Formula height << Response Limits(
{Lower( 55, 0.066 ), Middle( 63.75, 0.5 ), Upper( 72.5, 0.9819 ), Goal( Maximize ), Importance( 1 )}
),
Term Value( weight( 120 ) )
),
Use SE Formula( 1 )
);
Code Explanation:
- Open data table;
- Fit model with height as Y.
- Add weight as effect.
- Use standard least squares personality.
- Emphasize effect leverage.
- Run model with specified plots.
- Extract prediction formula.
- Extract standard error prediction formula.
- Create profiler for prediction formulas.
- Set profiler options and limits.
Example 365
Summary: Fits a linear model to predict height based on weight, with emphasis on effect leverage and visualization of plots, prediction formulas, and standard error formulas.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :height ),
Effects( :weight ),
Personality( Standard Least Squares ),
Emphasis( Effect Leverage ),
Run Model(
:height << {Plot Actual by Predicted( 1 ), Plot Regression( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )}
)
);
obj << prediction formula;
obj << stdErr pred formula;
obj = Profiler(
Y( :Pred Formula height, :PredSE height ),
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
Pred Formula height << Response Limits(
{Lower( 55, 0.066 ), Middle( 63.75, 0.5 ), Upper( 72.5, 0.9819 ), Goal( Maximize ), Importance( 1 )}
),
Term Value( weight( 120 ) )
),
Use SE Formula( 1 )
);
rpt = obj << report;
Code Explanation:
- Open data table.
- Fit linear model with height as Y.
- Include weight as effect.
- Set personality to standard least squares.
- Emphasize effect leverage.
- Run model with specified plots.
- Add prediction formula to model.
- Add standard error formula to model.
- Create profiler for prediction formulas.
- Configure profiler settings and limits.
Example 366
Summary: Fits a model with multiple responses, generating prediction and standard error formulas, and creating a profiler for predictions.
Code:
Open("data_table.jmp");
obj = Fit Model(
Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ),
Effects(
:SILICA & RS, :SILANE & RS, :SULFUR & RS, :SILICA * :SILICA, :SILANE * :SILICA, :SILANE * :SILANE, :SULFUR * :SILICA,
:SULFUR * :SILANE, :SULFUR * :SULFUR
),
Personality( "Standard Least Squares" ),
Run Model(
:ABRASION << {Scaled Estimates( 1 ), Plot Actual by Predicted( 1 )},
:MODULUS << {Scaled Estimates( 1 ), Plot Actual by Predicted( 1 )},
:ELONG << {Scaled Estimates( 1 ), Plot Actual by Predicted( 1 )},
:HARDNESS << {Scaled Estimates( 1 ), Plot Actual by Predicted( 1 )}
)
);
obj << prediction formula;
obj << stdErr pred formula;
obj = Profiler(
Y( :Pred Formula ABRASION, :Pred Formula MODULUS, :Pred Formula ELONG, :Pred Formula HARDNESS ),
Profiler(
1,
Desirability Functions( 1 ),
Pred Formula ABRASION << Response Limits(
{Lower( 100, 0.066 ), Middle( 150, 0.5 ), Upper( 200, 0.9819 ), Goal( Maximize ), Importance( 0.25 )}
),
Pred Formula MODULUS << Response Limits(
{Lower( 1000, 0.066 ), Middle( 1500, 0.5 ), Upper( 2000, 0.9819 ), Goal( Maximize ), Importance( 0.25 )}
),
Pred Formula ELONG << Response Limits(
{Lower( 450, 0.0183 ), Middle( 500, 1 ), Upper( 550, 0.0183 ), Goal( Match Target ), Importance( 0.25 )}
),
Pred Formula HARDNESS << Response Limits(
{Lower( 65, 0.0183 ), Middle( 67.5, 1 ), Upper( 70, 0.0183 ), Goal( Match Target ), Importance( 0.25 )}
),
Term Value( SILICA( 1.25 ), SILANE( 50 ), SULFUR( 2.25 ) ),
Simulator(
1,
Factors(
SILICA << Random( Normal( 1.25, 0.3266 ) ), SILANE << Random( Normal( 50, 6.532 ) ),
SULFUR << Random( Normal( 2.25, 0.3266 ) )
),
Responses(
Pred Formula ABRASION << No Noise, Pred Formula MODULUS << No Noise, Pred Formula ELONG << No Noise,
Pred Formula HARDNESS << No Noise
)
)
),
SendToReport( Dispatch( {"Prediction Profiler"}, "Simulator", OutlineBox, Close( 1 ) ) )
);
Code Explanation:
- Open data table;
- Fit model with multiple responses.
- Specify response variables.
- Define model effects.
- Set personality to standard least squares.
- Run model for each response.
- Generate prediction formulas.
- Generate standard error formulas.
- Create profiler for predictions.
- Configure profiler settings and limits.
Example 367
Summary: Fits a nominal logistic model, running a prediction profiler, and saving bagged predictions in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model( Y( :sex ), Effects( :height, :weight ), Personality( "Nominal Logistic" ), Run( Profiler( 1 ) ) );
rpt = obj << report;
scptObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object;
scptObj << Save Bagged Predictions( 2 );
n = dt << Get Column Names( string );
col1 = Contains( n, "Pred Formula sex=M Bagged Mean" );
col2 = Contains( n, "sex=M Bootstrap Std Err" );
col3 = Contains( n, "StdError sex=M Bagged Mean" );
Code Explanation:
- Open data table.
- Fit nominal logistic model.
- Run prediction profiler.
- Retrieve report object.
- Access prediction profiler outline box.
- Get scriptable object.
- Save bagged predictions.
- Get column names from data table.
- Check for "Pred Formula sex=M Bagged Mean".
- Check for "sex=M Bootstrap Std Err".
- Check for "StdError sex=M Bagged Mean".
Example 368
Summary: Runs a regression analysis to predict height based on age, sex, and weight, with minimal reporting and bagged predictions, while ensuring reproducibility through random seeding.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :height ),
Effects( :age, :sex, :weight ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run( Profiler( Save Bagged Predictions( 2, Random Seed( 12345 ) ) ) )
);
latest = Column( 8 ) << getasmatrix;
Close( dt, nosave );
previous = [107.296386796026, 118.880827902028, 117.631012957427, 180.228036572534, 101.707530620837, 131.178240427961, 134.078348558084,
153.54576996098, 99.0560149107187, 156.009845512103, 102.871396088845, 163.247295467457, 163.655558208347, 150.262368291464,
135.529673542059, 138.643995319214, 135.767024502089, 134.377803249253, 136.595545330826, 136.641050544328];
Code Explanation:
- Open data table.
- Fit model with height as response.
- Include age, sex, weight as effects.
- Use standard least squares personality.
- Generate minimal report.
- Run profiler with bagged predictions.
- Set random seed for reproducibility.
- Extract latest predictions matrix.
- Close data table without saving.
- Define previous predictions array.
Example 369
Summary: Fits a logistic regression model to predict sex based on height and weight, utilizing nominal logistic personality and target level 'F', with profiler output and bagged predictions saved.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :sex ),
Effects( :height, :weight ),
Personality( "Nominal Logistic" ),
Target Level( "F" ),
Run( Profiler( 1 ) )
);
rpt = obj << report;
scptObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object;
scptObj << Save Bagged Predictions( 2, Random Seed( 12345 ) );
latest = Column( 6 ) << getasmatrix;
Close( dt, nosave );
previous = [0.790073099558239, 0.832956360234627, 0.902868750849507, 0.564710312269022, 0.960664485218417, 0.573086603022027,
0.856849435222434, 0.988792883285044, 0.835579286481847, 0.715358638688458, 0.793331169030237, 0.195515583783082, 0.461844227504816,
0.860289203802612, 0.628531763876653, 0.425924309230628, 0.420109257561788, 0.638267947297169, 0.257824769630824, 0.35921414379987,
0.331845157675685, 0.287348287414742, 0.387003635027645, 0.232043880413534, 0.0962848756504722, 0.287348287414742, 0.0648687144586094,
0.43106271132504, 0.423732028653442, 0.269142475508493, 0.300640823883263, 0.16915340619722, 0.571664355914893, 0.175188739820968,
0.310659314380646, 0.852011128592585, 0.183430150626145, 0.70101906954451, 0.23374409121397, 0.433266293026398];
Code Explanation:
- Open data table;
- Fit logistic regression model.
- Set response variable to "sex".
- Include "height" and "weight" as effects.
- Use nominal logistic personality.
- Set target level to "F".
- Run profiler.
- Extract prediction profiler report.
- Get scriptable object from profiler.
- Save bagged predictions with random seed.
Example 370
Summary: Fits a linear model to predict height, incorporating age, sex, and weight effects, while generating minimal reports and saving bagged predictions.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :height ),
Effects( :age, :sex, :weight ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run( Profiler( Save Bagged Predictions( 2, Random Seed( 12345 ) ) ) )
);
latest = Column( 8 ) << getasmatrix;
Code Explanation:
- Open data table.
- Fit linear model on height.
- Include age, sex, weight effects.
- Use standard least squares personality.
- Generate minimal report.
- Run profiler with bagging.
- Set number of bags to 2.
- Use random seed 12345.
- Save bagged predictions.
- Extract matrix from latest column.
Example 371
Summary: Fits a Nominal Logistic model to predict sex based on height and weight, with bagged predictions saved for further analysis.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :sex ),
Effects( :height, :weight ),
Personality( "Nominal Logistic" ),
Target Level( "F" ),
Run( Profiler( 1 ) )
);
rpt = obj << report;
scptObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object;
scptObj << Save Bagged Predictions( 2, Random Seed( 12345 ) );
latest = Column( 6 ) << getasmatrix;
Code Explanation:
- Open data table;
- Fit Nominal Logistic model.
- Set response variable to "sex".
- Include "height" and "weight" as effects.
- Set target level to "F".
- Run Prediction Profiler.
- Retrieve report object.
- Get Prediction Profiler scriptable object.
- Save 2 bagged predictions with seed 12345.
- Extract latest column data as matrix.
Example 372
Summary: Fits a model with specified effects and personalities, generating reports and profilers in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :ABRASION, MODULUS ),
Effects(
:SILICA & RS, :SILANE & RS, :SULFUR & RS, :SILICA * :SILICA, :SILICA * :SILANE, :SILANE * :SILANE, :SILICA * :SULFUR,
:SILANE * :SULFUR, :SULFUR * :SULFUR
),
Personality( Stepwise ),
Run()
);
Report( obj[1] )[Button Box( 2 )] << Click;
rpt2 = Report( obj[1] )[Button Box( 6 )] << Click;
Report( obj[2] )[Button Box( 2 )] << click;
rpt2 = Report( obj[2] )[Button Box( 6 )] << click;
Fit Group[1] << Profiler( 1 );
rpt = Fit Group[1] << parent;
Close( dt, no save );
b test1 = {Text Box( "±1.626755", fontcolor( 5 ), left ), Text Box( "49.83", fontcolor( 3 ), left ),
Text Box( "±2.500005", fontcolor( 5 ), left ), Text Box( "46.92", fontcolor( 3 ), left ), Text Box( "Runtime", wrapWidth( 120 ) ),
Text Box( "Weight", wrapWidth( 120 ) )};
b test2 = {Text Edit Box( "Oxy", default font id( 9 ), left ), Text Edit Box( "Oxy", default font id( 9 ), left )};
b test3 = {Number Edit Box(
static( true ),
drawbox( false ),
width( 9 ),
decimal( 99 ),
fmtdecimal( -1 ),
Number( 10.0162 ),
hjust( 1 ),
narrow( true ),
Text Color( "Red" )
), Number Edit Box(
static( true ),
drawbox( false ),
width( 9 ),
decimal( 99 ),
fmtdecimal( -1 ),
Number( 72.909 ),
hjust( 1 ),
narrow( true ),
Text Color( "Red" )
)};
Code Explanation:
- Open data table;
- Fit model with ABRASION, MODULUS as Y.
- Include specified effects in model.
- Use Stepwise personality for fitting.
- Run the model.
- Click second button box in first report.
- Click sixth button box in first report.
- Click second button box in second report.
- Click sixth button box in second report.
- Generate profiler for Fit Group.
Example 373
Summary: Analyze weight data by fitting a model with height as a predictor, grouped by sex, and highlighting effect leverage.
Code:
dt = Open("data_table.jmp");
obj = fit group(
Fit Model(
Y( :weight ),
X( :height ),
by( :sex ),
Effects( :height ),
Personality( Standard Least Squares ),
Set Alpha Level( 0.05 ),
Emphasis( Effect Leverage ),
Run()
),
<<{Profiler( 1, Confidence Intervals( 1 ), Term Value( height( 60.889 ) ) )}
);
rpt = obj << parent;
Code Explanation:
- Open data_table data
- Create fit group object.
- Fit model for weight.
- Use height as predictor.
- Group by sex variable.
- Specify height effect.
- Use standard least squares.
- Set alpha level to 0.05.
- Focus on effect leverage.
- Run the analysis.
Example 374
Summary: Fits a linear model with height as Y and weight as effect, generating prediction profiler values and standard error formulas.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :height ),
Effects( :weight ),
Personality( Standard Least Squares ),
Emphasis( Effect Leverage ),
Run Model(
Profiler( 1, Confidence Intervals( 1 ), Term Value( weight( 120 ) ) ),
:height << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )}
)
);
rpt = obj << report;
expected1 = Num( Words( rpt[Outline Box( "Prediction Profiler" )][Text Box( 3 )] << get text, "[," )[1] );
expected2 = Num( Words( rpt[Outline Box( "Prediction Profiler" )][Text Box( 4 )] << get text, "]" )[1] );
obj << prediction formula;
obj << stdErr pred formula;
obj = dt << Profiler(
Y( :Pred Formula height, :PredSE height ),
Profiler( 1, Confidence Intervals( 1 ), Term Value( weight( 120 ) ) ),
Use SE Formula( 1 )
);
rpt = obj << report;
compared1 = Num( Words( rpt[Outline Box( "Prediction Profiler" )][Text Box( 3 )] << get text, "[," )[1] );
compared2 = Num( Words( rpt[Outline Box( "Prediction Profiler" )][Text Box( 4 )] << get text, "]" )[1] );
Code Explanation:
- Open data table.
- Fit linear model with height as Y and weight as effect.
- Set personality to Standard Least Squares.
- Emphasize effect leverage.
- Run model with profiler.
- Plot actual vs predicted, residual vs predicted, and effect leverage.
- Extract prediction profiler values.
- Create prediction and standard error formulas.
- Open profiler with prediction and standard error formulas.
- Compare extracted values with new profiler values.
Example 375
Summary: Runs the fitting and profiling of a Nominal Logistic model to predict size based on country, type, and marital status, with desirability functions applied.
Code:
dt = Open("data_table.jmp");
fm = dt << Fit Model( Y( :size ), Effects( :country, :type, :marital status ), Personality( "Nominal Logistic" ) );
fm << Run Model(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Desirability Functions( 1 ),
size << Category Desirability( {"Large", 0.5}, {"Medium", 0.66}, {"Small", 0.2} ),
Term Value( country( "American" ), Type( "Family" ), marital status( "Married" ) ),
Output Random Table( 5000 )
)
);
ort = Data Table( 1 );
ort << Sort( By( country, type, marital status ), Replace Table );
tmport = ort << Summary( Group( :country, :type, :marital status ), Mean( :Desirability ), Std Dev( :Desirability ) );
means = Column( "Mean(Desirability)" ) << get values;
stds = Column( "Std Dev(Desirability)" ) << get values;
Close( ort, No Save );
Close( dt, No Save );
dt = New Table( "Test",
New Column( "X", Values( [-2, -1, 0, 1, 2] ) ),
New Column( "Formula",
Formula( 0.01 + X ^ 2 ),
Set Property(
"Response Limits",
{Goal( Maximize ), Lower( 0.00, 0.066 ), Middle( 2.25, 0.5 ), Upper( 4.5, 0.9819 ), Importance( 1 )}
)
)
);
pLinear = dt << Profiler( Y( :Formula ), Profiler( 1, Desirability Functions( 1 ) ), );
pLinear << Save Desirability Formula;
pLinear << SendToReport( Dispatch( {"Prediction Profiler"}, "10000", ScaleBox, {Scale( "Log" )} ) );
pLinear << Save Desirability Formula;
myExpCol = Column( "Desirability" );
myRealCol = Column( "Desirability 2" );
Code Explanation:
- Open data table.
- Fit Nominal Logistic model on size.
- Run model with Likelihood Ratio Tests.
- Enable Profiler with desirability functions.
- Set category desirability for size.
- Set term values for country, type, marital status.
- Output random table with 5000 rows.
- Sort table by country, type, marital status.
- Summarize data by mean and standard deviation of desirability.
- Create new table with X and formula columns.
- Enable Profiler for formula with desirability functions.
- Save desirability formula.
- Set log scale for Prediction Profiler.
- Save desirability formula again.
- Assign Desirability column to myExpCol.
- Assign Desirability 2 column to myRealCol.
Example 376
Summary: Fits a linear model to data, profiling the results, and extracting relevant information from windows.
Code:
dt1 = Open("data_table.jmp");
obj1 = dt1 << Fit Model(
Y( :Name( "Midrange Price ($1000)" ) ),
Effects( :Air Bags Standard, :Drive Train Type, :Name( "Engine Size (liters)" ) ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run
);
befAA = Associative Array( Window() << get window title );
obj1 << Profiler( 1, Output Grid Table( 1 ) );
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
dt2 = Data Table( aftlst[1] );
Code Explanation:
- Open data table.
- Fit linear model to data.
- Create associative array of windows.
- Launch profiler from fit model.
- Create new associative array of windows.
- Remove unchanged windows from array.
- Extract keys from associative array.
- Open first data table from list.
Example 377
Summary: Fits a model to predict loan values based on job and reason, generating a prediction formula column and retrieving its properties.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :LOAN ),
Effects( :REASON, :JOB ),
Informative Missing( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run()
);
obj << Prediction Formula;
colPropLst = Column( dt, "Pred Formula LOAN" ) << Get Properties List;
colProp = Column( dt, "Pred Formula LOAN" ) << Get Column Properties;
colForm = Column( dt, "Pred Formula LOAN" ) << Get Formula;
obj1 = dt << Profiler( Y( :Pred Formula LOAN ) );
rpt1 = obj1 << report;
predProfScptObj = rpt1[Outline Box( "Prediction Profiler" )] << get scriptable object;
obj1 << Term Value( :JOB( "" ), :REASON( "" ) );
jobval = rpt1[Outline Box( "Prediction Profiler" )][Text Box( 3 )] << get text;
reasonval = rpt1[Outline Box( "Prediction Profiler" )][Text Box( 5 )] << get text;
predProfLoanPred = Num( rpt1[Outline Box( "Prediction Profiler" )][Text Box( 2 )] << get text );
loanPredCol = Column( dt, "Pred Formula LOAN" )[(dt << Select Where( :JOB == "" & :REASON == "" )) << get selected rows];
Code Explanation:
- Open data table.
- Fit model with LOAN as response.
- Include REASON and JOB as effects.
- Use Standard Least Squares personality.
- Generate minimal report.
- Run the model.
- Create prediction formula column.
- Get properties list for prediction column.
- Retrieve column properties.
- Extract formula from prediction column.
Example 378
Summary: Fits a model, creating a prediction formula, and profiling the results in JMP, while also extracting specific script lines from open windows.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :weight ),
Effects( :height, :sex, :age ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run
);
obj1 << Prediction Formula;
obj2 = dt << Profiler( Y( :Pred Formula weight ), Profiler );
obj2 << Show Formulas;
For( ii = 1, ii <= N Items( Window() ), ii++,
If( (Window()[ii] << get window title) == "Profiler formulas",
scpt = Window()[ii][Script Box( 1 )] << get line text( 17 );
Window()[ii] << Close Window;
Break();
)
);
Code Explanation:
- Open table.
- Fit model with specified effects.
- Create prediction formula.
- Open profiler for prediction.
- Show profiler formulas.
- Loop through open windows.
- Find "Profiler formulas" window.
- Extract specific script line.
- Close "Profiler formulas" window.
- Exit loop.
Example 379
Summary: Fits a linear model with Runtime as Y, including Oxy and RstPulse as effects, using Standard Least Squares personality and generating a minimal report.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Runtime ),
Effects( :Oxy, :RstPulse ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1, Desirability Functions( 1 ) ) )
);
obj << Surface profiler( 1 );
rpt = obj << report;
obj1 = obj << redo analysis;
rpt1 = obj1 << report;
pp = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object;
pp << Maximize and Remember;
Code Explanation:
- Open data table;
- Fit linear model with Runtime as Y.
- Include Oxy and RstPulse as effects.
- Use Standard Least Squares personality.
- Generate minimal report.
- Run Prediction Profiler.
- Create Surface profiler.
- Retrieve model report.
- Redo the analysis.
- Retrieve new report.
Example 380
Summary: Fits a nominal logistic model to a data table, with profiler settings and output random table configuration.
Code:
dt = Open("data_table.jmp");
fm = dt << Fit Model( Y( :size ), Effects( :country, :type, :marital status ), Personality( "Nominal Logistic" ) );
fm << Run Model(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Desirability Functions( 1 ),
size << Category Desirability( {"Large", 0.5}, {"Medium", 0.66}, {"Small", 0.2} ),
Term Value( country( "American" ), Type( "Family" ), marital status( "Married" ) ),
Output Random Table( 5000 )
)
);
ort = Data Table( 1 );
ort << Sort( By( country, type, marital status ), Replace Table );
tmport = ort << Summary( Group( :country, :type, :marital status ), Mean( :Desirability ), Std Dev( :Desirability ) );
means = Column( "Mean(Desirability)" ) << get values;
stds = Column( "Std Dev(Desirability)" ) << get values;
Code Explanation:
- Open data table.
- Fit nominal logistic model.
- Run model with profiler.
- Enable likelihood ratio tests.
- Disable Wald tests.
- Configure profiler settings.
- Set category desirability for size.
- Define term values for predictors.
- Output random table with 5000 rows.
- Sort table by country, type, marital status.
Example 381
Summary: Fits a model with transformed response, including interaction effects and standard least squares personality, and generates prediction formulas and profiler reports.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( Transform Column( "Square Root[y]", Format( "Fixed Dec", 6, 0 ), Formula( Sqrt( :y ) ) ) ),
Y( :"Square Root[y]"n ),
Effects( :Drug, :x, :Drug * :x ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:Name( "Square Root[y]" ) << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 ),
Prediction Formula, StdErr Pred Formula}
)
);
dt << New Column( "Pred Formula Square Root[y]",
Formula( Sqrt( :Pred Formula y ) ),
Set Property( "Predicting", {:y, Creator( "Fit Least Squares" ), ID( 1889078400 ), Std Dev( 0.866879155464266 )} )
);
obj1 = dt << Profiler(
Y( :Name( "Pred Formula Square Root[y]" ), :Name( "PredSE Square Root[y]" ) ),
Profiler( 1 ),
Expand,
Use SE Formula( 0 )
);
rpt1 = obj1 << report;
d1 = rpt1[Outline Box( "Prediction Profiler" )][Text Box( 5 )] << get text;
x1 = rpt1[Outline Box( "Prediction Profiler" )][Number Edit Box( 1 )] << get;
pred1 = Num( rpt1[Outline Box( "Prediction Profiler" )][Text Box( 2 )] << get text );
obj2 = dt << Profiler(
Y( :Name( "Pred Formula Square Root[y]" ), :Name( "PredSE Square Root[y]" ) ),
Profiler( 1 ),
Expand,
Use SE Formula( 1 )
);
rpt2 = obj2 << report;
d2 = rpt2[Outline Box( "Prediction Profiler" )][Text Box( 9 )] << get text;
x2 = rpt2[Outline Box( "Prediction Profiler" )][Number Edit Box( 1 )] << get;
pred2 = Num( rpt2[Outline Box( "Prediction Profiler" )][Text Box( 2 )] << get text );
Code Explanation:
- Open data table;
- Fit a model with transformed response.
- Include interaction effects.
- Use standard least squares personality.
- Emphasize effect leverage.
- Generate prediction formulas.
- Create new column for predicted values.
- Configure predicting properties.
- Generate first profiler report.
- Extract data from profiler reports.
Example 382
Summary: Fits a Partial Least Squares model with multiple responses, using K-Fold validation and NIPALS method for fitting, while excluding intercept term and disabling polynomial centering.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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
),
No Intercept( 1 ),
Center Polynomials( 0 ),
Personality( "Partial Least Squares" ),
Run(
Initial Number of Factors( 15 ),
Validation Method( KFold( 7 ), Initial Number of Factors( 15 ) ),
Fit(
Method( NIPALS ),
Number of Factors( 10 ),
Profiler( 1, Confidence Intervals( 1 ), Extrapolation Details( 1 ), Extrapolation Control Option( "On" ) )
)
)
);
rpt = obj << report;
mat = dt << Get as matrix( dt << get column group( "Intensities" ) );
Code Explanation:
- Open data table.
- Fit model with multiple responses.
- Include all variables as effects.
- Exclude intercept term.
- Disable polynomial centering.
- Use Partial Least Squares personality.
- Set initial number of factors to 15.
- Use K-Fold validation with 7 folds.
- Apply NIPALS method for fitting.
- Set number of factors to 10.
- Enable profiler with confidence intervals.
- Enable extrapolation details and control.
- Generate model report.
- Extract matrix from "Intensities" column group.
Example 383
Summary: Fits a Partial Least Squares model to a data table, imputing missing values using EM method, and configuring profiler settings for NIPALS fit.
Code:
dt = Open("data_table.jmp");
dt[1, 5] = .;
dt[2, 10] = .;
dt[3, 15] = .;
dt[4, 27] = .;
obj = dt << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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
),
No Intercept( 1 ),
Center Polynomials( 0 ),
Personality( "Partial Least Squares" ),
Impute Missing Data( 1 ),
Imputation Method( "EM" ),
Max Iterations( 10 ),
Run(
Set Random Seed( 111 ),
Initial Number of Factors( 15 ),
Validation Method( KFold( 7 ), Initial Number of Factors( 15 ) ),
Fit(
Method( NIPALS ),
Number of Factors( 10 ),
Profiler( 1, Confidence Intervals( 1 ), Extrapolation Details( 1 ), Extrapolation Control Option( "On" ) )
)
)
);
rpt = obj << report;
scrobj = rpt["NIPALS?"] << Get Scriptable Object;
dt_imp = scrobj << Save Imputation;
mat = dt_imp << Get as matrix;
mat = mat[0, 1 :: 27];
Code Explanation:
- Open data table;
- Set cell [1, 5] to missing.
- Set cell [2, 10] to missing.
- Set cell [3, 15] to missing.
- Set cell [4, 27] to missing.
- Fit model with specified effects.
- Use Partial Least Squares personality.
- Impute missing data using EM method.
- Set max iterations to 10.
- Configure and run NIPALS fit with profiler settings.
Example 384
Summary: Fits a linear model to predict continuous outcomes, utilizing Standard Least Squares personality and effect screening for optimal parameter estimation.
Code:
dt = Open("data_table.jmp");
X = dt << Get as Matrix;
obj = dt << Fit Model(
Y( :Y ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Extrapolation Details( 1 ),
Desirability Functions( 1 ),
Extrapolation Control Option( "On" ),
Arrange in Rows( 6 ),
Term Value(
Age( 67.65, Lock( 0 ), Show( 1 ) ),
Gender( 2, Lock( 0 ), Show( 1 ) ),
BMI( 20.5, Lock( 0 ), Show( 1 ) ),
BP( 103.67, Lock( 0 ), Show( 1 ) ),
Total Cholesterol( 210, Lock( 0 ), Show( 1 ) ),
LDL( 85.2, Lock( 0 ), Show( 1 ) ),
HDL( 35, Lock( 0 ), Show( 1 ) ),
TCH( 6, Lock( 0 ), Show( 1 ) ),
LTG( 6.107, Lock( 0 ), Show( 1 ) ),
Glucose( 124, Lock( 0 ), Show( 1 ) )
)
),
:Y << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Lack of Fit( 0 ), Sorted Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 1 ),
Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 1 )}
)
);
rpt = obj << report;
scrobj_profiler = rpt[Outline Box( "Prediction Profiler" )] << Get Scriptable Object;
Code Explanation:
- Open data table;
- Extract data matrix.
- Initiate Fit Model platform.
- Set response variable.
- Define predictor variables.
- Choose Standard Least Squares personality.
- Focus on effect screening.
- Run model with profiler.
- Enable confidence intervals.
- Display extrapolation details.
Example 385
Summary: Fits a linear model with height as response and weight as effect, utilizing standard least squares personality and emphasizing effect leverage.
Code:
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run Model(
Profiler( 1, Confidence Intervals( 1 ), Term Value( weight( 120 ) ), Remember Settings( "Setting 1" ) ),
:height << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )}
)
);
rpt = obj << report;
b settings1 = [120, 64.5826154806492, 63.4074130207982, 65.7578179405001];
settings1 = rpt[Outline Box( "Remembered Settings" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit linear model with height as response.
- Use weight as effect.
- Set modeling personality to standard least squares.
- Emphasize effect leverage.
- Run the model.
- Create profiler with confidence intervals.
- Set term value for weight to 120.
- Remember settings as "Setting 1".
- Plot actual vs predicted, residual vs predicted, and effect leverage.
Example 386
Summary: Fits a linear model to predict weight based on height and sex, while handling missing data and providing detailed reports.
Code:
dt = Open("data_table.jmp");
(dt:sex)[1] = "";
obj = dt << Fit Model(
Y( :weight ),
Effects( :height, :sex ),
Informative Missing( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run( Profiler( 1 ) )
);
rpt = obj << report;
profileObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object();
rpt[Outline Box( "Prediction Profiler" )][FrameBox( 1 )] << Y Axis( Max( 100 ) );
predProfilerYMax = rpt[Outline Box( "Prediction Profiler" )][AxisBox( 1 )] << Get Max;
regressPlotYMax = rpt[Outline Box( "Regression Plot" )][AxisBox( 1 )] << Get Max;
actVsPredPlotYMax = rpt[Outline Box( "Actual by Predicted Plot" )][AxisBox( 1 )] << Get Max;
profileObj << Adapt Y Axis( 1 );
predProfilerYMax = rpt[Outline Box( "Prediction Profiler" )][AxisBox( 1 )] << Get Max;
regressPlotYMax = rpt[Outline Box( "Regression Plot" )][AxisBox( 1 )] << Get Max;
actVsPredPlotYMax = rpt[Outline Box( "Actual by Predicted Plot" )][AxisBox( 1 )] << Get Max;
Code Explanation:
- Open table.
- Set first sex value to empty.
- Fit linear model.
- Specify response variable.
- Include effects.
- Handle missing data.
- Choose modeling personality.
- Set emphasis.
- Run profiler.
- Retrieve report.
Example 387
Summary: Fits a model to predict weight based on age, sex, and height, with emphasis on effect leverage and response limits.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run Model(
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
weight << Response Limits( {Lower( 60, 0.066 ), Middle( 120, 0.5 ), Upper( 180, 0.9819 ), Goal( Maximize ), Importance( 1 )} ),
Term Value( age( 17 ), sex( "F" ), height( 70 ) ),
Remember Settings( 1 )
),
:weight << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Tests( 0 ), Effect Details( 0 ),
Lack of Fit( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 ),
{:age << {LSMeans Table( 0 )}, :sex << {LSMeans Table( 0 )}}}
)
);
rep = Report( obj );
vallist = (rep[Outline Box( "Remembered Settings" )][Table Box( 1 )] << get as matrix);
Code Explanation:
- Open data table;
- Fit model with weight as response.
- Include age, sex, height as effects.
- Use Standard Least Squares personality.
- Emphasize Effect Leverage.
- Run the model.
- Create a profiler.
- Enable confidence intervals.
- Enable desirability functions.
- Set response limits for weight.
Example 388
Summary: Fits a linear model to a data table, generating prediction formulas and confidence intervals with minimal report output.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :y ),
Effects( :Drug, :x ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run( Profiler( 1, Confidence Intervals( 1 ), Term Value( Drug( "a", Lock( 0 ), Show( 1 ) ), x( 12, Lock( 0 ), Show( 1 ) ) ) ) )
);
obj << Prediction Formula;
obj << Mean Confidence Limit Formula( .05 );
rpt = obj << report;
predFormY = Words( rpt["Prediction Profiler"][List Box( 6 )] << get text, "[,]" )[1 :: 3];
predY = Num( predFormY[1] );
lowCI = Num( predFormY[2] );
higCI = Num( predFormY[3] );
obj1 = dt << Profiler( Y( :Pred Formula y ) );
rpt1 = obj1 << report;
predFormY1 = Words( rpt1["Prediction Profiler"][List Box( 6 )] << get text, "[,]" )[1 :: 3];
predY1 = Num( predFormY1[1] );
lowCI1 = Num( predFormY1[2] );
higCI1 = Num( predFormY1[3] );
Code Explanation:
- Open data table;
- Fit linear model with variables.
- Use Standard Least Squares personality.
- Emphasize minimal report output.
- Run profiler with confidence intervals.
- Set term values for Drug and x.
- Generate prediction formula.
- Calculate mean confidence limit.
- Extract prediction profiler report.
- Retrieve prediction, lower, and upper confidence limits.
Example 389
Summary: Runs the fitting and profiling of a linear model to predict y values, configuring confidence intervals and prediction intervals for minimal report.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :y ),
Effects( :Drug, :x ),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Prediction Intervals( 1 ),
Term Value( Drug( "a", Lock( 0 ), Show( 1 ) ), x( 12, Lock( 0 ), Show( 1 ) ) )
)
)
);
obj << Prediction Formula;
obj << Mean Confidence Limit Formula;
obj << Indiv Confidence Limit Formula;
rpt = obj << report;
predFormY = Words( rpt["Prediction Profiler"][List Box( 6 )] << get text, "[,]" )[{1, 2, 3, 5, 6}];
predY = Num( predFormY[1] );
lowCI = Num( predFormY[2] );
higCI = Num( predFormY[3] );
lowPI = Num( predFormY[4] );
higPI = Num( predFormY[5] );
obj1 = dt << Profiler( Y( :Pred Formula y ), Confidence Intervals( 1 ), Prediction Intervals( 1 ) );
rpt1 = obj1 << report;
predFormY1 = Words( rpt1["Prediction Profiler"][List Box( 6 )] << get text, "[,]" )[{1, 2, 3, 5, 6}];
predY1 = Num( predFormY1[1] );
lowCI1 = Num( predFormY1[2] );
higCI1 = Num( predFormY1[3] );
lowPI1 = Num( predFormY1[4] );
higPI1 = Num( predFormY1[5] );
Code Explanation:
- Open data table;
- Fit linear model.
- Set model effects.
- Use minimal report.
- Run profiler analysis.
- Configure confidence intervals.
- Configure prediction intervals.
- Set term values.
- Extract prediction formula.
- Extract confidence limits.
Example 390
Summary: Analyze and visualize a Nominal Logistic model, including frequency variable inclusion, response variable specification, effect variable addition, likelihood ratio tests, profiler output, and probability formula saving.
Code:
dt5 = Open("data_table.jmp");
obj5 = dt5 << Fit Model(
Freq( :Count ),
Y( :Response ),
Effects( :"ln(dose)"n ),
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ), Profiler( 1, Save Shapley Values ), Logistic Plot( 1 ) )
);
obj5 << Save Probability Formula;
dt5:"SHAP Intercept for Probability(Response=Died)"n << Exclude( 0 );
dt5 << New Column( "Sum of SHAP (Response=Died)",
Formula( Sum( :"SHAP Intercept for Probability(Response=Died)"n, :"SHAP ln(dose) for Probability(Response=Died)"n ) )
);
dt5:"SHAP Intercept for Probability(Response=Cured)"n << Exclude( 0 );
dt5 << New Column( "Sum of SHAP (Response=Cured)",
Formula( Sum( :"SHAP Intercept for Probability(Response=Cured)"n, :"SHAP ln(dose) for Probability(Response=Cured)"n ) )
);
dt5 << New Column( "Absolute Deviation(Response=Died)", Formula( Abs( :"Sum of SHAP (Response=Died)"n - :"Prob[Died]"n ) ) );
dt5 << New Column( "Max Deviation (Response=Died)", Formula( Col Max( :"Absolute Deviation (Response=Died)"n ) ) );
:"Max Deviation (Response=Died)"n[1];
dt5 << New Column( "Absolute Deviation(Response=Cured)", Formula( Abs( :"Sum of SHAP (Response=Cured)"n - :"Prob[Cured]"n ) ) );
dt5 << New Column( "Max Deviation (Response=Cured)", Formula( Col Max( :"Absolute Deviation (Response=Cured)"n ) ) );
:"Max Deviation (Response=Cured)"n[1];
Window( "data_table - Fit Nominal Logistic" ) << close window;
Code Explanation:
- Open data table;
- Fit Nominal Logistic model.
- Include frequency variable.
- Set response variable.
- Add effect variable.
- Run likelihood ratio tests.
- Enable profiler, save Shapley values.
- Generate logistic plot.
- Save probability formula.
- Unexclude SHAP intercept for Died.
- Create Sum of SHAP (Died).
- Unexclude SHAP intercept for Cured.
- Create Sum of SHAP (Cured).
- Calculate absolute deviation for Died.
- Find max deviation for Died.
- Calculate absolute deviation for Cured.
- Find max deviation for Cured.
- Close fit window.
Example 391
Summary: Fits a linear model to predict weight based on age, sex, and height, with confidence intervals and simulator configurations.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value( age( 12, Lock( 0 ), Show( 1 ) ), sex( "F", Lock( 0 ), Show( 1 ) ), height( 52.25, Lock( 0 ), Show( 1 ) ) ),
Simulator( 1, Factors( age << Fixed( 0 ), sex << Fixed( 0 ), height << Fixed( 52.25 ) ), Responses( weight << No Noise ) )
),
:weight << {Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )}
),
SendToReport(
Dispatch( {"Response weight", "Prediction Profiler", "Simulator"}, "Simulate to Table", OutlineBox, {Close( 0 )} ),
Dispatch( {"Response weight", "Prediction Profiler", "Simulator", "Simulate to Table"}, "Sequencing", OutlineBox, {Close( 0 )} )
)
);
Code Explanation:
- Open table.
- Fit linear model.
- Set response variable.
- Add effects.
- Choose personality.
- Set emphasis.
- Run profiler.
- Configure confidence intervals.
- Set term values.
- Configure simulator.
Example 392
Summary: Fits a model to predict weight based on height and sex, generating a report with main effects and profiling predictions.
Code:
dt = Open("data_table.jmp");
(dt:sex)[1] = "";
obj = dt << Fit Model(
Y( :weight ),
Effects( :height, :sex ),
Informative Missing( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run( Profiler( 1, Dependent Resampled Inputs( 1 ) ) )
);
rpt = obj << report;
mainEff = rpt[Outline Box( "Summary Report" )][Number Col Box( "Main Effect" )] << get as matrix;
profileObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object();
profileObj << Set to Data in Row( 1 );
wt1 = Num( rpt[Outline Box( "Prediction Profiler" )][Text Box( 2 )] << get text );
sex1 = rpt[Outline Box( "Prediction Profiler" )][Text Box( 5 )] << get text;
ht1 = Num( rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 1 )] << get text );
Code Explanation:
- Open table.
- Modify sex value.
- Fit model.
- Generate report.
- Extract main effects.
- Get profiler object.
- Set data to row.
- Retrieve weight prediction.
- Retrieve sex prediction.
- Retrieve height prediction.
Example 393
Summary: Fits a model to predict weight based on height and sex, generating a summary report with main effect matrix and prediction profiler output.
Code:
dt = Open("data_table.jmp");
(dt:sex)[1] = "";
obj = dt << Fit Model(
Y( :weight ),
Effects( :height, :sex ),
Informative Missing( 0 ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run( Profiler( 1, Dependent Resampled Inputs( 1 ) ) )
);
rpt = obj << report;
mainEff = rpt[Outline Box( "Summary Report" )][Number Col Box( "Main Effect" )] << get as matrix;
profileObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object();
profileObj << Set to Data in Row( 1 );
wt1 = Num( rpt[Outline Box( "Prediction Profiler" )][Text Box( 2 )] << get text );
sex1 = rpt[Outline Box( "Prediction Profiler" )][Text Box( 5 )] << get text;
ht1 = Num( rpt[Outline Box( "Prediction Profiler" )][Number Edit Box( 1 )] << get text );
Code Explanation:
- Open data table;
- Modify first sex value.
- Fit model with weight as response.
- Include height and sex as effects.
- Use standard least squares personality.
- Emphasize effect leverage.
- Run profiler with resampled inputs.
- Extract summary report.
- Get main effect matrix.
- Retrieve prediction profiler object.
Example 394
Summary: Fits an ordinal logistic model to a data table, incorporating height and weight effects, and generates a report with likelihood ratio tests and profiler results.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :age ),
Effects( :height, :weight ),
Personality( "Ordinal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler( 1, Independent Uniform Inputs( 1 ), Independent Resampled Inputs( 1 ), Dependent Resampled Inputs( 1 ) )
)
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Fit ordinal logistic model.
- Set response variable as age.
- Include height and weight effects.
- Enable likelihood ratio tests.
- Generate profiler.
- Use independent uniform inputs.
- Use independent resampled inputs.
- Use dependent resampled inputs.
- Retrieve report object.
Example 395
Summary: Fits a Nominal Logistic model to a data table, generating reports on variable importance for independent uniform inputs, independent resampled inputs, and dependent resampled inputs.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :sex ),
Effects( :height, :weight ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Profiler( 1, Independent Uniform Inputs( 1 ), Independent Resampled Inputs( 1 ), Dependent Resampled Inputs( 1 ) )
)
);
rpt = obj << report;
unifInputs = rpt[Outline Box( "Variable Importance:Independent Uniform Inputs" )] << get scriptable object;
indResampl = rpt[Outline Box( "Variable Importance:Independent Resampled Inputs" )] << get scriptable object;
depResampl = rpt[Outline Box( "Variable Importance:Dependent Resampled Inputs" )] << get scriptable object;
Code Explanation:
- Open table.
- Fit Nominal Logistic model.
- Set response variable.
- Add effects variables.
- Run likelihood ratio tests.
- Generate profiler.
- Enable independent uniform inputs.
- Enable independent resampled inputs.
- Enable dependent resampled inputs.
- Retrieve report objects.
Example 396
Summary: Analyze a time series dataset by fitting a linear model, removing linear trends, and generating reports for detrended series.
Code:
dt = Open("data_table.jmp");
objLS1 = dt << Fit Model(
Y( :Passengers ),
Effects( :Time ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Residuals( 1 ) )
);
rptls = Report( objLS1 );
b beta = (rptls[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix)[1 :: 2, 1];
obj1 = dt << Time Series( Y( :Passengers ), Remove Linear Trend( 1 ) );
obj1 << Remove Linear Trend( 1 );
rpt1 = Report( obj1 );
stat1 = rpt1[Outline Box( "Time Series Passengers (Detrended)" )][Table Box( 2 )] << get as matrix;
b det y = dt:Residual Passengers << get values;
det y1 = dt:Name( "Passengers (Detrended)" ) << get values;
beta1 = rpt1[Outline Box( "Time Series Passengers (Detrended)" )][Outline Box( "Linear Trend" )][Table Box( 1 )] << get as matrix;
obj2 = dt << Time Series( Y( :Name( "Passengers (Detrended)" ) ), );
rpt2 = Report( obj2 );
stat2 = rpt2[Outline Box( "Time Series Passengers (Detrended)" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Fit linear model to passengers.
- Retrieve parameter estimates.
- Create time series object.
- Remove linear trend.
- Generate report for detrended series.
- Extract residual values.
- Extract detrended values.
- Retrieve trend coefficients.
- Analyze detrended time series.
Example 397
Summary: Fits a nominal logistic model to predict size, considering country, type, and marital status effects, with profiler output generation.
Code:
dt = Open("data_table.jmp");
dt << Fit Model( Y( :size ), Effects( :country, :type, :marital status ), Personality( Nominal Logistic ), Run Model( Profiler( 1 ) ) );
Code Explanation:
- Open data table.
- Fit nominal logistic model.
- Set response variable to size.
- Include country, type, marital status effects.
- Run the model.
- Generate profiler output.
Example 398
Summary: Runs a linear regression analysis to model ABRASION with specified effects, using Standard Least Squares personality and Effect Screening emphasis.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :ABRASION ),
Effects( :SILICA, :SILANE, :SILICA * :SILANE, :SULFUR, :SILICA * :SULFUR, :SILANE * :SULFUR, :SILICA * :SILANE * :SULFUR ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
:ABRASION << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Effect Details( 0 ), Sorted Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 1 ),
Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 1 ),
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
Term Value( SILICA( 1.2, Lock( 0 ), Show( 1 ) ), SILANE( 50, Lock( 0 ), Show( 1 ) ), SULFUR( 2.3, Lock( 0 ), Show( 1 ) ) )
)}
)
);
rpt = Report( obj );
rpt[Table Box( 1 )] << Set Selected Rows( 1 :: 7 );
rpt[Outline Box( 3 )][Button Box( 1 )] << Click;
Code Explanation:
- Open data table;
- Launch Fit Model platform.
- Set ABRASION as response variable.
- Include specified effects in model.
- Use Standard Least Squares personality.
- Focus on Effect Screening emphasis.
- Run model with detailed output settings.
- Disable Summary of Fit and ANOVA.
- Enable Parameter Estimates and plots.
- Generate and display reports.
Example 399
Summary: Fits a standard least squares model to a data table, emphasizing effect screening and utilizing the Fit Model platform.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Model( Y( :ABRASION ), Personality( "Standard Least Squares" ), Emphasis( "Effect Screening" ), Run );
obj << close window;
Code Explanation:
- Open data table;
- Create new data table object.
- Launch Fit Model platform.
- Set response variable.
- Choose modeling personality.
- Set analysis emphasis.
- Run the model.
- Retrieve fit model object.
- Close the model window.
Fit Model using Column
Example 1
Summary: Fits a model to predict weight based on age and height, using standard least squares and minimal report emphasis.
Code:
// Fit weight to age and height
// Open data table
dt = Open("data_table.jmp");
// Fit weight to age and height
Column( "age" ) <<
Set Modeling Type( "Nominal" );
Fit Model(
Y( :weight ),
Effects( :age, :height ),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
:weight << {Lack of Fit( 0 ),
Plot Actual by Predicted( 0 ),
Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )},
Effect Summary( 0 )
)
);
Code Explanation:
- Open table.
- Set age modeling type.
- Fit model to weight.
- Include age and height effects.
- Use standard least squares.
- Minimal report emphasis.
- Disable lack of fit test.
- Disable actual vs predicted plot.
- Disable residual vs predicted plot.
- Disable effect leverage plot.
Example 2
Summary: Runs a linear regression analysis to model the relationship between height and weight, generating plots for effect leverage, actual vs predicted values, and residual analysis.
Code:
dt = Open("data_table.jmp");
Column( dt, "height" ) << Set Property( "Units", "in" );
Column( dt, "weight" ) << Set Property( "Units", "lbs" );
obj = dt << Fit Model(
Y( :weight ),
Effects( :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:weight << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ), Plot Effect Leverage( 1 ),
Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )}
)
);
rpt = obj << report;
label1 = rpt["Regression Plot"][AxisBox( 1 )] << get text;
label2 = rpt["Regression Plot"][AxisBox( 2 )] << get text;
label3 = rpt["Actual by Predicted Plot"][AxisBox( 1 )] << get text;
label4 = rpt["Residual by Predicted Plot"][AxisBox( 2 )] << get text;
Code Explanation:
- Open data table.
- Set units for height.
- Set units for weight.
- Fit model with weight as Y.
- Use height as effect.
- Choose standard least squares personality.
- Emphasize effect leverage.
- Generate summary of fit.
- Generate analysis of variance.
- Extract axis labels from plots.
Fit Model using Fit Group
Example 1
Summary: Opens a data table, fits a validated stepwise model to predict percent body fat based on weight, abdomen circumference, forearm circumference, and wrist circumference, and generates a profiler with confidence intervals and term values.
Code:
// Fit Group: Validated Stepwise
// Open data table
dt = Open("data_table.jmp");
// Fit Group: Validated Stepwise
Fit Group(
Fit Model(
Y( :Percent body fat ),
Effects(
:"Weight (lbs)"n,
:
"Abdomen circumference (cm)"n,
:
"Forearm circumference (cm)"n,
:"Wrist circumference (cm)"n
),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
" Weight (lbs)"n(
178.92,
Lock( 0 ),
Show( 1 )
),
" Abdomen 2 circumference (cm)"n(
92.556,
Lock( 0 ),
Show( 1 )
),
" Forearm circumference (cm)"n(
28.664,
Lock( 0 ),
Show( 1 )
),
" Wrist circumference (cm)"n(
18.2298,
Lock( 0 ),
Show( 1 )
)
)
),
:Percent body fat <<
{Lack of Fit( 0 ),
Plot Actual by Predicted( 1 ),
Plot Regression( 0 ),
Plot Residual by Predicted(
0
), Plot Effect Leverage( 1 )}
)
)
);
Code Explanation:
- Open table.
- Fit model.
- Set response variable.
- Add effects.
- Set personality.
- Set emphasis.
- Run profiler.
- Configure confidence intervals.
- Set term values.
- Configure plot options.
Example 2
Summary: Fits two linear mixed-effects models for height and weight, considering age as an effect and sex as a random effect, with minimal report emphasis.
Code:
Open("data_table.jmp");
Fit Group(
Fit Model(
Y( :height ),
Effects( :age ),
Random Effects( :sex ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run(
:height << {Summary of Fit( 1 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ),
Plot Residual by Normal Quantiles( 0 )}
)
),
Fit Model(
Y( :weight ),
Effects( :age ),
Random Effects( :sex ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run(
:height << {Summary of Fit( 1 ), Analysis of Variance( 0 ), Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ),
Plot Residual by Normal Quantiles( 0 )}
)
),
<<{Profiler( 1, Confidence Intervals( 1 ), Term Value( age( 12, Lock( 0 ), Show( 1 ) ) ) ), Arrange in Rows( 2 )}
);
Code Explanation:
- Open data table.
- Fit model for height.
- Set response variable: height.
- Add effect: age.
- Add random effect: sex.
- Configure model settings.
- Run model with specified options.
- Fit model for weight.
- Set response variable: weight.
- Add effect: age.
- Add random effect: sex.
- Configure model settings.
- Run model with specified options.
- Create profiler with confidence intervals.
- Set term value for age.
- Arrange profilers in rows.
Example 3
Summary: Fits group models to analyze relationships between age, sex, height, and weight, utilizing ordinal and nominal logistic regression techniques.
Code:
dt = Open("data_table.jmp");
dt << Fit Group(
Fit Model( Y( :age ), Effects( :height, :weight ), Personality( "Ordinal Logistic" ), Run( Likelihood Ratio Tests( 1 ) ) ),
Fit Model(
Y( :sex ),
Effects( :height, :weight ),
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ) )
),
<<{Profiler( 1, Term Value( height( 62.55, Lock( 0 ), Show( 1 ) ), weight( 105, Lock( 0 ), Show( 1 ) ) ) )}
);
Code Explanation:
- Open data table.
- Fit group models.
- Fit ordinal logistic model for age.
- Include height and weight effects.
- Run likelihood ratio tests.
- Fit nominal logistic model for sex.
- Include height and weight effects.
- Run likelihood ratio tests.
- Disable Wald tests.
- Launch profiler with specified term values.
Example 4
Summary: Fits two models to transform columns 'Sqrt weight' and 'Sqrt height', including age and sex effects, and generates reports with minimal emphasis.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Fit Group(
Fit Model(
Y( Transform Column( "Sqrt weight", Formula( Sqrt( :weight ) ) ) ),
Effects( :age, :sex ),
Emphasis( "Minimal Report" ),
Run,
SendToReport( Dispatch( {}, "Response Sqrt weight", OutlineBox, {Close( 1 )} ) )
),
Fit Model(
Y( Transform Column( "Sqrt height", Formula( Sqrt( :height ) ) ) ),
Effects( :age, :sex ),
Emphasis( "Minimal Report" ),
Run,
SendToReport( Dispatch( {}, "Response Sqrt height", OutlineBox, {Close( 1 )} ) )
),
<<Profiler( 1 )
);
rpt1 = Report( obj1 );
num1 = rpt1["Prediction Profiler", Text Box( 2 )] << Get Text;
obj2 = dt << Fit Group(
Fit Model(
Y( Transform Column( "Sqrt weight", Formula( Sqrt( :weight ) ) ) ),
Effects( :age, :sex ),
Emphasis( "Minimal Report" ),
Run( Profiler ),
SendToReport( Dispatch( {}, "Response Sqrt weight", OutlineBox, {Close( 1 )} ) )
),
Fit Model(
Y( Transform Column( "Sqrt height", Formula( Sqrt( :height ) ) ) ),
Effects( :age, :sex ),
Emphasis( "Minimal Report" ),
Run( Profiler ),
SendToReport( Dispatch( {}, "Response Sqrt height", OutlineBox, {Close( 1 )} ) )
),
<<Profiler( 1 )
);
rpt2 = Report( obj2 );
num2 = rpt2["Prediction Profiler", Text Box( 2 )] << Get Text;
Code Explanation:
- Open data table.
- Create Fit Group object.
- Fit model for sqrt(weight).
- Include age and sex effects.
- Use minimal report emphasis.
- Run the model.
- Close response summary.
- Fit model for sqrt(height).
- Include age and sex effects.
- Use minimal report emphasis.
- Run the model.
- Close response summary.
- Enable profiler.
- Retrieve prediction profiler text.
- Repeat steps 2-14.
- Retrieve prediction profiler text again.
Example 5
Summary: Creates and analyzes a fit group object for predicting weight and height based on age and sex, generating a profiler report with labeled axes.
Code:
dt = Open("data_table.jmp");
obj = dt << Fit Group(
Fit Model( Y( :weight ), Effects( :age ), Personality( "Standard Least Squares" ), by( :sex ), Run ),
Fit Model( Y( :height ), Effects( :age ), Personality( "Standard Least Squares" ), by( :sex ), Run ),
);
obj << Profiler( 1 );
rpt = obj << report;
label1 = rpt[Outline Box( "Prediction Profiler" )][AxisBox( 1 )][Text Box( 1 )] << get text;
label2 = rpt[Outline Box( "Prediction Profiler" )][AxisBox( 2 )][Text Box( 1 )] << get text;
Code Explanation:
- Open data table.
- Create fit group object.
- Fit model for weight by age and sex.
- Fit model for height by age and sex.
- Generate profiler for first model.
- Retrieve report object.
- Extract label from first axis box.
- Extract label from second axis box.
Fit Model using Recurrence Analysis
Example 1
Summary: Creates a Proportional Intensity Model for survival analysis using the Recurrence Analysis platform in JMP, specifying response and cost variables, grouping by System ID, and fitting the model with scale effects.
Code:
// Proportional Intensity Model
// Open data table
dt = Open("data_table.jmp");
// Proportional Intensity Model
dt = Current Data Table();
dt << Clear Select;
dt << Select Excluded << Exclude;
dt << Clear Select;
obj =
Recurrence Analysis(
Y( :kHours ),
Cost( :Cost ),
Grouping( :System ID ),
Label( :System ID ),
Fit Model(
Scale Effects( :System ID ),
Run Model,
Model Type(
"Proportional Intensity Poisson Process"
)
)
);
Code Explanation:
- Open data table.
- Set current data table.
- Clear all selections.
- Exclude excluded rows.
- Clear all selections again.
- Create Recurrence Analysis object.
- Specify response variable.
- Specify cost variable.
- Specify grouping variable.
- Label systems by ID.
- Fit model with scale effects.
- Run the model.
- Set model type to Proportional Intensity Poisson Process.
Example 2
Summary: Runs a Recurrence Analysis to visualize the reliability of blenders over time, considering censor status and grouping variables.
Code:
dt = Open("data_table.jmp");
Recurrence Analysis(
Age at Event( :event time ),
Label( :System ID ),
Grouping( :System ID ),
Timestamp at Start( :orig time ),
Timestamp at End( :end time ),
MCF Confid Limits( 1 ),
Event Plot( 1 ),
Plot MCF Differences( 1 ),
MCF Plot Each Group( 1 ),
Age Scaling( "DateTime to Hour" ),
Fit Model( Scale Effects( :System ID ), Run Model, Model Type( Power Nonhomogeneous Poisson Process ) ),
SendToReport(
Dispatch( {"Event Plot"}, "1", ScaleBox,
{Scale( "Geodesic" ), Format( "Custom", Formula( Char( value ) || " s" ), 12 ), Minor Ticks( 1 )}
),
Dispatch( {"MCF Plot"}, "1", ScaleBox,
{Scale( "Geodesic" ), Format( "Custom", Formula( Char( value ) || " s" ), 12 ), Minor Ticks( 1 )}
),
Dispatch( {"MCF Differences Between Groups"}, "1", ScaleBox,
{Scale( "Geodesic" ), Format( "Custom", Formula( Char( value ) || " s" ), 12 ), Minor Ticks( 1 )}
),
Dispatch( {"MCF Plot Each Group"}, "1", ScaleBox,
{Scale( "Geodesic" ), Format( "Custom", Formula( Char( value ) || " s" ), 12 ), Minor Ticks( 1 )}
),
Dispatch( {"MCF Plot Each Group"}, "1", ScaleBox( 2 ),
{Scale( "Geodesic" ), Format( "Custom", Formula( Char( value ) || " s" ), 12 ), Minor Ticks( 1 )}
)
)
);
Code Explanation:
- Open data table.
- Perform Recurrence Analysis.
- Set event time column.
- Set label column.
- Set grouping column.
- Set start timestamp column.
- Set end timestamp column.
- Enable MCF confidence limits.
- Enable event plot.
- Enable MCF differences plot.
Example 3
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables to model the power nonhomogeneous Poisson process.
Code:
dt = Open("data_table.jmp");
ra = dt << Recurrence Analysis(
Y( :Age ),
Cost( :Cost ),
Grouping( :Treatment Group ),
Label( :Patient Number ),
Plot MCF Differences( 1 )
);
ra << Fit Model( Run Model, Model Type( "Power Nonhomogeneous Poisson Process" ) );
rascript = ra << Get Script;
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Set response variable.
- Set cost variable.
- Set grouping variable.
- Set label variable.
- Plot MCF differences.
- Fit power nonhomogeneous Poisson process model.
- Retrieve script for analysis.
Example 4
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables to model the power nonhomogeneous Poisson process.
Code:
dt = Open("data_table.jmp");
ra = dt << Recurrence Analysis(
Y( :Age ),
Cost( :Cost ),
Grouping( :Treatment Group ),
Label( :Patient Number ),
Plot MCF Differences( 1 )
);
ra << Fit Model( Run Model, Model Type( "Power Nonhomogeneous Poisson Process" ) );
rascript = ra << Get Script;
Eval( rascript );
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Set response variable.
- Set cost variable.
- Define grouping variable.
- Label patients.
- Plot MCF differences.
- Fit power nonhomogeneous Poisson process model.
- Retrieve script from analysis.
- Execute retrieved script.
Example 5
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables in JMP, generating multiple cause models and plots for different causes of death.
Code:
dt = Open("data_table.jmp");
obj = dt << Recurrence Analysis(
Y( :Age ),
Label( :Patient Number ),
Cost( :Cost ),
Cause( :Cause of Death ),
Fit Model( Run Model, Model Type( Power Nonhomogeneous Poisson Process ) )
);
r = Report( obj )["Multiple Cause Models"] << get scriptable object;
r << MCF Plot( 1 );
r1 = Report( obj )["Multiple Cause Models", "Fitted Recurrence Model Cause=Alive"] << get scriptable object;
r2 = Report( obj )["Multiple Cause Models", "Fitted Recurrence Model Cause=Bladder Cancer"] << get scriptable object;
r3 = Report( obj )["Multiple Cause Models", "Fitted Recurrence Model Cause=Other Cause"] << get scriptable object;
r3 << Remove Fit;
r << MCF Plot( 0 );
r << MCF Plot( 1 );
r2 << Remove Fit;
r << MCF Plot( 0 );
r << MCF Plot( 1 );
r1 << Remove Fit;
r << MCF Plot( 0 );
r << MCF Plot( 1 );
Code Explanation:
- Open data table;
- Perform Recurrence Analysis.
- Set Age as Y variable.
- Use Patient Number for labels.
- Include Cost variable.
- Specify Cause of Death.
- Fit Power Nonhomogeneous Poisson Process model.
- Get Multiple Cause Models report.
- Generate MCF Plot.
- Remove fit for Alive cause model.
- Update MCF Plot.
- Remove fit for Bladder Cancer cause model.
- Update MCF Plot.
- Remove fit for Other Cause model.
- Update MCF Plot.
Example 6
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables to model the recurrence of events in a dataset.
Code:
dt = Open("data_table.jmp");
obj = dt << Recurrence Analysis(
Y( :Age ),
Label( :Patient Number ),
Cost( :Cost ),
Grouping( :Treatment Group ),
Event Plot( 0 ),
Fit Model( Run Model, Profiler( 1 ), Model Type( Power Nonhomogeneous Poisson Process ) )
);
r = Report( obj )["Fitted Recurrence Model"] << get scriptable object;
r << Profiler( 0 );
r << Profiler( 1 );
Code Explanation:
- Open data table;
- Perform Recurrence Analysis.
- Set Y variable as Age.
- Use Patient Number for labeling.
- Include Cost variable.
- Group by Treatment Group.
- Disable Event Plot.
- Fit model using Power Nonhomogeneous Poisson Process.
- Retrieve Fitted Recurrence Model report.
- Toggle Profiler on and off.
Example 7
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables by performing recurrence analysis on the Age variable with cost and labeling EngineID.
Code:
dt = Open("data_table.jmp");
obj = dt << Recurrence Analysis(
Y( :Age ),
Cost( :Cost ),
Label( :EngineID ),
Event Plot( 0 ),
Fit Model( Run Model, Model Type( Proportional Intensity Poisson Process ) )
);
rpt = obj << report;
pip1exp = [-8.84047058945275, 1.39957926695259];
pip2exp = [1.29825927920351, 0.20050222815652];
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Set response variable as Age.
- Set cost variable as Cost.
- Use EngineID for labeling.
- Disable event plot.
- Fit proportional intensity model.
- Generate analysis report.
- Define first parameter estimates.
- Define second parameter estimates.
Example 8
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables to analyze the reliability of blenders.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Recurrence Analysis(
Y( :Age ),
Label( :Patient Number ),
Cost( :Cost ),
Grouping( :Treatment Group ),
Event Plot( 0 ),
Fit Model(
Scale Effects( :Treatment Group ),
Shape Effects( :Cause of Death ),
Run Model,
Model Type( Proportional Intensity Poisson Process )
)
);
obj1 << Fit Model;
Report( obj1 )[Button Box( 11 )] << Click;
Report( obj1 )[Button Box( 9 )] << Click;
Close( dt, No Save );
dt = Open("data_table.jmp");
dt:Treatment Group << Value Labels( {1 = "Placebo", 2 = "Pyridoxine", 3 = "Thiotepa", 4 = "Nonexistent"} ) << Use Value Labels( 1 ) <<
Set Property( "Forced Values", {1, 2, 3, 4} );
obj = dt << Recurrence Analysis( Y( :Age ), Cost( :Cost ), Grouping( :Treatment Group ), Label( :Patient Number ), Event Plot( 0 ) );
dt1 = obj << Save MCF Differences( Last );
Code Explanation:
- Open data table;
- Perform recurrence analysis.
- Set Y variable to Age.
- Set label to Patient Number.
- Set cost to Cost.
- Group by Treatment Group.
- Disable event plot.
- Fit model with specified effects.
- Run proportional intensity Poisson process.
- Refit the model.
- Click button box 11.
- Click button box 9.
- Close dataset without saving.
- Reopen data_table dataset
- Define value labels for Treatment Group.
- Apply value labels to Treatment Group.
- Set forced values for Treatment Group.
- Perform recurrence analysis again.
- Save MCF differences for last model.
Example 9
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables by performing Recurrence Analysis on the data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Recurrence Analysis(
Y( :Age ),
Label( :Patient Number ),
Cost( :Cost ),
Fit Model( Run Model, Model Type( Power Nonhomogeneous Poisson Process ) )
);
rpt = obj << report;
stdErr = rpt[Number Col Box( "Std Error" )] << get as matrix;
cov = rpt[Outline Box( "Covariance of Estimates" )][Matrix Box( 1 )] << get;
corr = rpt[Outline Box( "Covariance of Estimates" )][Matrix Box( 2 )] << get;
Code Explanation:
- Open data table;
- Perform Recurrence Analysis.
- Set Y variable as Age.
- Label by Patient Number.
- Include Cost variable.
- Fit Power Nonhomogeneous Poisson Process model.
- Retrieve analysis report.
- Extract Standard Error as matrix.
- Get Covariance of Estimates matrix.
- Obtain Correlation matrix.
Example 10
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables to estimate MTBF and parameter estimates from the provided data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Recurrence Analysis(
Age at Event( :Age ),
Label( :Patient Number ),
"End-of-Service"n( :Cost ),
Event Plot( 0 ),
Fit Model( Run Model, Model Type( "Homogeneous Poisson Process" ) )
);
rpt = obj << report;
est = rpt[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix;
mtbf = rpt[Outline Box( "Parameter Estimates" )][Table Box( 2 )] << get as matrix;
Code Explanation:
- Open data_table data
- Perform Recurrence Analysis.
- Set Age at Event.
- Label Patient Number.
- Include Cost.
- Disable Event Plot.
- Fit Homogeneous Poisson Process.
- Retrieve analysis report.
- Extract Parameter Estimates.
- Extract MTBF estimates.
Example 11
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables by performing recurrence analysis on the data table.
Code:
dt = Open("data_table.jmp");
r = dt << Select Excluded;
dt << Unexclude;
obj = dt << Recurrence Analysis(
Y( :kHours ),
Label( :System ID ),
Cost( :Cost ),
Event Plot( 1 ),
Fit Model(
Scale Effects( :Cost ),
Shape Effects( :Cost ),
Run Model,
Model Type( "Power Nonhomogeneous Poisson Process" ),
Test Homogeneity( 1 )
)
);
rpt = obj << report;
txt = rpt[Outline Box( "Test Homogeneity" )][Text Box( 1 )] << get text;
Code Explanation:
- Open data table.
- Select excluded rows.
- Unexclude all rows.
- Perform recurrence analysis.
- Set response variable.
- Set label variable.
- Set cost variable.
- Generate event plot.
- Fit model using Power Nonhomogeneous Poisson Process.
- Test homogeneity.
Example 12
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables by performing recurrence analysis with additional parameters and extracting reports.
Code:
dt = Open("data_table.jmp");
r = dt << Select Excluded;
dt << Unexclude;
obj = dt << Recurrence Analysis(
Y( :kHours ),
Label( :System ID ),
Cost( :Cost ),
Event Plot( 1 ),
Fit Model( Scale Effects( :System ID ), Run Model, Model Type( "Homogeneous Poisson Process" ) )
);
rpt = obj << report;
scptObj = rpt[Outline Box( "Fitted Recurrence Model" )] << get scriptable object;
scptObj << Remove Fit;
Close( dt, No Save );
dt = Open("data_table.jmp");
dt << Run Script( "Recurrence Analysis" );
dt << Run Script( "Recurrence Grouped" );
lcap1 = Log Capture( dt << Run Script( "Proportional Intensity Model" ) );
lcap2 = Log Capture( dt << Run Script( "Recurrence endtime in column" ) );
lcap3 = Log Capture( dt << Run Script( "Recurrence endtime in field" ) );
Close( dt, No Save );
dt = Open("data_table.jmp");
r = dt << Select Excluded;
dt << Unexclude;
obj = dt << Recurrence Analysis(
Y( :kHours ),
Label( :System ID ),
Cost( :Cost ),
Event Plot( 1 ),
Fit Model(
Scale Effects( :Cost ),
Shape Effects( :Cost ),
Run Model,
Model Type( "Power Nonhomogeneous Poisson Process" ),
Test Homogeneity( 1 )
)
);
rpt = obj << report;
txt = rpt[Outline Box( "Test Homogeneity" )][Text Box( 1 )] << get text;
Code Explanation:
- Open data table.
- Select excluded rows.
- Unexclude all rows.
- Perform recurrence analysis.
- Extract report.
- Get scriptable object.
- Remove fit from object.
- Close data table.
- Reopen data table.
- Run "Recurrence Analysis" script.
- Run "Recurrence Grouped" script.
- Capture log for "Proportional Intensity Model".
- Capture log for "Recurrence endtime in column".
- Capture log for "Recurrence endtime in field".
- Close data table.
- Reopen data table.
- Select excluded rows again.
- Unexclude all rows.
- Perform recurrence analysis with additional parameters.
- Extract report.
- Get text from homogeneity test.
Example 13
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables to generate a report with recurrence analysis results.
Code:
Open("data_table.jmp");
plat = Recurrence Analysis( Y( :Age ), Cost( :Cost ), Grouping( :Treatment Group ), Label( :Patient Number ), Plot MCF Differences( 1 ) );
rep = Report( plat );
title = rep[Outline Box( 2 )] << GetTitle;
dt = New Table( "Rigdon_Basu_Table4_8",
New Column( "System", Values( [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] ) ),
New Column( "t", Values( [10, 55, 166, 205, 341, 488, 567, 731, 1308, 2050, 2453, 3115, 4017, 4596, 4596] ) ),
New Column( "Cost", Values( [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0] ) )
);
plat = dt << Recurrence Analysis(
Y( :t ),
Cost( :Cost ),
Label( :System ),
Fit Model( Run Model, Model Type( Homogeneous Poisson Process ), Specific Intensity and Cumulative( [1000, 0.95] ) )
);
rep = Report( plat );
result = (rep[Table Box( 4 )] << GetAsMatrix);
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Retrieve report object.
- Extract title from outline box.
- Create new table.
- Add columns to new table.
- Perform recurrence analysis on new table.
- Retrieve updated report object.
- Extract matrix from table box.
- Store result in variable.
Example 14
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables to generate a recurrence plot with expected values.
Code:
dt = Open("data_table.jmp");
plat = Recurrence Analysis( Y( :Age ), Cost( :Cost ), Grouping( :Treatment Group ), Label( :Patient Number ), Plot MCF Differences( 1 ) );
rep = Report( plat );
title = rep[Outline Box( 2 )] << GetTitle;
Close( dt, No Save );
::Expected = [1000 3.0461270670148 1.71607190480756 4.93170866274965 0.95,
1000 0.0030461270670148 0.00171607190490799 0.00493170866269081 0.95];
dt = New Table( "Rigdon_Basu_Table4_8",
New Column( "System", Values( [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] ) ),
New Column( "t", Values( [10, 55, 166, 205, 341, 488, 567, 731, 1308, 2050, 2453, 3115, 4017, 4596, 4596] ) ),
New Column( "Cost", Values( [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0] ) )
);
plat = dt << Recurrence Analysis(
Y( :t ),
Cost( :Cost ),
Label( :System ),
Fit Model( Run Model, Model Type( Homogeneous Poisson Process ), Specific Intensity and Cumulative( [1000, 0.95] ) )
);
rep = Report( plat );
result = (rep[Table Box( 4 )] << GetAsMatrix);
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Retrieve report object.
- Extract title from outline box.
- Close data table without saving.
- Define expected values array.
- Create new table.
- Add columns to new table.
- Perform recurrence analysis on new table.
- Retrieve result matrix from report.
Example 15
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables by performing recurrence analysis, fitting homogeneous Poisson process models, and calculating negative log-likelihood.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Recurrence Analysis(
Y( :Age ),
Cost( :Cost ),
Label( :EngineID ),
Event Plot( 0 ),
Fit Model( Run Model, Model Type( Power Nonhomogeneous Poisson Process ) )
);
rpt1 = obj1 << report;
r1 = rpt1["Fitted Recurrence Model"] << get scriptable object;
r1 << Test Homogeneity;
est1 = Matrix( rpt1[Number Col Box( "Estimate" )] << get );
std1 = Matrix( rpt1[Number Col Box( "Std Error" )] << get );
n2llk1 = (rpt1[Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
LRChiSquare1 = (rpt1[Number Col Box( "L-R ChiSquare" )] << get)[1];
df1 = (rpt1[Number Col Box( "DF" )] << get)[1];
prob1 = (rpt1[Number Col Box( "Prob>ChiSq" )] << get)[1];
r1 << Remove Fit;
obj1 << Fit Model( Model Type( Homogeneous Poisson Process ), Run Model, );
rpt = obj1 << report;
n2llk = (rpt[Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
chi2 = n2llk - n2llk1;
dt << New Column( "Loss",
Formula(
Parameter(
{theta = 550, beta = 1},
If( :Cost != 0,
-:Cost * (Log( beta / theta ) + (beta - 1) * Log( :Age / theta )),
(:Age / theta) ^ beta
)
)
)
);
obj2 = dt << Nonlinear( Loss( :Loss ), Loss is Neg LogLikelihood( 1 ), Newton, Finish, );
rpt2 = obj2 << report;
est2 = Matrix( rpt2[Number Col Box( "Estimate" )] << get );
std2 = Matrix( rpt2[Number Col Box( "ApproxStdErr" )] << get );
nllk2 = Matrix( rpt2[Number Col Box( "Loss" )] << get )[1];
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Extract fitted model report.
- Test homogeneity of recurrence model.
- Retrieve estimates and standard errors.
- Calculate negative log-likelihood.
- Calculate likelihood ratio chi-square.
- Retrieve degrees of freedom and probability.
- Remove previous fit.
- Fit homogeneous Poisson process model.
- Calculate new negative log-likelihood.
- Compute chi-square statistic.
- Create new column for loss.
- Perform nonlinear fitting.
- Extract nonlinear model report.
- Retrieve new estimates and standard errors.
- Retrieve final negative log-likelihood.
Example 16
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables by performing recurrence analysis, testing homogeneity, and extracting parameter estimates.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Recurrence Analysis(
Y( :Age ),
Label( :EngineID ),
Cost( :Cost ),
Event Plot( 0 ),
Fit Model( Run Model, Model Type( Proportional Intensity Poisson Process ) )
);
rpt1 = obj1 << report;
r1 = rpt1["Fitted Recurrence Model"] << get scriptable object;
r1 << Test Homogeneity;
est1 = Matrix( rpt1[Number Col Box( "Estimate" )] << get );
std1 = Matrix( rpt1[Number Col Box( "Std Error" )] << get );
n2llk1 = (rpt1[Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
LRChiSquare1 = (rpt1[Number Col Box( "L-R ChiSquare" )] << get)[1];
df1 = (rpt1[Number Col Box( "DF" )] << get)[1];
prob1 = (rpt1[Number Col Box( "Prob>ChiSq" )] << get)[1];
r1 << Remove Fit;
obj1 << Fit Model( Model Type( Homogeneous Poisson Process ), Run Model, );
rpt = obj1 << report;
n2llk = (rpt[Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
chi2 = n2llk - n2llk1;
dt << New Column( "Loss",
Formula(
Parameter(
{gamma = -8, delta = 1},
If( :Cost != 0,
-:Cost * (Log( delta ) + (delta - 1) * Log( :Age ) + gamma),
(:Age ^ delta) * (Exp( gamma ))
)
)
)
);
obj2 = dt << Nonlinear( Loss( :Loss ), Loss is Neg LogLikelihood( 1 ), Newton, Finish, );
rpt2 = obj2 << report;
est2 = Matrix( rpt2[Number Col Box( "Estimate" )] << get );
std2 = Matrix( rpt2[Number Col Box( "ApproxStdErr" )] << get );
nllk2 = (rpt2[Number Col Box( "Loss" )] << get)[1];
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Retrieve fitted model report.
- Test homogeneity of model.
- Extract parameter estimates.
- Extract standard errors.
- Calculate negative log-likelihood.
- Extract chi-square statistic.
- Extract degrees of freedom.
- Extract p-value.
Example 17
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables by performing recurrence analysis, testing homogeneity, and extracting parameter estimates.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Recurrence Analysis(
Y( :Age ),
Label( :EngineID ),
Cost( :Cost ),
Event Plot( 0 ),
Fit Model( Run Model, Model Type( Loglinear Nonhomogeneous Poisson Process ) )
);
rpt1 = obj1 << report;
r1 = rpt1["Fitted Recurrence Model"] << get scriptable object;
r1 << Test Homogeneity;
est1 = Matrix( rpt1[Number Col Box( "Estimate" )] << get );
std1 = Matrix( rpt1[Number Col Box( "Std Error" )] << get );
n2llk1 = (rpt1[Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
LRChiSquare1 = (rpt1[Number Col Box( "L-R ChiSquare" )] << get)[1];
df1 = (rpt1[Number Col Box( "DF" )] << get)[1];
prob1 = (rpt1[Number Col Box( "Prob>ChiSq" )] << get)[1];
r1 << Remove Fit;
obj1 << Fit Model( Model Type( Homogeneous Poisson Process ), Run Model, );
rpt = obj1 << report;
n2llk = (rpt[Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
chi2 = n2llk - n2llk1;
dt << New Column( "Loss",
Formula(
Parameter(
{gamma = -6, delta = .001},
If( :Cost != 0,
-:Cost * (gamma + delta * :Age),
((Exp( gamma + delta * :Age ) - Exp( gamma )) / delta)
)
)
)
);
obj2 = dt << Nonlinear( Loss( :Loss ), Loss is Neg LogLikelihood( 1 ), Newton, Finish, );
rpt2 = obj2 << report;
est2 = Matrix( rpt2[Number Col Box( "Estimate" )] << get );
std2 = Matrix( rpt2[Number Col Box( "ApproxStdErr" )] << get );
nllk2 = (rpt2[Number Col Box( "Loss" )] << get)[1];
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Retrieve fitted model report.
- Test homogeneity of model.
- Extract parameter estimates.
- Extract standard errors.
- Calculate negative log-likelihood.
- Calculate likelihood ratio chi-square.
- Extract degrees of freedom.
- Extract p-value for chi-square test.
Example 18
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables by performing recurrence analysis, extracting estimates and standard errors, creating a new column for loss, and conducting nonlinear analysis.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Recurrence Analysis(
Y( :Age ),
Label( :EngineID ),
Cost( :Cost ),
Event Plot( 0 ),
Fit Model( Run Model, Model Type( Homogeneous Poisson Process ) )
);
rpt1 = obj1 << report;
est1 = Matrix( rpt1[Number Col Box( "Estimate" )] << get );
std1 = Matrix( rpt1[Number Col Box( "Std Error" )] << get );
n2llk1 = (rpt1[Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
dt << New Column( "Loss", Formula( Parameter( {gamma = -6}, If( :Cost != 0, -:Cost * (gamma), (:Age * Exp( gamma )) ) ) ) );
obj2 = dt << Nonlinear( Loss( :Loss ), Loss is Neg LogLikelihood( 1 ), Newton, Finish, );
rpt2 = obj2 << report;
est2 = Matrix( rpt2[Number Col Box( "Estimate" )] << get );
std2 = Matrix( rpt2[Number Col Box( "ApproxStdErr" )] << get );
nllk2 = (rpt2[Number Col Box( "Loss" )] << get)[1];
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Extract estimates from report.
- Extract standard errors from report.
- Extract negative log-likelihood from report.
- Create new column for loss.
- Perform nonlinear analysis.
- Extract estimates from report.
- Extract standard errors from report.
- Extract negative log-likelihood from report.
Example 19
Summary: Performs a survival analysis using time cycles, censor status, and grouping variables to estimate parameters for different causes of death.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Recurrence Analysis(
Y( :Age ),
Label( :Patient Number ),
Cost( :Cost ),
Event Plot( 0 ),
Fit Model( Run Model, Model Type( Loglinear Nonhomogeneous Poisson Process ) ),
By( :Cause of Death )
);
rpt1 = obj1 << report;
estAlive = Matrix( rpt1[1][Number Col Box( "Estimate" )] << get );
stdAlive = Matrix( rpt1[1][Number Col Box( "Std Error" )] << get );
n2llkAlive = (rpt1[1][Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
estBladder = Matrix( rpt1[2][Number Col Box( "Estimate" )] << get );
stdBladder = Matrix( rpt1[2][Number Col Box( "Std Error" )] << get );
n2llkBladder = (rpt1[2][Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
estOther = Matrix( rpt1[3][Number Col Box( "Estimate" )] << get );
stdOther = Matrix( rpt1[3][Number Col Box( "Std Error" )] << get );
n2llkOther = (rpt1[3][Outline Box( "Parameter Estimates" )][Number Col Box( 3 )] << get)[1];
dt << New Column( "By Loss Column",
Formula(
Parameter(
{gamma1 = -2, delta1 = -.002, gamma2 = -2, delta2 = -.02, gamma3 = -2, delta3 = -.002},
tempGamma = Match( :Cause of Death, 0, gamma1, 1, gamma2, 2, gamma3, . );
tempDelta = Match( :Cause of Death, 0, delta1, 1, delta2, 2, delta3, . );
If( :Cost != 0,
-:Cost * (tempGamma + tempDelta * :Age),
((Exp( tempGamma + tempDelta * :Age ) - Exp( tempGamma )) / tempDelta)
);
)
)
);
obj1 = dt << Nonlinear( Loss( :By Loss Column ), Loss is Neg LogLikelihood( 1 ), Newton, Finish, );
rpt1 = obj1 << report;
est1 = Matrix( rpt1[Number Col Box( "Estimate" )] << get );
std1 = Matrix( rpt1[Number Col Box( "ApproxStdErr" )] << get );
nllk1 = (rpt1[Number Col Box( "Loss" )] << get)[1];
Code Explanation:
- Open data table.
- Perform recurrence analysis.
- Extract report.
- Retrieve estimates for alive.
- Retrieve standard errors for alive.
- Retrieve negative log-likelihood for alive.
- Retrieve estimates for bladder.
- Retrieve standard errors for bladder.
- Retrieve negative log-likelihood for bladder.
- Retrieve estimates for other causes.
- Retrieve standard errors for other causes.
- Retrieve negative log-likelihood for other causes.
- Create new column for loss calculation.
- Perform nonlinear fitting.
- Extract report from nonlinear fit.
- Retrieve estimates from nonlinear fit.
- Retrieve standard errors from nonlinear fit.
- Retrieve negative log-likelihood from nonlinear fit.
Fit Model using Select Rows
Example 1
Summary: Performs recurrence analysis on a data table, excluding specific rows and fitting a model using specified parameters.
Code:
// Recurrence endtime in column
// Open data table
dt = Open("data_table.jmp");
// Recurrence endtime in column
dt = Current Data Table();
dt << Clear Select;
dt << Select Excluded << Exclude;
dt << Clear Select;
dt << Select Rows( [57, 129] ) << Exclude;
dt << Clear Select;
obj =
Recurrence Analysis(
Y( :event time ),
Label( :System ID ),
Grouping( :System ID ),
Timestamp at Start( :orig time ),
Timestamp at End( :end time ),
Event Plot( 1 ),
Age Scaling( "DateTime to Hour" ),
Fit Model(
Scale Effects( :System ID ),
Run Model,
Model Type(
"Power Nonhomogeneous Poisson Process"
)
)
);
Code Explanation:
- Open data table.
- Set current data table.
- Clear all selections.
- Exclude excluded rows.
- Clear all selections again.
- Select specific rows.
- Exclude selected rows.
- Clear all selections.
- Perform recurrence analysis.
- Fit model using specified parameters.
Example 2
Summary: Performs a recurrence analysis on a data table, setting the Y variable to event time, labeling by System ID, and grouping by the same field. It also sets age scaling to DateTime to Hour and fits a power nonhomogeneous Poisson process model.
Code:
// Recurrence endtime in field
// Open data table
dt = Open("data_table.jmp");
// Recurrence endtime in field
dt = Current Data Table();
dt << Clear Select;
dt << Select Excluded << Exclude;
dt << Clear Select;
dt << Select Rows( [57, 129] ) << Exclude;
dt << Clear Select;
obj =
Recurrence Analysis(
Y( :event time ),
Label( :System ID ),
Grouping( :System ID ),
Timestamp at Start( :orig time ),
Event Plot( 1 ),
Age Scaling( "DateTime to Hour" ),
Default End Timestamp(
"1996/09/30 02:20:00"
),
Fit Model(
Scale Effects( :System ID ),
Run Model,
Model Type(
"Power Nonhomogeneous Poisson Process"
)
)
);
Code Explanation:
- Open data table.
- Set current data table.
- Clear selection.
- Exclude excluded rows.
- Clear selection again.
- Exclude specific rows.
- Clear selection.
- Perform recurrence analysis.
- Set Y variable.
- Set label variable.
- Set grouping variable.
- Set timestamp at start.
- Enable event plot.
- Set age scaling.
- Set default end timestamp.
- Fit model.
- Scale effects by system ID.
- Run model.
- Set model type.
Example 3
Summary: Runs marker relatedness analysis and model fitting with random effects, utilizing principal components, clustering, and kinship table merging.
Code:
dt = Open("data_table.jmp");
dt << Clear Select << Select Rows( Index( 11, 1000 ) ) << Delete Rows;
obj = dt << Marker Relatedness(
Marker( Column Group( "Markers" ) ),
Principal Components( 1 ),
Clustering( 1 ),
Ploidy( 2 ),
Set Random Seed( 0 ),
Missing Marker Imputation Method( "NONEHWE" ),
Kinship Type( "Identical by State" ),
SendToReport(
Dispatch( {"Marker Relatedness", "Hierarchical Clustering", "Dendrogram"}, "Clust Dendro", FrameBox, {Frame Size( 35, 700 )} )
)
);
obj << Merge Kinship Table;
Fit Model(
Effects,
Random Effects( Grouped( Column Group( "IBS" ) ) ),
Personality( "Response Screening" ),
Y( :Trait1 ),
Switch( :CG1 SNP1, :CG1 SNP2 ),
Run,
SendToReport(
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 0 )} ),
Dispatch( {}, "Variance Components", OutlineBox, {Close( 0 )} )
)
);
Code Explanation:
- Open data table.
- Clear previous selections.
- Select specific rows.
- Delete selected rows.
- Perform marker relatedness analysis.
- Set principal components to 1.
- Enable clustering.
- Set ploidy to 2.
- Initialize random seed.
- Use NONEHWE imputation method.
- Set kinship type to IBS.
- Adjust dendrogram size.
- Merge kinship table.
- Fit model with random effects.
- Use response screening personality.
- Set Y variable to Trait1.
- Include specific switch effects.
- Run the model.
- Close parameter estimates report.
- Close variance components report.
Fit Model using Time Series Forecast
Example 1
Summary: Performs a time series forecast of monthly sales data using the X11 decomposition method, specifying the response variable, grouping variable, and time variable.
Code:
// Time Series Forecast of Data 2
// Open data table
dt = Open("data_table.jmp");
// Time Series Forecast of Data 2
Time Series Forecast(
Y( :Y ),
Grouping( :Series ),
Time( :Time ),
Fit Model(
NAhead( 4 ),
Period( 4 ),
Constrain Parameters( 1 )
)
);
Code Explanation:
- Open table.
- Define data table variable.
- Perform time series forecast.
- Specify response variable.
- Specify grouping variable.
- Specify time variable.
- Fit model for forecasting.
- Set forecast ahead.
- Define period length.
- Constrain model parameters.
Example 2
Summary: Runs the Time Series X11 decomposition of a dataset containing monthly sales data, using the Date column as the time variable and generating reports for two series.
Code:
dt = Open("data_table.jmp");
obj = Time Series Forecast(
Y( :Y ),
Grouping( :Series ),
Time( :Time ),
Fit Model( NAhead( 8 ), Seasonality( 1 ), NHoldout( 8 ) ),
Show Report for Series( 0, 0, 1 ),
Show Report for Series( 0, 0, 2 )
);
rpt = obj << report;
tmp1 = rpt[Outline Box( "Series = N 647" )] << Get Scriptable Object;
tmp1 << Remove;
Code Explanation:
- Open data_table data
- Define time series forecast object.
- Set response variable.
- Specify grouping variable.
- Define time variable.
- Configure fit model settings.
- Generate report for first series.
- Generate report for second series.
- Extract report outline box.
- Remove extracted outline box.
Example 3
Summary: Runs the time series X11 decomposition of monthly sales data using JMP's Time Series Forecast platform, generating a forecast report and extracting model summary labels.
Code:
dt = Open("data_table.jmp");
obj = Time Series Forecast( Y( :Y ), Grouping( :Series ), Time( :Time ), Fit Model( NAhead( 10 ), Seasonality( [1 4] ), NHoldout( 8 ) ) );
rpt = obj << report;
label1 = rpt[Outline Box( "Model Summary" )][String Col Box( 1 )] << get;
Code Explanation:
- Open data_table data
- Create time series forecast object.
- Set forecast parameters.
- Generate forecast report.
- Extract model summary label.
Example 4
Summary: Runs time series forecasting and report generation for monthly sales data, selecting specific model reports and retrieving titles from outline boxes.
Code:
dt = Open("data_table.jmp");
obj = dt << Time Series Forecast(
Y( :Price, :Price2000, :Name( "Price/Price2000" ) ),
Grouping( :Series ),
Time( :date ),
Fit Model( NAhead( 12 ), NHoldout( 0 ) )
);
rpt = obj << report;
rpt[Outline Box( "Model Reports" )][Table Box( 1 )][String Col Box( 1 )] << set selected rows( [37] );
title1 = rpt[Outline Box( "Model Reports" )][Outline Box( 2 )] << get title;
title2 = rpt[Outline Box( "Model Reports" )][Outline Box( 3 )] << get title;
rpt[Outline Box( "Model Reports" )][Table Box( 1 )][String Col Box( 1 )] << set selected rows( [1] );
title3 = rpt[Outline Box( "Model Reports" )][Outline Box( 2 )] << get title;
title4 = rpt[Outline Box( "Model Reports" )][Outline Box( 3 )] << get title;
Code Explanation:
- Open data table;
- Perform time series forecast.
- Select specific model report row.
- Retrieve first title from outline box.
- Retrieve second title from outline box.
- Select another model report row.
- Retrieve third title from outline box.
- Retrieve fourth title from outline box.
Example 5
Summary: Runs time series forecasting and decomposition of monthly sales data using the X11 method, generating reports with parameter estimates.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Time Series Forecast(
Y( :Log Passengers ),
Time( :Time ),
Fit Model(
Select Models( ETS( Error Type( "Multiplicative" ), Trend Type( "Additive" ), Seasonal Type( "Additive" ), Damped( "No" ) ) ),
Forecasting Settings( NAhead( 20 ), Period( 12 ), NHoldout( 0 ) ),
Other Options(
Preserve Model Selection Criterion( 1 ),
Forecast Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
),
SendToReport(
Dispatch( {}, "Modeling Specifications", OutlineBox, {Close( 1 )} ),
Dispatch( {"Modeling Specifications", "Forecasting Settings"}, "", TextEditBox, {Fixed Size( 1, 100, 19 ), Set Text( "12" )} ),
Dispatch( {}, "Model Reports", OutlineBox, {Visibility( "Visible" )} )
)
);
rpt1 = obj1 << report;
obj2 = dt << Time Series Forecast(
Y( :Log Passengers ),
Time( :Time ),
Fit Model(
Select Models( ETS( Error Type( "Multiplicative" ), Trend Type( "Additive" ), Seasonal Type( "Additive" ), Damped( "No" ) ) ),
Forecasting Settings( NAhead( 20 ), Period( 12 ), NHoldout( 0 ) ),
Other Options(
Preserve Model Selection Criterion( 1 ),
Forecast Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
);
rpt2 = obj2 << report;
test1 = rpt1[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix;
test2 = rpt2[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Create time series forecast object1.
- Set Y variable to Log Passengers.
- Set Time variable to Time.
- Fit ETS model with specified parameters.
- Set forecasting settings.
- Configure other options.
- Hide modeling specifications.
- Set period to 12.
- Show model reports.
- Create time series forecast object2.
- Extract parameter estimates from report1.
- Extract parameter estimates from report2.
Example 6
Summary: Runs the time series X11 decomposition of monthly sales data using JMP's Time Series Forecast function, fitting multiple ETS models and generating a forecast report.
Code:
dt = Open("data_table.jmp");
obj = Time Series Forecast(
Y( :Passengers ),
Time( :Time ),
Fit Model(
Select Models(
ETS( Error Type( "Multiplicative" ), Trend Type( "None" ), Seasonal Type( "Additive" ), Damped( "No" ) ),
ETS( Error Type( "Multiplicative" ), Trend Type( "Additive" ), Seasonal Type( "Additive" ), Damped( "No" ) ),
ETS( Error Type( "Multiplicative" ), Trend Type( "Additive" ), Seasonal Type( "Additive" ), Damped( "Yes" ) )
),
Forecasting Settings( NAhead( 10 ), Period( 12 ), NHoldout( 0 ) ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecast Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
);
rpt = obj << report;
type = rpt[Outline Box( "Model Type" )][Text Box( 2 )] << get text;
Code Explanation:
- Open data_table data
- Define time series forecast object.
- Set response variable.
- Set time variable.
- Fit multiple ETS models.
- Configure forecasting settings.
- Set other options.
- Generate forecast report.
- Extract model type text.
- Assign extracted text to variable.
Example 7
Summary: Runs time series forecasting and decomposition of monthly sales data, generating forecast intervals and retrieving plot segments.
Code:
dt = Open("data_table.jmp");
obj1 = Time Series Forecast(
Y( :Log Passengers ),
Time( :Time ),
Fit Model(
NAhead( 10 ),
Period( 4 ),
NHoldout( 0 ),
Forecasting Settings( NAhead( 10 ), Period( 12 ), NHoldout( 0 ) ),
Constrain Parameters( 0 ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecast Interval Level( 0.5 ),
Imputation for Applicable Models( "None" )
)
)
);
rpt1 = obj1 << report;
dt2 = (obj1 << Save Results(
Save Forecast Intervals( 1 ),
Name( "Save One-Step-Ahead Predictions" )(0),
Save Original Series( 0 ),
Save Forecast Results to Original Table( 0 ),
Forecast Interval Level( 0.5 ),
NAhead( 10 ),
NHoldout( 0 )
))[1];
lower fi50 = dt2:Name( "Log Passengers (Lower 50%)" ) << get values;
upper fi50 = dt2:Name( "Log Passengers (Upper 50%)" ) << get values;
plot fi = (rpt1[Outline Box( "Series and Forecasts" )][FrameBox( 1 )] << Find Segs( PolySeg )) << get Y values;
Code Explanation:
- Open data_table data
- Create time series forecast object.
- Set forecast parameters.
- Generate forecast report.
- Save forecast results to new table.
- Extract lower forecast interval.
- Extract upper forecast interval.
- Retrieve plot segments.
- Get Y values from plot.
- Store extracted values.
Example 8
Summary: Runs time series forecasting and decomposition of monthly sales data using the X11 method, with parameters set for a 4-step ahead forecast and imputation.
Code:
dt = Open("data_table.jmp");
obj = dt << Time Series Forecast(
Y( :Y ),
Grouping( :Series ),
Time( :Time ),
Fit Model(
NAhead( 4 ),
Period( 4 ),
NHoldout( 0 ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecasting Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
);
dt2 = (obj << Save Results(
Save Forecast Intervals( 0 ),
Name( "Save One-Step-Ahead Predictions" )(0),
Save Original Series( 0 ),
Save Forecast Results to Original Table( 0 ),
Forecasting Interval Level( 0.95 ),
N Ahead( 20 ),
Holdout( 0 )
))[1];
dt3 = Data Table("data_table") << Split( Split By( :Series ), Split( :Y ), Remaining Columns( Drop All ), Sort by Column Property );
dt3 y646 = dt3:N 646 << get values;
dt y646 = (dt:Y << get values)[1 :: 44];
Close( dt, no save );
Code Explanation:
- Open data_table data
- Perform time series forecasting.
- Set forecast parameters.
- Save forecast results.
- Split data table by series.
- Extract specific series values.
- Extract original series values.
- Close original data table.
Example 9
Summary: Runs time series forecasting and decomposition of monthly sales data using the X11 method, generating forecast intervals and saving results to a new table.
Code:
dt = Open("data_table.jmp");
obj = Time Series Forecast(
Y( :Price ),
Time( :Year ),
Fit Model(
Select Models(
ETS( Error Type( "Additive" ), Trend Type( "Additive" ), Seasonal Type( "None" ), Damped( "Yes" ) ),
Constrain Parameters( 0 ),
),
Forecasting Settings( NAhead( 10 ), NHoldout( 0 ) ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecast Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
);
rpt = obj << report;
dt2 = (obj << Save Results(
Save Forecast Intervals( 1 ),
Name( "Save One-Step-Ahead Predictions" )(0),
Save Original Series( 0 ),
Save Forecast Results to Original Table( 0 ),
Forecast Interval Level( 0.95 ),
NAhead( 10 ),
NHoldout( 0 )
))[1];
fi95 = (dt2 << get as matrix)[0, 2 :: 4];
b fi95 = [1572.9868203155 1384.41782651072 1767.18592301449,
1470.20788896397 1224.82491999765 1819.85386494249,
1413.99355209847 1145.82636710235 1848.39212375291,
1383.24744851796 1088.65197683527 1859.32368846236,
1366.43104654483 1043.53409008127 1870.73552180569,
1357.23341359659 1008.73829663898 1887.5982125351,
1352.20282191678 976.991128674843 1892.5266775765,
1349.4513691472 955.179401884862 1915.74867225852,
1347.94647810751 948.310341257474 1939.04705515661,
1347.12338673326 942.546284825438 1956.08425375373];
b fi95 2 = [1572.9868203155 1382.38865790976 1763.58498272125,
1516.77248345 1213.55215805518 1819.99280884482,
1486.02637986949 1129.75298333502 1842.29977640397,
1469.20997789636 1078.50518498267 1859.91477081006,
1460.01234494813 1042.99617918936 1877.02851070689,
1454.98175326831 1015.7875661642 1894.17594037242,
1452.23030049873 993.213271219201 1911.24732977825,
1450.72540945905 973.367789361757 1928.08302955634,
1449.90231808479 955.227248293665 1944.57738787592,
1449.45213305976 938.226410155071 1960.67785596445];
Code Explanation:
- Open data table.
- Perform time series forecasting.
- Set model parameters.
- Configure forecasting settings.
- Apply other options.
- Generate report.
- Save results to new table.
- Extract forecast intervals.
- Define expected forecast intervals.
- Define alternative expected forecast intervals.
Example 10
Summary: Runs the time series forecasting process for monthly sales data, generating one-step-ahead predictions with customized save options and forecast interval level.
Code:
dt = Open("data_table.jmp");
obj = dt << Time Series Forecast( Y( :CO2 ), Fit Model( NAhead( 18 ), Seasonality( 12 ), NHoldout( 17 ) ) );
rpt = obj << report;
saved1 = obj << Save Results(
Save Forecast Intervals( 0 ),
Name( "Save One-Step-Ahead Predictions" )(1),
Save Original Series( 0 ),
Save Forecast Results to Original Table( 0 ),
Forecast Interval Level( 0.95 ),
NAhead( 18 ),
NHoldout( 10 )
);
saved1[1] << New Column( "row", formula( Row() ) );
Code Explanation:
- Open data table.
- Create time series forecast object.
- Fit model with parameters.
- Generate forecast report.
- Save forecast results.
- Customize save options.
- Save one-step-ahead predictions.
- Set forecast interval level.
- Specify ahead and holdout periods.
- Add row number column.
Example 11
Summary: Runs time series forecasting and decomposition of monthly sales data using the X11 method, with options for preserving model selection criterion and imputation.
Code:
dt = Open("data_table.jmp");
obj = dt << Time Series Forecast(
Y( :Y ),
Grouping( :Series ),
Time( :Time ),
Fit Model(
NAhead( 4 ),
Period( 4 ),
NHoldout( 0 ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecasting Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
);
dt2 = (obj << Save Results(
Save Forecast Intervals( 0 ),
Name( "Save One-Step-Ahead Predictions" )(0),
Save Original Series( 0 ),
Save Forecast Results to Original Table( 0 ),
Forecasting Interval Level( 0.95 ),
N Ahead( 20 ),
Holdout( 0 )
))[1];
dt3 = Data Table("data_table") << Split( Split By( :Series ), Split( :Y ), Remaining Columns( Drop All ), Sort by Column Property );
dt3 y646 = dt3:N 646 << get values;
dt y646 = (dt:Y << get values)[1 :: 44];
Code Explanation:
- Open data_table data
- Initiate time series forecasting.
- Set forecasted variable.
- Define grouping variable.
- Specify time variable.
- Configure fit model settings.
- Save forecast results.
- Split data table by series.
- Extract values from split table.
- Extract original values for comparison.
Example 12
Summary: Runs the Time Series X11 decomposition of a dataset containing monthly sales data using the Date column as the time variable, generating model summary matrices and reports.
Code:
dt = Open("data_table.jmp");
obj = dt << Time Series Forecast(
Y( :Y ),
Grouping( :Series ),
Time( :Time ),
Fit Model(
NAhead( 4 ),
Period( 4 ),
NHoldout( 0 ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecast Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
);
rpt = obj << report;
fit1 = rpt["Model Reports"]["Series = N 646"]["Model Summary"][Table Box( 1 )] << get as matrix;
obj << Automatic Recalc( 1 );
dt << Clear row states;
dt << Select Where( Row() < 11 );
dt << Exclude;
rpt = obj << report;
fit2 = rpt["Model Reports"]["Series = N 646"]["Model Summary"][Table Box( 1 )] << get as matrix;
dt << Clear row states;
rpt = obj << report;
fit3 = rpt["Model Reports"]["Series = N 646"]["Model Summary"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data_table data
- Run time series forecast.
- Store forecast object.
- Generate report.
- Extract model summary matrix.
- Enable automatic recalculation.
- Clear row states.
- Select first 10 rows.
- Exclude selected rows.
- Extract updated model summary matrix.
Example 13
Summary: Runs the time series forecasting process for monthly sales data, extracting relevant values and generating a forecast report with parameter estimates and sigma squared value.
Code:
dt = Open("data_table.jmp");
my1 = (dt:Y << get values)[1 :: 44];
my2 = (dt:Y << get values)[1 :: 34];
my3 = (dt:Y << get values)[35 :: 44];
time1 = (dt:Time << get values)[1 :: 44];
obj = Time Series Forecast(
Y( :Y ),
Grouping( :Series ),
Time( :Time ),
Fit Model(
NAhead( 4 ),
Period( 4 ),
NHoldout( 0 ),
Constrain Parameters( 0 ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecast Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
),
);
rpt = obj << report;
sigma2 = (rpt[Outline Box( "Model Summary" )][Table Box( 1 )] << get as matrix)[5] ^ 2;
alpha0 = (rpt[Outline Box( "Parameter Estimates" )][Number Col Box( "Estimate" )] << get as matrix)[1];
beta0 = (rpt[Outline Box( "Parameter Estimates" )][Number Col Box( "Estimate" )] << get as matrix)[2];
gamma0 = (rpt[Outline Box( "Parameter Estimates" )][Number Col Box( "Estimate" )] << get as matrix)[3];
inits0 = (rpt[Outline Box( "Parameter Estimates" )][Number Col Box( "Estimate" )] << get as matrix)[4 :: 9];
saved2 = obj << Save Results(
Save Forecast Intervals( 0 ),
Name( "Save One-Step-Ahead Predictions" )(0),
Save Original Series( 0 ),
Save Forecast Results to Original Table( 0 ),
Forecast Interval Level( 0.95 ),
NAhead( 20 ),
NHoldout( 10 )
);
dt forecast1 = saved2[1];
forecast1 = (dt forecast1:Y << get values)[1 :: 20];
b forecast1 time1 = {"1995Q1", "1995Q2", "1995Q3", "1995Q4", "1996Q1", "1996Q2", "1996Q3", "1996Q4", "1997Q1", "1997Q2", "1997Q3", "1997Q4",
"1998Q1", "1998Q2", "1998Q3", "1998Q4", "1999Q1", "1999Q2", "1999Q3", "1999Q4"};
saved time1 = (dt forecast1:Time << get values)[1 :: 20];
forecast1 time1 = {};
For( i = 1, i <= N Rows( saved time1 ), i++,
Insert Into( forecast1 time1, Format( saved time1[i], "yyyyQq" ) )
);
Code Explanation:
- Open data table.
- Extract first 44 Y values.
- Extract first 34 Y values.
- Extract last 10 Y values.
- Extract first 44 Time values.
- Perform time series forecasting.
- Generate forecast report.
- Extract sigma squared value.
- Extract parameter estimates.
- Save forecast results.
Fit Model using Split
Summary: Opens a data table, splits Y by quadrant, keeps specific columns, and sorts the data. It then creates a new script named 'Model' that fits a model using Y variables with Layout as an effect.
Code:
// Split Y by Quadrant
// Open data table
dt = Open("data_table.jmp");
// Split Y by Quadrant
dt = Split(
Split By( :Quadrant ),
Split( :Y ),
Remaining Columns(
Keep( :Wafer ID, :Layout )
),
Sort by Column Property
);
dt <<
New Script(
"Model",
Fit Model(
Y(
:"High, High"n, :"High, Low"n,
:"Low, High"n, :"Low, Low"n
),
Effects( :Layout ),
Keep dialog open( 1 ),
Personality(
"Standard Least Squares"
),
Emphasis( "Minimal Report" )
)
);
Code Explanation:
- Open data table.
- Split Y by Quadrant.
- Keep specific columns.
- Sort by column property.
- Create new script.
- Name script "Model".
- Fit model using Y variables.
- Include Layout as effect.
- Keep dialog open.
- Use Standard Least Squares personality.
Fit Model using Oneway
Summary: Performs a stepwise linear regression analysis on the Fitness data table to identify significant predictors of Oxygen consumption, utilizing Oneway and Fit Model platforms in JMP.
Code:
Open("data_table.jmp");
obj = Oneway( Y( :LogHist0 ), X( :drug ) );
obj << Matching Column( :LogHist1 );
obj << Matching Lines( 1 );
Open("data_table.jmp");
Fit Model(
Y( :Sepal length, :Sepal width, :Petal length, :Petal width ),
Effects( :Species ),
Personality( Manova ),
Run(
Response Function(
Identity, "Intercept" << {Test Details( 1 ), Centroid Plot( 1 )}, "Species" << {Test Details( 1 ), Centroid Plot( 1 )}
)
),
SendToReport(
Dispatch( {"Least Squares Means", "Overall Means"}, "FitManova LSMeans", FrameBox, {Marker Size( 2 )} ),
Dispatch( {"Least Squares Means", "Species"}, "FitManova LSMeans", FrameBox, {Marker Size( 2 )} )
)
);
Code Explanation:
- Open data_table data
- Create Oneway plot.
- Set matching column.
- Enable matching lines.
- Open data_table data
- Fit multivariate model.
- Specify response variables.
- Include Species effect.
- Use MANOVA personality.
- Configure report settings.
Fit Model using For
Example 1
Summary: Generates MANOVA models for BP variables in a specified data table, with interactive scrolling features to visualize frame boxes and absolute/relative window positioning.
Code:
Names Default To Here( 1 );
dt = Open("data_table.jmp");
For( i = 3, i >= 1, i--,
fm = dt << Fit Model(
Y( :BP 8M, :BP 12M, :BP 6M, :BP 8W, :BP 12W, :BP 6W, :BP 8F, :BP 12F, :BP 6F ),
Effects( :Subject, :Dose ),
Personality( "Manova" ),
Run
);
fm << Set Window Title( fm << Get Window Title || " Box Scrolling" );
fm << setwindowsize( 600, 600 );
fm << scroll window( Report( fm )[framebox( i )] );
);
For( j = 1, j <= 3, j++,
fm = dt << Fit Model(
Y( :BP 8M, :BP 12M, :BP 6M, :BP 8W, :BP 12W, :BP 6W, :BP 8F, :BP 12F, :BP 6F ),
Effects( :Subject, :Dose ),
Personality( "Manova" ),
Run
);
fm << Set Window Title( fm << Get Window Title || " Relative Scrolling" );
fm << setwindowsize( 600, 600 );
Match( j,
1,
fm << scroll window( Relative( "End" ) );
fm << scroll window( Relative( -300 ) );,
2,
fm << scroll window( Relative( 150, 150 ) );
fm << scroll window( Relative( "Start", 150 ) );,
3,
fm << scroll window( Relative( "End", "Start" ) );
fm << scroll window( Relative( -150, 300 ) );
);
);
For( k = 1, k <= 3, k++,
fm = dt << Fit Model(
Y( :BP 8M, :BP 12M, :BP 6M, :BP 8W, :BP 12W, :BP 6W, :BP 8F, :BP 12F, :BP 6F ),
Effects( :Subject, :Dose ),
Personality( "Manova" ),
Run
);
fm << Set Window Title( fm << Get Window Title || " Absolute Scrolling" );
fm << setwindowsize( 600, 600 );
Match( k,
1,
fm << scroll window( Absolute( "End" ) );
fm << scroll window( Absolute( 150 ) );,
2,
fm << scroll window( Absolute( "End", "Start" ) );
fm << scroll window( Absolute( 150, 350 ) );,
3,
fm << scroll window( Absolute( "End", "End" ) );
fm << scroll window( Absolute( 150, "Start" ) );
);
);
Code Explanation:
- Open data table;
- Loop through three iterations.
- Fit MANOVA model for BP variables.
- Append "Box Scrolling" to window title.
- Set window size to 600x600.
- Scroll to frame box based on iteration.
- Loop through three iterations.
- Fit MANOVA model for BP variables.
- Append "Relative Scrolling" to window title.
- Set window size to 600x600.
- Scroll window relatively based on iteration.
- Loop through three iterations.
- Fit MANOVA model for BP variables.
- Append "Absolute Scrolling" to window title.
- Set window size to 600x600.
- Scroll window absolutely based on iteration.
Example 2
Summary: Generates a distribution analysis for continuous variables in a specified data table using the Distribution platform, fitting a model with weight as an effect and displaying overall report metrics.
Code:
dt = Open("data_table.jmp");
For( i = 1, i <= 10, i++,
obj = dt << Fit Model( Y( :height ), Effects( :weight ), Personality( Response Screening ), Cauchy Fit( 1 ), Run() );
obj << Overall Report( 1 );
rpt = obj << report;
temp1 = rpt["Overall Fit"][Number Col Box( "Count" )] << get as matrix;
obj << close window;
);
Code Explanation:
- Open data table;
- Loop 10 times.
- Fit model for height.
- Use weight as effect.
- Set personality to Response Screening.
- Enable Cauchy fit.
- Run the model.
- Show overall report.
- Get report object.
- Extract count from report.
Example 3
Summary: Generates a predictive model for continuous variables in a specified data table, utilizing the Fit Model platform and filtering by a specific level.
Code:
For( i = 1, i <= 10, i++,
dt = Open("data_table.jmp");
dt << New Column( "Level", continuous, formula( If( :age > 13, 2, 1 ) ) );
obj_1 = dt << Fit Model(
Y( :height ),
Effects( :weight ),
Personality( Response Screening ),
Cauchy Fit( 1 ),
Run(),
Where( :Level == 2 )
);
obj_1 << save prediction formula;
);
Code Explanation:
- Loop starts.
- Open data table;
- Add "Level" column.
- Define "Level" formula.
- Start Fit Model.
- Set response variable.
- Add effect variable.
- Choose Response Screening.
- Apply Cauchy Fit.
- Run model.
- Filter for Level == 2.
- Save prediction formula.
- Loop ends.
Fit Model using Graph Builder
Summary: Creates a variability chart with nested factors using operator and part configurations, displaying standard deviation charts in Graph Builder.
Code:
Open("data_table.jmp");
Graph Builder(
Size( 1057, 579 ),
Show Control Panel( 0 ),
Variables( X( :Sex ), Y( :MaxPulse ) ),
Elements( Bar( X, Y, Legend( 3 ) ) ),
SendToReport(
Dispatch( {}, "Graph Builder", FrameBox,
{Set Graphlet(
Picture(
Fit Model(
Y( :MaxPulse ),
Effects( :Age, :Weight, :Oxy, :Runtime, :RunPulse, :RstPulse ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:MaxPulse << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ), Lack of Fit( 0 ),
Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ), Plot Residual by Predicted( 1 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 )}
)
)
)
), {Add Pin Annotation(
Seg( BarSeg( 1 ) ),
Index( {1, 1} ),
Index Row( {4, 4} ),
UniqueID( 103479057 ),
FoundPt( {442, 353} ),
Origin( {1.06935817805383, 44.4774} ),
Offset( {-99, -11} ),
Tag Line( 1 )
), Add Pin Annotation(
Seg( BarSeg( 1 ) ),
Index( {0, 0} ),
Index Row( {0, 0} ),
UniqueID( 103479056 ),
FoundPt( {205, 142} ),
Origin( {0.087991718426501, 146.48535} ),
Offset( {-25, 62} ),
Tag Line( 1 )
)}}
)
)
);
Code Explanation:
- Open data table;
- Create Graph Builder window.
- Set window size to 1057x579.
- Hide control panel.
- Assign Sex to X-axis, MaxPulse to Y-axis.
- Add bar element to graph.
- Insert fit model graphlet.
- Define MaxPulse as response variable.
- Include Age, Weight, Oxy, Runtime, RunPulse, RstPulse as effects.
- Use standard least squares personality.
Fit Model using New Column
Example 1
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot, grouping by a new column _bycol.
Code:
dt = Open("data_table.jmp");
dt << New Column( "_bycol", Character, Nominal, set values( Repeat( {"A", "B"}, N Rows( dt ) )[1 :: N Rows( dt )] ) );
obj = dt << Fit Model(
Y( :Oxy ),
Effects( :Runtime, :Weight, :RunPulse, :RstPulse, :MaxPulse ),
Personality( "Stepwise" ),
By( _bycol ),
Run
);
obj << Finish;
Code Explanation:
- Open data table;
- Create new column _bycol.
- Set _bycol values to "A", "B".
- Launch Fit Model platform.
- Specify Oxy as response.
- Add Runtime, Weight, RunPulse, RstPulse, MaxPulse as effects.
- Select Stepwise personality.
- Group by _bycol.
- Run the model.
- Finish the analysis.
Example 2
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot, utilizing the Fit Model platform to analyze data in the '_bycol' group.
Code:
dt = Open("data_table.jmp");
dt << New Column( "_bycol", Character, Nominal, set values( Repeat( {"A", "B"}, N Rows( dt ) )[1 :: N Rows( dt )] ) );
obj = dt << Fit Model(
Y( :Oxy ),
Effects( :Runtime, :Weight, :RunPulse, :RstPulse, :MaxPulse ),
Personality( "Stepwise" ),
By( _bycol ),
Run
);
obj << Finish;
(obj[1] << Get Group ) << Local Data Filter();
Code Explanation:
- Open data table;
- Create new column "_bycol".
- Set values for "_bycol".
- Launch Fit Model platform.
- Set response variable to Oxy.
- Add effects: Runtime, Weight, RunPulse, RstPulse, MaxPulse.
- Use Stepwise personality.
- Apply By grouping using "_bycol".
- Run the model.
- Finish the model fit.
Example 3
Summary: Fits a nominal logistic model with multiple effects to predict the 'ReadyOld' column in a data table, generating a profiler plot for terms 'heat' and 'soak'.
Code:
dt = Open("data_table.jmp");
dt << New Column( "ReadyOld", Character, Nominal, Formula( If( :ready == "Not Ready", 1, 0 ) ) );
:ReadyOld << Delete Formula;
obj = dt << Fit Model(
Freq( :count ),
Y( :ReadyOld ),
Effects( :heat, :soak ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler( 1, Term Value( heat( 19.876, Lock( 0 ), Show( 1 ) ), soak( 2.0333, Lock( 0 ), Show( 1 ) ) ) )
)
);
Code Explanation:
- Open data table.
- Create new column "ReadyOld".
- Define formula for "ReadyOld".
- Remove formula from "ReadyOld".
- Launch Fit Model platform.
- Set frequency to "count".
- Specify response variable "ReadyOld".
- Add effects: "heat", "soak".
- Choose "Nominal Logistic" personality.
- Run model with specified options.
Example 4
Summary: Fits a standard logistic regression model with multiple effects and generates a profiler plot, utilizing the Nominal Logistic personality and customizing report layout.
Code:
fn = "c:\temp\test.htm";
dt under test = Open("data_table.jmp");
dt under test << New Column( "Over 70", numeric, nominal, values( (Column( "Age(years)" ) << get values) > 70 ) );
cols = dt under test << get column names();
obj = Fit Model(
Y( :Over 70 ),
Effects( Eval( cols[1 :: N Items( cols ) - 1] ) ),
Personality( Nominal Logistic ),
Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ) ),
SendToReport(
Dispatch( {}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Whole Model Test", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {"Parameter Estimates"}, "Covariance of Estimates", OutlineBox, {Close( 0 )} ),
Dispatch( {}, "Effect Likelihood Ratio Tests", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Define file path.
- Open data table.
- Create new column "Over 70".
- Get all column names.
- Fit logistic regression model.
- Set response variable.
- Include all effects except last.
- Use nominal logistic personality.
- Run likelihood ratio tests.
- Customize report layout.
Example 5
Summary: Fits a standard least squares model with multiple effects and generating a profiler plot for analysis.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Model E (2P)", Formula( Parameter( {theta1 = 0.1, theta2 = 1.8889}, theta1 * :ABRASION ^ theta2 ) ) );
dt << New Column( "Logistic 5p (Richard Function)",
Formula(
Parameter(
{theta1 = 2294, theta2 = 700, theta3 = -5.79484272907593, theta4 = 0.0380645949622243, theta5 = 1},
theta1 + (theta2 - theta1) / (1 + Exp( theta3 + theta4 * :ABRASION )) ^ theta5
)
)
);
obj = dt << Fit Group(
Fit Model(
Y( :ABRASION ),
Effects(
:SILICA & RS, :SILANE & RS, :SULFUR & RS, :SILICA * :SILICA, :SILICA * :SILANE, :SILANE * :SILANE, :SILICA * :SULFUR,
:SILANE * :SULFUR, :SULFUR * :SULFUR
),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run()
),
Neural( Set Random Seed( 12345 ), Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Go ),
Gaussian Process( Y( :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Set Correlation Function( "Cubic" ), ),
Nonlinear( Y( :MODULUS ), X( :Name( "Model E (2P)" ) ), Newton, Finish, Accept Current Estimates )
);
obj << Profiler( 1 );
rpt = obj << parent;
Close( dt, no save );
b test3 = {Number Edit Box( width( 9 ), decimal( 99 ), fmtdecimal( -1 ), Number( 1.2 ) ), Number Edit Box(
width( 9 ),
decimal( 99 ),
fmtdecimal( -1 ),
Number( 50 )
), Number Edit Box( width( 9 ), decimal( 99 ), fmtdecimal( -1 ), Number( 2.3 ) )};
Code Explanation:
- Open data table.
- Add new column "Model E (2P)" with formula.
- Add new column "Logistic 5p (Richard Function)" with formula.
- Perform Fit Group analysis.
- Fit standard least squares model.
- Run neural network analysis.
- Perform Gaussian process analysis.
- Conduct nonlinear regression.
- Generate profiler report.
- Close data table without saving.
Example 6
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot, utilizing various JMP platforms including Fit Group, Neural, Gaussian Process, and Nonlinear.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Model E (2P)", Formula( Parameter( {theta1 = 0.1, theta2 = 1.8889}, theta1 * :ABRASION ^ theta2 ) ) );
dt << New Column( "Logistic 5p (Richard Function)",
Formula(
Parameter(
{theta1 = 2294, theta2 = 700, theta3 = -5.79484272907593, theta4 = 0.0380645949622243, theta5 = 1},
theta1 + (theta2 - theta1) / (1 + Exp( theta3 + theta4 * :ABRASION )) ^ theta5
)
)
);
obj = dt << Fit Group(
Fit Model(
Y( :ABRASION ),
Effects(
:SILICA & RS, :SILANE & RS, :SULFUR & RS, :SILICA * :SILICA, :SILICA * :SILANE, :SILANE * :SILANE, :SILICA * :SULFUR,
:SILANE * :SULFUR, :SULFUR * :SULFUR
),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run()
),
Neural( Set Random Seed( 12345 ), Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Go ),
Gaussian Process( Y( :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Set Correlation Function( "Cubic" ), ),
Nonlinear( Y( :MODULUS ), X( :Name( "Model E (2P)" ) ), Newton, Finish, Accept Current Estimates )
);
obj << Local Data Filter(
Location( {0, 0} ),
Add Filter( columns( :ABRASION ), Where( :ABRASION >= 110 & :ABRASION <= 190 ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
obj << Automatic Recalc( 0 );
dt << Select Rows( 1 :: 5 );
dt << Exclude();
rpt = obj << Report;
Code Explanation:
- Open data_table data
- Create new column "Model E (2P)".
- Create new column "Logistic 5p".
- Fit group of models.
- Fit standard least squares model.
- Run neural network analysis.
- Fit Gaussian process model.
- Fit nonlinear model.
- Add local data filter.
- Disable automatic recalculation.
Example 7
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot, utilizing various JMP platforms and features.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Model E (2P)", Formula( Parameter( {theta1 = 0.1, theta2 = 1.8889}, theta1 * :ABRASION ^ theta2 ) ) );
dt << New Column( "Logistic 5p (Richard Function)",
Formula(
Parameter(
{theta1 = 2294, theta2 = 700, theta3 = -5.79484272907593, theta4 = 0.0380645949622243, theta5 = 1},
theta1 + (theta2 - theta1) / (1 + Exp( theta3 + theta4 * :ABRASION )) ^ theta5
)
)
);
obj = dt << Fit Group(
Fit Model(
Y( :ABRASION ),
Effects(
:SILICA & RS, :SILANE & RS, :SULFUR & RS, :SILICA * :SILICA, :SILICA * :SILANE, :SILANE * :SILANE, :SILICA * :SULFUR,
:SILANE * :SULFUR, :SULFUR * :SULFUR
),
Personality( Standard Least Squares ),
Emphasis( Minimal Report ),
Run()
),
Neural( Set Random Seed( 12345 ), Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Go ),
Gaussian Process( Y( :HARDNESS ), X( :SILICA, :SILANE, :SULFUR ), Set Correlation Function( "Cubic" ), ),
Nonlinear( Y( :MODULUS ), X( :Name( "Model E (2P)" ) ), Newton, Finish, Accept Current Estimates )
);
obj << Local Data Filter(
Location( {0, 0} ),
Add Filter( columns( :ABRASION ), Where( :ABRASION >= 110 & :ABRASION <= 190 ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
obj << Automatic Recalc( 0 );
dt << Select Rows( 1 :: 5 );
dt << Exclude();
rpt = obj << Report;
Code Explanation:
- Open table.
- Create new column "Model E (2P)".
- Create new column "Logistic 5p".
- Fit group models.
- Add local data filter.
- Disable automatic recalculation.
- Select first 5 rows.
- Exclude selected rows.
- Generate report.
Example 8
Summary: Fits multiple standard least squares models with different effects and generating profiler plots, utilizing JMP's Fit Model platform.
Code:
dt = Open("data_table.jmp");
dt << New Column( "w",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] )
);
obj1 = dt << Fit Model(
Weight( :w ),
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Press( 1 ) )
);
rpt1 = obj1 << report;
press1 = rpt1["Press"][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model(
Freq( :w ),
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Press( 1 ) )
);
rpt2 = obj2 << report;
press2 = rpt2["Press"][Table Box( 1 )] << get as matrix;
dt << Clear Select << Select Rows( Index( 4, 40 ) ) << Hide and Exclude;
obj3 = dt << Fit Model(
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Press( 1 ) )
);
rpt3 = obj1 << report;
press3 = rpt3["Press"][Table Box( 1 )] << get as matrix;
dt << Invert Row Selection;
dt subset = dt << subset( selected rows( 1 ) );
obj0 = dt subset << Fit Model(
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Press( 1 ) )
);
rpt0 = obj0 << report;
b press = rpt0["Press"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Add new column "w".
- Set values for column "w".
- Fit model with weight.
- Retrieve model report.
- Extract Press statistic.
- Fit model with frequency.
- Retrieve model report.
- Extract Press statistic.
- Select and hide rows 4 to 40.
- Fit model without weights.
- Retrieve model report.
- Extract Press statistic.
- Invert row selection.
- Create subset of selected rows.
- Fit model on subset.
- Retrieve model report.
- Extract Press statistic.
Example 9
Summary: Fits a standard least squares model with multiple effects and generating a profiler plot, utilizing JMP's Fit Model platform.
Code:
dt = Open("data_table.jmp");
dt << New Column( "temp, sex", character, nominal, formula( :sex ) );
obj1 = dt << Fit Model(
Y( :weight ),
Effects( :age, :Name( "temp, sex" ), :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1 ), Surface Profiler( 1 ) )
);
rpt1 = obj1 << report;
fit1 = rpt1[Outline Box( "Summary of Fit" )][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1 ), Surface Profiler( 1 ) )
);
rpt2 = obj2 << report;
fit2 = rpt2[Outline Box( "Summary of Fit" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Create new column "temp, sex".
- Fit model with weight as response.
- Include age, temp, sex, height as effects.
- Use Standard Least Squares personality.
- Generate minimal report.
- Run Profiler and Surface Profiler.
- Extract Summary of Fit report.
- Convert report to matrix.
- Repeat steps 3-9 without "temp, sex" column.
Example 10
Summary: Fits a standard least squares model with multiple effects and generates predicted values for a transformed response variable.
Code:
dt = Open("data_table.jmp");
dt << New Column( "height2", numeric, formula( :height / 200 ) );
obj1 = dt << Fit Model(
Y( Logit( :height2 ) ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj1 << Predicted Values;
pred1 = dt:Predicted height2 << get values;
obj2 = dt << Fit Model(
Y( Transform Column( "Transform[height]", Formula( Logit( :height2 ) ) ) ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj2 << Predicted Values;
pred2 = dt:Predicted height2 2 << get values;
Code Explanation:
- Open data table;
- Create new column "height2".
- Fit logistic model with "height2" as response.
- Include "weight" as effect.
- Use standard least squares personality.
- Generate minimal report.
- Calculate predicted values for "height2".
- Store predicted values in pred1.
- Create transform column for "height".
- Fit logistic model with transformed "height" as response.
Example 11
Summary: Fits two standard least squares models with multiple effects and generates profiler plots for parameter estimates.
Code:
dt2 = Open("data_table.jmp");
dt2 << New Column( "sqrt v1", formula( Sqrt( :v1 ) ) );
dt2 << New Column( "sqrt v2", formula( Sqrt( :v2 ) ) );
dt2 << New Column( "sqrt v3", formula( Sqrt( :v3 ) ) );
obj1 = dt2 << Fit Model(
Y( :ls ),
Effects( Sqrt( :v1 ), Sqrt( :v2 ), Sqrt( :v3 ), :v1 * :v2, :v1 * :v3, :v2 * :v3 ),
No Intercept( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
rpt1 = Report( obj1 );
obj2 = dt2 << Fit Model(
Y( :ls ),
Effects( :Sqrt v1, :Sqrt v2, :Sqrt v3, :Sqrt v1 * :Sqrt v2, :Sqrt v1 * :Sqrt v3, :Sqrt v2 * :Sqrt v3 ),
Center Polynomials( 0 ),
No Intercept( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
rpt2 = Report( obj2 );
parm1 = rpt1[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix;
parm2 = rpt2[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Create sqrt v1 column.
- Create sqrt v2 column.
- Create sqrt v3 column.
- Fit first model with sqrt terms.
- Store first model report.
- Fit second model with sqrt columns.
- Store second model report.
- Extract parameter estimates from first report.
- Extract parameter estimates from second report.
Example 12
Summary: Fits a standard least squares model with multiple effects, generates a profiler plot, and retrieves prediction standard errors from two models.
Code:
dt = Open("data_table.jmp");
dt:height[2] = dt:height[4] = .;
dt << New Column( "height2", formula( If( Is Missing( :height ), Col Mean( :height ), :height ) ) );
dt << New Column( "indicator", formula( If( Is Missing( :height ), 1, 0 ) ) );
obj = Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Informative Missing( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj << StdErr Pred Formula( 1 );
obj2 = Fit Model(
Y( :weight ),
Effects( :age, :sex, :height2, :indicator ),
Informative Missing( 0 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj2 << StdErr Pred Formula( 1 );
stderr1 = dt:PredSE weight << get values;
stderr2 = dt:PredSE weight 2 << get values;
Code Explanation:
- Open data table.
- Set specific height values to missing.
- Create new column "height2".
- Create new column "indicator".
- Fit model with original height.
- Enable standard error prediction formula.
- Fit model with modified height and indicator.
- Enable standard error prediction formula.
- Retrieve prediction standard errors from first model.
- Retrieve prediction standard errors from second model.
Example 13
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot, including studentized residuals and UCL/LCL calculations.
Code:
dt3 = Open("data_table.jmp");
dt3 << New Column( "Freq1", values( [2, 3] |/ J( 38, 1, 1 ) ) );
obj2 = dt3 << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Freq( :Freq1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
rpt2 = obj2 << report;
obj2 << Plot Studentized Residuals( 1 );
plot resid = (rpt2[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Marker Seg( 1 ) )) << Get Y Values;
b ucl bonf = J( 2, 1, -t Quantile( 0.025 / 43, 34 ) );
b lcl bonf = J( 2, 1, t Quantile( 0.025 / 43, 34 ) );
b ucl indiv = J( 2, 1, -t Quantile( 0.025, 34 ) );
b lcl indiv = J( 2, 1, t Quantile( 0.025, 34 ) );
b ref = [0, 0];
ref = (rpt2[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Line Seg( 1 ) )) << Get Y Values;
ucl bonf = (rpt2[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Line Seg( 2 ) )) << Get Y Values;
lcl bonf = (rpt2[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Line Seg( 3 ) )) << Get Y Values;
ucl indiv = (rpt2[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Line Seg( 4 ) )) << Get Y Values;
lcl indiv = (rpt2[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Line Seg( 5 ) )) << Get Y Values;
obj2 << Externally Studentized Residuals( 1 );
saved = dt3:Externally Studentized Residuals weight << get values;
Code Explanation:
- Open data table;
- Add "Freq1" column with values.
- Fit linear model with specified effects and frequency.
- Generate minimal report for the model.
- Plot studentized residuals.
- Extract Y values from residual plot.
- Calculate Bonferroni UCL and LCL.
- Calculate individual UCL and LCL.
- Extract reference line Y values.
- Extract Bonferroni and individual UCL/LCL values.
- Plot externally studentized residuals.
- Save externally studentized residuals to dataset.
Example 14
Summary: Fits two standard least squares models with multiple effects and generates profiler plots for studentized residuals.
Code:
dt = Open("data_table.jmp");
dt << New Column( "miles2", formula( :miles + Random Normal( 0, 6 ) ) );
obj1 = dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
);
rpt1 = obj1 << report;
obj1 << Plot Studentized Residuals( 1 );
y1 = (rpt1[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Marker Seg( 1 ) )) << Get Y Values;
obj2 = dt << Fit Model(
Y( :miles2 ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
);
rpt2 = obj2 << report;
obj2 << Plot Studentized Residuals( 1 );
y2 = (rpt2[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Marker Seg( 1 ) )) << Get Y Values;
obj = dt << Fit Model(
Y( :miles, :miles2 ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
);
obj << Save Columns( Studentized Residuals );
rpt = obj << report;
obj << Plot Studentized Residuals( 1 );
y3 = (rpt[1][Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Marker Seg( 1 ) )) << Get Y Values;
y4 = (rpt[2][Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Marker Seg( 1 ) )) << Get Y Values;
b y3 = dt:Studentized Resid miles << get values;
b y4 = dt:Studentized Resid miles2 << get values;
note3 = rpt[1][Outline Box( "Response miles" )][Outline Box( "Studentized Residuals" )][Text Box( 3 )] << get text;
note4 = rpt[2][Outline Box( "Response miles2" )][Outline Box( "Studentized Residuals" )][Text Box( 3 )] << get text;
Code Explanation:
- Open data table;
- Add new column "miles2".
- Fit model for "miles".
- Retrieve report object.
- Plot studentized residuals.
- Extract Y values from plot.
- Fit model for "miles2".
- Retrieve report object.
- Plot studentized residuals.
- Extract Y values from plot.
Example 15
Summary: Fits multiple MANOVA models with different response functions and saves canonical scores for each group.
Code:
dt = Open("data_table.jmp");
dt << New Column( "group",
Numeric,
Continuous,
Format( "Best", Use thousands separator, 12 ),
Set Values( [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2] )
);
obj = dt << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
Effects( :drug, :dep1, :drug * :dep1 ),
by( :group ),
Personality( "Manova" ),
Run( Response Function( "Sum" ) )
);
obj << (Response[1] << (Effect[1] << Save Canonical Scores));
obj2 = dt << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
Effects( :drug, :dep1, :drug * :dep1 ),
Personality( "Manova" ),
Run( Response Function( "Sum" ) ),
Where( :group == 1 )
);
obj2 << (Response[1] << (Effect[1] << Save Canonical Scores));
obj3 = dt << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
Effects( :drug, :dep1, :drug * :dep1 ),
Personality( "Manova" ),
Run( Response Function( "Sum" ) ),
Where( :group == 2 )
);
obj3 << (Response[1] << (Effect[1] << Save Canonical Scores));
save1 = dt:Name( "Canon[1] By group" ) << get values;
save2 = dt:Name( "Canon[1] Where" ) << get values;
Close( dt, no save );
b group1 = {"Canonical", "Canonical 2"};
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
Effects( :drug, :dep1, :drug * :dep1 ),
Personality( "Manova" ),
Run( Response Function( "Contrast" ) )
);
obj1 << (Response["Contrast"] << (Effect["Whole Model"] << Save Canonical Scores));
obj1 << (Response["Contrast"] << (Effect["Whole Model"] << Save Canonical Scores));
group1 = dt << Get Column Groups Names;
For( i = 1, i <= N Items( group1 ), i++,
colname = dt << Get Column Group( group1[i] );
If( i == 1, , );
);
Code Explanation:
- Open data table;
- Create new column "group".
- Fit model with MANOVA personality.
- Save canonical scores for first response.
- Fit model for group 1.
- Save canonical scores for group 1.
- Fit model for group 2.
- Save canonical scores for group 2.
- Retrieve saved canonical score values.
- Close data table without saving.
Example 16
Summary: Fits a mixed model with multiple Ys, generating reports, and extracting covariance parameter estimates, fixed effects parameter estimates, and fit statistics from the results.
Code:
dt = Open("data_table.jmp");
dt << New Column( "miles2", numeric, formula( :miles + Random Integer( 0, 5 ) ) );
dt << New Column( "miles3", numeric, formula( :miles + Random Normal() ) );
bef aa = Associative Array( Window() << get window title );
obj = dt << Fit Model(
Y( :miles, :miles2, :miles3 ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Mixed Model" ),
Run( Results in Data Tables )
);
rpt = obj << report;
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aft aa << get keys;
b tbl2 = ((rpt[1]["Random Effects Covariance Parameter Estimates"][Table Box( 1 )] << get as matrix)[0, 2 :: 6] |/ (rpt[2][
"Random Effects Covariance Parameter Estimates"][Table Box( 1 )] << get as matrix)[0, 2 :: 6] |/ (rpt[3][
"Random Effects Covariance Parameter Estimates"][Table Box( 1 )] << get as matrix)[0, 2 :: 6]);
b tbl3 = (rpt[1]["Fixed Effects Parameter Estimates"][Tab Page Box( 2 )][Table Box( 1 )] << get as matrix)[0, 1 :: 7] |/ (rpt[2][
"Fixed Effects Parameter Estimates"][Tab Page Box( 2 )][Table Box( 1 )] << get as matrix)[0, 1 :: 7] |/ (rpt[3][
"Fixed Effects Parameter Estimates"][Tab Page Box( 2 )][Table Box( 1 )] << get as matrix)[0, 1 :: 7];
b tbl4 = (rpt[1]["Fit Statistics"][Table Box( 1 )] << get as matrix)` |/ (rpt[2]["Fit Statistics"][Table Box( 1 )] << get as matrix)` |/ (
rpt[3]["Fit Statistics"][Table Box( 1 )] << get as matrix)`;
Code Explanation:
- Open data table;
- Create new column "miles2".
- Create new column "miles3".
- Store current window titles.
- Fit mixed model with multiple Ys.
- Retrieve model report.
- Update window titles.
- Remove unchanged windows.
- Get remaining window keys.
- Extract and compare covariance parameter estimates.
- Extract and compare fixed effects parameter estimates.
- Extract and compare fit statistics.
Example 17
Summary: Fits a Nominal Logistic model with multiple effects and generates a report, utilizing the Validation 2 column for validation and setting the decision threshold to 1.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Validation 2", formula( Match( :Y Ordinal, "Low", 0, "Medium", 1, "High", Random Integer( 0, 1 ) ) ) );
dt:Y Ordinal << Set Modeling Type( "Nominal" );
obj = dt << Fit Model(
Y( :Y Ordinal ),
Effects( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation 2 ),
Personality( "Nominal Logistic" ),
Target Level( "High" ),
Run
);
obj << Decision Threshold( 1 );
rpt = obj << report;
test1 = Try( rpt["Decision Tresholds"] << get title, 1 );
Code Explanation:
- Open data table;
- Add new column "Validation 2".
- Define formula for "Validation 2".
- Set "Y Ordinal" as Nominal.
- Fit Nominal Logistic model.
- Specify effects for the model.
- Use "Validation 2" for validation.
- Set target level to "High".
- Run the model.
- Set decision threshold to 1.
Example 18
Summary: Fits a nominal logistic model with multiple effects and generates reports for parameter estimates, unit odds ratios, and confidence intervals.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Thread Wear Nom",
character,
nominal,
Formula( If( :Thread Wear Measured <= 4, "Low", :Thread Wear Measured <= 15, "Moderate", "Severe" ) )
);
obj1 = dt << Fit Model( Y( :Thread Wear Nom ), Effects( :"Size of Load (lbs)"n, :Method ), Personality( "Nominal Logistic" ), Run );
obj1 << Confidence Intervals( 0.1 );
obj1 << Odds Ratios;
rpt1 = obj1 << report;
parmest1 = rpt1["Parameter Estimates"][Table Box( 1 )] << get as matrix;
unit OR1 = rpt1["Unit Odds Ratios"][Table Box( 1 )] << get as matrix;
OR1 = rpt1["Odds Ratios for Method"][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model( Y( :Thread Wear Nom ), Effects( :"Size of Load (lbs)"n, :Method ), Personality( "Nominal Logistic" ), Run );
obj2 << Odds Ratios;
obj2 << Confidence Intervals( 0.1 );
rpt2 = obj2 << report;
parmest2 = rpt2["Parameter Estimates"][Table Box( 1 )] << get as matrix;
unit OR2 = rpt2["Unit Odds Ratios"][Table Box( 1 )] << get as matrix;
OR2 = rpt2["Odds Ratios for Method"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Create new column "Thread Wear Nom".
- Define formula for "Thread Wear Nom".
- Fit nominal logistic model with effects.
- Set confidence level for intervals.
- Calculate odds ratios.
- Retrieve parameter estimates report.
- Extract parameter estimates matrix.
- Extract unit odds ratios matrix.
- Extract odds ratios for method matrix.
Example 19
Summary: Fits a nominal logistic model with multiple effects and generates a profiler plot to analyze the relationship between 'sex 2', 'age', and 'height' in a data table.
Code:
dt = Open("data_table.jmp");
dt << New Column( "sex 2", character, Formula( Match( :sex, "F", "High", "M", "Low" ) ) );
obj1 = dt << Fit Model( Y( :sex 2 ), Target Level( "Low" ), Effects( :age, :height ), Personality( "Nominal Logistic" ), Run );
rpt1 = obj1 << report;
note1 = rpt1[Outline Box( "Parameter Estimates" )][Text Box( 1 )] << get text;
Code Explanation:
- Open data table;
- Create new column "sex 2".
- Assign formula to "sex 2".
- Fit nominal logistic model.
- Set target level to "Low".
- Include age and height as effects.
- Run the model.
- Retrieve model report.
- Access parameter estimates outline box.
- Get text from first text box.
Example 20
Summary: Fits a nominal logistic model for sex and an ordinal logistic model for age, with subsequent profiling and quantile extraction.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Freq", values( J( 3, 1, 0 ) |/ J( 4, 1, 1 ) |/ J( 5, 1, -1 ) |/ J( 28, 1, 1 ) ) );
obj1 = dt << Fit Model( Freq( :Freq ), Y( :sex ), Target Level( "F" ), Effects( :height ), Personality( "Nominal Logistic" ), Run );
s = dt << Select Where( :Freq != 1 );
s << Colors( "Red" );
obj2 = dt << Fit Model( Freq( :Freq ), Y( :age ), Effects( :sex ), Personality( "Ordinal Logistic" ), Run );
Log Capture(
obj2 << Save Quantiles( 1 );
obj2 << Save Expected Value( 1 );
);
saved q = (dt:Name( "OrdQ.05" ) << get values) || (dt:Name( "OrdQ.50" ) << get values) || (dt:Name( "OrdQ.95" ) << get values);
saved exp = dt:Ord Expected << get values;
Code Explanation:
- Open data table;
- Create new column "Freq".
- Fit nominal logistic model for sex.
- Select rows where Freq != 1.
- Color selected rows red.
- Fit ordinal logistic model for age.
- Capture log output.
- Save quantiles from ordinal model.
- Save expected values from ordinal model.
- Extract saved quantile values.
- Extract saved expected values.
Example 21
Summary: Fits a proportional hazard model to analyze the relationship between days and group, with censoring based on the ZCensor column.
Code:
dt = Open("data_table.jmp");
dt << New Column( "ZCensor", Set Formula( 1 - :Censor ) );
fm = dt << Fit Model( Y( :days ), Effects( :Group ), Personality( "Proportional Hazard" ), Censor( :ZCensor ), Censor Code( 0 ), Run );
v = Report( fm )["Whole Model"][Number Col Box( 1 )] << get as matrix;
Code Explanation:
- Open table.
- Create new column.
- Define censor formula.
- Fit proportional hazard model.
- Specify response variable.
- Include group effect.
- Set censor column.
- Define censor code.
- Execute model fit.
- Extract report matrix.
Example 22
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot for three responses: miles, scaled miles, and scaled miles2.
Code:
dt = Open("data_table.jmp");
dt << New Column( "scaled miles", numeric, formula( :miles * 10 ^ 10 ) );
dt << New Column( "scaled miles2", numeric, formula( :miles / 10 ^ 5 ) );
obj = dt << Fit Model(
Y( :miles, :scaled miles, :scaled miles2 ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
);
rpt = obj << report;
df1 = rpt[1][Outline Box( "Response miles" )][Outline Box( "Fixed Effect Tests" )][Number Col Box( "DFDen" )] << get as matrix;
df2 = rpt[2][Outline Box( "Response scaled miles" )][Outline Box( "Fixed Effect Tests" )][Number Col Box( "DFDen" )] << get as matrix;
df3 = rpt[3][Outline Box( "Response scaled miles2" )][Outline Box( "Fixed Effect Tests" )][Number Col Box( "DFDen" )] << get as matrix;
Code Explanation:
- Open data table.
- Create new column "scaled miles".
- Create new column "scaled miles2".
- Fit model with specified responses and effects.
- Use REML method for estimation.
- Retrieve model report.
- Extract degrees of freedom for "miles" response.
- Extract degrees of freedom for "scaled miles" response.
- Extract degrees of freedom for "scaled miles2" response.
Example 23
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot, utilizing the REML method to analyze the relationship between weight, MR1, height, and other variables in a data table.
Code:
dt = Open("data_table.jmp");
dt << New Column( "MR1", Character, "Multiple Response", Formula( Char( :age ) || "," || :sex ) );
dt:age << Set Modeling Type( "nominal" );
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
obj1 = dt << Fit Model(
Y( :weight ),
Effects( :MR1 & random, :height ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
Window( aftlst[i] ) << Close Window( 1 )
);
Code Explanation:
- Open data table.
- Create new column "MR1".
- Set "age" modeling type to nominal.
- Capture initial window titles.
- Fit model with REML method.
- Capture final window titles.
- Remove initial titles from final titles.
- Get remaining window keys.
- Loop through remaining windows.
- Close each window.
Example 24
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot, utilizing the JMP scripting language.
Code:
b log1 = "Columns with a Mutliple Response modeling type can not be random effects.";
dt = Open("data_table.jmp");
dt << New Column( "MR1", Character, "Multiple Response", Formula( Char( :age ) || "," || :sex ) );
dt:age << Set Modeling Type( "nominal" );
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
obj1 = dt << Fit Model(
Y( :weight ),
Effects( :MR1 & random, :height ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
Window( aftlst[i] ) << Close Window( 1 )
);
Code Explanation:
- Open data table.
- Create new column "MR1".
- Set "age" to nominal.
- Capture initial window titles.
- Fit model with REML.
- Capture final window titles.
- Remove initial titles from final list.
- Get remaining window keys.
- Loop through remaining windows.
- Close each remaining window.
Example 25
Summary: Fits a standard least squares model with multiple effects and generating a profiler plot, utilizing the JMP Fit Model platform.
Code:
dt = Open("data_table.jmp");
dt << New Column( "MR1", Character, "Multiple Response", Formula( Char( :age ) || "," || :sex ) );
befAA = Associative Array( Window() << get window title );
log1 = Log Capture( obj1 = dt << Fit Model( Y( :weight ), Effects( :MR1, :height ), Personality( "Stepwise" ), Run ) );
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
Window( aftlst[i] ) << Close Window( 1 )
);
Code Explanation:
- Open data table.
- Create new column "MR1".
- Store initial window titles.
- Fit model using stepwise method.
- Capture log output.
- Store updated window titles.
- Remove initial titles from updated list.
- Get remaining window keys.
- Loop through remaining windows.
- Close each window.
Example 26
Summary: Fits a standard least squares model with multiple effects and generating a profiler plot, utilizing Stepwise personality in JMP.
Code:
b log1 = "Stepwise does not support multiple response effects.";
dt = Open("data_table.jmp");
dt << New Column( "MR1", Character, "Multiple Response", Formula( Char( :age ) || "," || :sex ) );
befAA = Associative Array( Window() << get window title );
log1 = Log Capture( obj1 = dt << Fit Model( Y( :weight ), Effects( :MR1, :height ), Personality( "Stepwise" ), Run ) );
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
Window( aftlst[i] ) << Close Window( 1 )
);
Code Explanation:
- Open data table;
- Create new column for multiple responses.
- Capture initial window titles.
- Fit model using Stepwise personality.
- Capture final window titles.
- Remove initial windows from final list.
- Get remaining window keys.
- Loop through remaining windows.
- Close each window.
Example 27
Summary: Fits a standard least squares model with multiple effects and generating a profiler plot, while also calculating various statistics such as mean, SE, ST, and R_2.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Validation", formula( Random Integer( 1, 3 ) ) );
obj1 = dt << Fit Model(
Y( :Age ),
Effects( :Sex, :Weight, :Oxy, :Runtime, :Weight * :Oxy, :Weight * :Runtime, :Oxy * :Runtime, :Weight * :Oxy * :Runtime, ),
Validation( :Validation ),
Personality( "Stepwise" ),
Run
);
obj1 << Enter All( 1 );
obj2 = dt << Fit Model(
Y( :Age ),
Effects( :Sex, :Weight, :Oxy, :Runtime, :Weight * :Oxy, :Weight * :Runtime, :Oxy * :Runtime, :Weight * :Oxy * :Runtime, ),
Validation( :Validation ),
Personality( "Standard Least Squares" ),
Run
);
obj2 << {:Age << Save Columns( Prediction Formula )};
dt << New Column( "MeanBy", formula( Col Mean( :Age, :Validation ) ) );
dt << New Column( "SE", formula( (:Age - :Pred Formula Age) ^ 2 ) );
dt << New Column( "ST", formula( (:Age - :MeanBy) ^ 2 ) );
dt << New Column( "R_2", formula( 1 - Col Sum( :SE, :Validation ) / Col Sum( :ST, :Validation ) ) );
Summarize( dt, by1 = By( :Validation ), b r2 = Mean( :R_2 ) );
rpt1 = Report( obj1 );
r2 = (rpt1[Outline Box( "Stepwise Fit for Age" )][Number Col Box( "RSquare" )] << get as matrix) |/ (rpt1[
Outline Box( "Stepwise Fit for Age" )][Number Col Box( "RSquare Validation" )] << get as matrix) |/ (rpt1[
Outline Box( "Stepwise Fit for Age" )][Number Col Box( "RSquare Test" )] << get as matrix);
Code Explanation:
- Open data table;
- Create "Validation" column.
- Fit model using Stepwise personality.
- Enter all effects.
- Fit model using Standard Least Squares.
- Save prediction formula.
- Create "MeanBy" column.
- Create "SE" column.
- Create "ST" column.
- Create "R_2" column.
Example 28
Summary: Fits a standard least squares model with multiple effects and generating a profiler plot for sex prediction, utilizing stepwise personality for model selection.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Validation", formula( Random Integer( 1, 3 ) ) );
obj1 = dt << Fit Model(
Y( :sex ),
Effects( :Runtime, :RunPulse, :Runtime * :RunPulse ),
Validation( :Validation ),
Personality( "Stepwise" ),
Run
);
obj1 << Step( 1 );
obj2 = dt << Fit Model( Y( :sex ), Effects( :Runtime ), Validation( :Validation ), Personality( "Nominal Logistic" ), Run );
obj2 << Save Probability Formula( 1 );
dt << New Column( "Train -logp",
formula( If( :Validation == 1, -Log( Match( :sex, "F", :Name( "Prob[F]" ), "M", :Name( "Prob[M]" ), ) ) ) )
);
dt << New Column( "Valid -logp",
formula( If( :Validation == 2, -Log( Match( :sex, "F", :Name( "Prob[F]" ), "M", :Name( "Prob[M]" ), ) ) ) )
);
dt << New Column( "Test -logp",
formula( If( :Validation == 3, -Log( Match( :sex, "F", :Name( "Prob[F]" ), "M", :Name( "Prob[M]" ), ) ) ) )
);
b Train Neglogp = Col Mean( :Name( "Train -logp" ) );
b Valid Neglogp = Col Mean( :Name( "Valid -logp" ) );
b Test Neglogp = Col Mean( :Name( "Test -logp" ) );
Train NegLL = Col Sum( :Name( "Train -logp" ) );
Valid NegLL = Col Sum( :Name( "Valid -logp" ) );
Test NegLL = Col Sum( :Name( "Test -logp" ) );
b r2 = (1 - Train NegLL / 3.01416129005149) |/ (1 - Valid NegLL / 5.00402423538188) |/ (1 - Test NegLL / 8.97241378824445);
rpt1 = Report( obj1 );
r2 = (rpt1[Outline Box( "Stepwise Fit for Sex" )][Number Col Box( "RSquare" )] << get as matrix) |/ (rpt1[
Outline Box( "Stepwise Fit for Sex" )][Number Col Box( "RSquare Validation" )] << get as matrix) |/ (rpt1[
Outline Box( "Stepwise Fit for Sex" )][Number Col Box( "RSquare Test" )] << get as matrix);
Code Explanation:
- Open data table.
- Add "Validation" column with random integers.
- Fit model with sex as response.
- Include Runtime, RunPulse, and interaction effects.
- Use stepwise personality for model selection.
- Run the stepwise model.
- Perform first step of stepwise process.
- Fit nominal logistic model with sex as response.
- Include Runtime effect.
- Save probability formula for logistic model.
Example 29
Summary: Fits a standard least squares model with multiple effects and generates profiler plots for two response variables.
Code:
dt = Open("data_table.jmp");
dt << New Column( "y1", Numeric, Formula( :y + 1 ) );
dt << New Column( "y2", Numeric, Formula( :y + 1 ) );
obj1 = dt << Fit Model(
Transform Column( "Log[y1]", Formula( Log( :y1 ) ) ),
Y( :"Log[y1]"n ),
Effects( :Drug, :x ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1, Confidence Intervals( 1 ), Term Value( Drug( "a", Lock( 0 ), Show( 1 ) ), x( 12, Lock( 0 ), Show( 1 ) ) ) ) )
);
obj1 << Prediction Formula;
obj1 << StdErr Pred Formula;
rpt1 = obj1 << report;
predFormY1 = Words( rpt1["Prediction Profiler"][List Box( 6 )] << get text, "[,]" )[1 :: 3];
predY1 = Num( predFormY1[1] );
lowCI1 = Num( predFormY1[2] );
higCI1 = Num( predFormY1[3] );
Log Capture( obj = dt << Profiler( Y( :Pred Formula y1, :"PredSE Log[y1]"n ), Use SE Formula( 1 ) ) );
rpt = obj << report;
predFormY = Words( rpt["Prediction Profiler"][List Box( 6 )] << get text, "[,]" )[1 :: 3];
predY = Num( predFormY[1] );
lowCI = Num( predFormY[2] );
higCI = Num( predFormY[3] );
obj2 = dt << Fit Model(
Y( Sqrt( :y2 ) ),
Effects( :Drug, :x ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1, Confidence Intervals( 1 ), Term Value( Drug( "a", Lock( 0 ), Show( 1 ) ), x( 12, Lock( 0 ), Show( 1 ) ) ) ) )
);
obj2 << Prediction Formula;
obj2 << StdErr Pred Formula;
rpt2 = obj2 << report;
predFormY2 = Words( rpt2["Prediction Profiler"][List Box( 6 )] << get text, "[,]" )[1 :: 3];
predY2 = Num( predFormY2[1] );
lowCI2 = Num( predFormY2[2] );
higCI2 = Num( predFormY2[3] );
Log Capture( obj3 = dt << Profiler( Y( :Pred Formula y2, :"PredSE Sqrt(y2)"n ), Use SE Formula( 1 ) ) );
rpt3 = obj3 << report;
predFormY3 = Words( rpt3["Prediction Profiler"][List Box( 6 )] << get text, "[,]" )[1 :: 3];
predY3 = Num( predFormY3[1] );
lowCI3 = Num( predFormY3[2] );
higCI3 = Num( predFormY3[3] );
Code Explanation:
- Open data table;
- Create new column "y1".
- Create new column "y2".
- Fit model for "Log[y1]".
- Add effects: "Drug", "x".
- Run profiler with confidence intervals.
- Extract prediction formula.
- Extract standard error formula.
- Capture report from first profiler.
- Extract prediction values and confidence intervals.
- Fit model for "Sqrt(y2)".
- Add effects: "Drug", "x".
- Run profiler with confidence intervals.
- Extract prediction formula.
- Extract standard error formula.
- Capture report from second profiler.
- Extract prediction values and confidence intervals.
Example 30
Summary: Fits a nominal logistic model with multiple effects and generates a profiler plot to visualize the probability of readiness.
Code:
dt = Open("data_table.jmp");
dt << New Column( "ReadyOld", Numeric, Nominal, Formula( If( :ready == "Not Ready", 1, 0 ) ) );
dt:ReadyOld << Delete Formula;
obj = dt << Fit Model( Freq( :count ), Y( :ReadyOld ), Effects( :heat, :soak ), Personality( "Nominal Logistic" ), Run Model );
obj << Save Probability Formula;
Log Capture(
obj = dt << Profiler(
Y( :Name( "Prob[0]" ), :Name( "Prob[1]" ), :Most Likely ReadyOld ),
Profiler( 1, Term Value( heat( 50 ), soak( 2.5 ) ) ),
Expand,
SendToReport(
Dispatch( {"Prediction Profiler"}, "2", ScaleBox, {Min( 0 ), Max( 60 ), Inc( 10 ), Rotated Labels( 1 )} ),
Dispatch( {"Prediction Profiler"}, "1", ScaleBox, {Max( 100 ), Inc( 20 ), Minor Ticks( 0 ), Rotated Labels( 1 )} )
)
)
);
indicator = Is Scriptable( obj );
formLin = Column( "Lin[1]" ) << get formula;
formProb0 = Column( "Prob[0]" ) << get formula;
formProb1 = Column( "Prob[1]" ) << get formula;
Substitute Into( formLin, Expr( :heat ), Expr( x1 ), Expr( :soak ), Expr( x2 ) );
Substitute Into( formProb0, Expr( :Name( "Lin[1]" ) ), Expr( LinValue ) );
Substitute Into( formProb1, Expr( :Name( "Lin[1]" ) ), Expr( LinValue ) );
nTest = 10;
For( i = 1, i <= nTest, i++,
x1 = Random Uniform( 40, 80 );
x2 = Random Uniform( 5, 15 );
obj << Profiler( Term Value( heat( x1, Max( 80 ) ), soak( x2, Max( 15 ) ) ) );
rpt = obj << report;
observedLike = Num( rpt[Text Box( 3 )] << get text );
LinValue = Eval( formLin );
expProb0 = Eval( formProb0 );
expProb1 = Eval( formProb1 );
expLike = Match( Max( expProb0, expProb1 ), expProb0, 0, expProb1, 1, . );
);
Code Explanation:
- Open table.
- Add new column.
- Remove formula from new column.
- Fit logistic model.
- Save probability formula.
- Create profiler.
- Set profiler settings.
- Check scriptability.
- Get formulas.
- Substitute variables.
Example 31
Summary: Process of performing time series forecasting with multiple effects and configuring model options, generating a profiler plot for analysis.
Code:
dt = Open("data_table.jmp");
dt << New Column( "missing", numeric );
For( i = 1, i <= 30, i++,
obj2 = dt << Time Series Forecast(
Y( :missing ),
Grouping( :Series ),
Time( :Time ),
Fit Model(
NAhead( 8 ),
NHoldout( 8 ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecast Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
);
obj2 << close window;
);
Code Explanation:
- Open data table.
- Create new column "missing".
- Loop 30 times.
- Perform time series forecast.
- Set forecast parameters.
- Configure model options.
- Close forecast window.
- Repeat loop.
- Continue until loop ends.
- End script.
Fit Model using Random Reset
Example 1
Summary: Performs a Partial Least Squares (PLS) regression analysis on the provided data table, generating various plots and reports.
Code:
Random Reset( 47 );
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :y ),
Effects( :Drug, :x, :Drug * :x ),
No Intercept,
Personality( Partial Least Squares ),
Run(
Validation Method( KFold( 7 ), Initial Number of Factors( 6 ) ),
Fit(
Method( NIPALS ),
Number of Factors( 1 ),
Variable Importance Plot( 1 ),
Distance Plots( 1 ),
Diagnostics Plots( 1 ),
Profiler( 1 ),
Overlay Loadings Plots( 1 ),
VIP vs Coefficients Plots( 1 ),
Percent Variation Plots( 1 ),
T Square Plot( 1 ),
Overlay Coefficients Plots( 1 )
)
),
SendToReport(
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Percent Variation Explained for X Effects"}, "1", ScaleBox,
{Rotated Labels( "Vertical" )}
),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Percent Variation Explained for Y Responses"}, "1", ScaleBox,
{Rotated Labels( "Vertical" )}
),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "X Loading Plot"}, "1", ScaleBox, {Rotated Labels( "Vertical" )} ),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Y Loading Plot"}, "1", ScaleBox, {Rotated Labels( "Vertical" )} ),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Variable Importance Plot"}, "1", ScaleBox, {Rotated Labels( "Vertical" )} ),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Coefficient Plot for Centered and Scaled Data"}, "1", ScaleBox,
{Rotated Labels( "Vertical" )}
),
Dispatch( {"NIPALS Fit with 1 Factors Using Fast SVD", "Coefficient Plot for Original Data"}, "1", ScaleBox,
{Rotated Labels( "Vertical" )}
)
)
);
Code Explanation:
- Reset random seed.
- Open data table;
- Initiate Fit Model.
- Set response variable.
- Define model effects.
- Exclude intercept term.
- Choose Partial Least Squares personality.
- Configure validation method.
- Specify fitting method.
- Generate various plots.
Example 2
Summary: Fits multiple linear regression models with varying specifications, generating reports and extracting effect tests for each model.
Code:
Random Reset( 2342 );
dt = Open("data_table.jmp");
dt:LDL[3 :: 10] = .;
obj1 = dt << Fit Model( Y( :Y ), Effects( :Gender, :BMI, :BP, :LDL ), Personality( "Response Screening" ), Robust Fit( 1 ), Run );
rpt1 = obj1 << report;
test1 = rpt1["Effect Tests"][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model( Y( :Y ), Effects( :Gender, :BMI, :BP ), Switch( :LDL ), Personality( "Response Screening" ), Robust Fit( 1 ), Run );
rpt2 = obj2 << report;
test2 = rpt2["Effect Tests"][Table Box( 1 )] << get as matrix;
obj3 = dt << Fit Model( Y( :Y ), Effects( :Gender, :BMI, :BP, :LDL ), Personality( "Response Screening" ), Cauchy Fit( 1 ), Run );
rpt3 = obj3 << report;
test3 = rpt3["Effect Tests"][Table Box( 1 )] << get as matrix;
obj4 = dt << Fit Model( Y( :Y ), Effects( :Gender, :BMI, :BP ), Switch( :LDL ), Personality( "Response Screening" ), Cauchy Fit( 1 ), Run );
rpt4 = obj4 << report;
test4 = rpt4["Effect Tests"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Set random seed.
- Open data table;
- Set LDL values 3-10 to missing.
- Fit model with LDL.
- Generate report for model 1.
- Extract effect tests from report 1.
- Fit model without LDL using switch.
- Generate report for model 2.
- Extract effect tests from report 2.
- Fit model with LDL using Cauchy fit.
- Generate report for model 3.
- Extract effect tests from report 3.
- Fit model without LDL using switch and Cauchy fit.
- Generate report for model 4.
- Extract effect tests from report 4.
Example 3
Summary: Analyze a linear model with random selection and multiple comparisons, utilizing JMP's standard least squares personality.
Code:
dt = Open("data_table.jmp");
Random Reset( 12345 );
dt << Select Randomly( 0.9 ) << Delete Rows();
obj = Fit Model( Y( :y ), Effects( :x, :Drug ), Personality( "Standard Least Squares" ), Emphasis( "Minimal Report" ), Run );
log1 = Log Capture( obj << Multiple Comparisons( Effect( :Drug ), Comparisons with Overall Average( 1 ) ) );
Close( dt, no save );
b comp effect = [3.15523529023617 0.2 15.7761764511808,
-5.42829364982825 0.327407594936709 -16.5796204296287,
0.0368755861890933 0.378921569620253 0.0973172000370663];
Code Explanation:
- Open data table;
- Reset random seed.
- Select 90% rows randomly.
- Delete unselected rows.
- Fit linear model with "y" as response.
- Include "x" and "Drug" as effects.
- Use standard least squares personality.
- Generate minimal report.
- Run the model.
- Capture log for multiple comparisons.
- Close table without saving.
Example 4
Summary: Fits a standard least squares model to a data table, selecting 90% of rows randomly, and capturing log for multiple comparisons.
Code:
dt = Open("data_table.jmp");
Random Reset( 12345 );
dt << Select Randomly( 0.9 ) << Delete Rows();
obj = Fit Model( Y( :y ), Effects( :x, :Drug ), Personality( "Standard Least Squares" ), Emphasis( "Minimal Report" ), Run );
Log Capture(
obj << Multiple Comparisons( Effect( :Drug ), Tukey HSD );
obj << Multiple Comparisons( Effect( :Drug ), Comparisons with control( 1, Control Level( "Drug:d" ) ) );
);
Code Explanation:
- Open data table;
- Set random seed to 12345.
- Randomly select 90% of rows.
- Delete unselected rows.
- Fit standard least squares model.
- Use "y" as response variable.
- Include "x" and "Drug" as effects.
- Generate minimal report.
- Run the model.
- Capture log for multiple comparisons.
Example 5
Summary: Process of selecting a random sample from a data table, fitting a standard least squares model, and generating a minimal report with multiple comparisons.
Code:
dt = Open("data_table.jmp");
Random Reset( 12345 );
dt << Select Randomly( 0.9 ) << Delete Rows();
obj = Fit Model( Y( :y ), Effects( :x, :Drug ), Personality( "Standard Least Squares" ), Emphasis( "Minimal Report" ), Run );
log1 = Log Capture( obj << Multiple Comparisons( Effect( :Drug ), Comparisons with Overall Average( 1 ) ) );
Code Explanation:
- Open data table;
- Set random seed to 12345.
- Randomly select 90% of rows.
- Delete unselected rows.
- Fit standard least squares model.
- Specify response variable "y".
- Include effects "x" and "Drug".
- Generate minimal report.
- Run the model.
- Capture multiple comparisons log.
Example 6
Summary: Process of performing a time series forecast and saving one-step-ahead predictions in JMP, utilizing the Time Series Forecast platform.
Code:
dt = Open("data_table.jmp");
Random Reset( 12345 );
dt << New Column( "Y2", numeric, formula( :Y + Random Integer( 100, 500 ) ) );
act01 = dt:Y << get values;
act02 = dt:Y2 << get values;
time0 = dt:Time << get values;
nobs = N Rows( dt );
obj = dt << Time Series Forecast(
Y( :Y, :Y2 ),
Grouping( :Series ),
Time( :Time ),
Fit Model(
NAhead( 4 ),
Period( 4 ),
NHoldout( 0 ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecasting Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
);
obj << Save Results(
Save Forecast Intervals( 0 ),
Name( "Save One-Step-Ahead Predictions" )(1),
Save Original Series( 1 ),
Save Forecast Results to Original Table( 1 ),
Forecasting Interval Level( 0.95 ),
N Ahead( 20 ),
Holdout( 0 )
);
time1 = dt:Time 2 << get values;
time2a = dt:Time 2 2 << get values;
onestep1 = dt:Y 1 Step and Forecast << get values;
onestep2 = dt:Y2 1 Step and Forecast << get values;
forecast1 = dt:Y Actual and Forecast << get values;
forecast2 = dt:Y2 Actual and Forecast << get values;
nobs2 = N Rows( dt );
Code Explanation:
- Open data_table data
- Reset random seed.
- Create new column Y2.
- Extract Y values.
- Extract Y2 values.
- Extract Time values.
- Count rows in table.
- Perform time series forecast.
- Save forecast results.
- Extract forecasted values.
Fit Model using If
Example 1
Summary: Runs marker relatedness analysis and model fitting for a specific dataset, utilizing principal components, clustering, and random effects.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
dt << Clear Select << Select Rows( Index( 11, 1000 ) ) << Delete Rows;
obj = dt << Marker Relatedness(
Marker( Column Group( "Markers" ) ),
Principal Components( 1 ),
Clustering( 1 ),
Ploidy( 2 ),
Set Random Seed( 0 ),
Missing Marker Imputation Method( "NONEHWE" ),
Kinship Type( "Identical by State" ),
SendToReport(
Dispatch( {"Marker Relatedness", "Hierarchical Clustering", "Dendrogram"}, "Clust Dendro", FrameBox, {Frame Size( 35, 700 )} )
)
);
obj << Merge Kinship Table;
Fit Model(
Effects,
Random Effects( Grouped( Column Group( "IBS" ) ) ),
Personality( "Response Screening" ),
Y( :Trait1 ),
Switch( :CG1 SNP1, :CG1 SNP2 ),
Run,
SendToReport(
Dispatch( {}, "Parameter Estimates", OutlineBox, {Close( 0 )} ),
Dispatch( {}, "Variance Components", OutlineBox, {Close( 0 )} )
)
);
);
Code Explanation:
- Check for JMP Pro version.
- Open data_table data
- Clear existing selections.
- Delete specific rows.
- Perform marker relatedness analysis.
- Set principal components to 1.
- Enable clustering.
- Set ploidy to 2.
- Initialize random seed.
- Use NONEHWE imputation method.
- Set kinship type.
- Adjust dendrogram size.
- Merge kinship table.
- Fit model with response screening personality.
- Add random effects.
- Specify Y variable.
- Switch variables.
- Run the model.
- Close parameter estimates report.
- Close variance components report.
Example 2
Summary: Runs a series of model fitting, publishing, and comparison operations using JMP's Formula Depot and data table manipulation features.
Code:
If( JMP Product Name() == "Pro",
fd = formula depot();
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Emphasis( "Minimal Report" ),
Run
);
mp1 = obj << Publish Prediction Formula;
mp2 = obj << Publish Parameterized Formula;
mc = fd << Model comparison( formulas( mp1, mp2 ) );
rfd = fd << Report;
mc << Profiler;
mc << Plot Actual by Predicted;
mc << Plot Residual by Row;
mc << Model Averaging;
mc << Local Data Filter;
Close( dt, nosave );
fd = formula depot();
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Emphasis( "Minimal Report" ),
Run
);
mp1 = obj << Publish Prediction Formula;
mp2 = obj << Publish Parameterized Formula;
pr = fd << Profiler( formulas( mp1, mp2 ) );
rfd = fd << Report;
pr << Custom Profiler;
fd << close window;
Close( dt, nosave );
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 ) );
rfd = fd << report;
fd << close window;
Close( dt, nosave );
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;
Close( dt, nosave );
);
Code Explanation:
- Check if JMP Product Name is Pro.
- Initialize Formula Depot.
- Open data table.
- Fit Model with weight as Y and age, sex, height as effects.
- Publish Prediction Formula.
- Publish Parameterized Formula.
- Compare models using Formula Depot.
- Generate model report.
- Enable Profiler.
- Plot Actual vs Predicted.
- Plot Residual vs Row.
- Enable Model Averaging.
- Enable Local Data Filter.
- Close data_table.jmp without saving.
- Reinitialize Formula Depot.
- Reopen data table.
- Refit Model.
- Republish Prediction Formula.
- Republish Parameterized Formula.
- Generate Profiler report.
- Enable Custom Profiler.
- Close Formula Depot window.
- Close data_table.jmp without saving.
- Open data table.
- Run Nominal Logistic script.
- Initialize Formula Depot.
- Save Probability Formula.
- Add formula from "Most Likely Species" column.
- Publish Probability Formulas.
- Compare models using Formula Depot.
- Generate model report.
- Close Formula Depot window.
- Close data_table.jmp without saving.
- Reopen data table.
- Rerun Nominal Logistic script.
- Reinitialize Formula Depot.
- Republish Probability Formulas.
- Republish Probability Formulas.
- Generate model report.
- Close Formula Depot window.
- Close data_table.jmp without saving.
- Create new table named "test".
- Initialize Formula Depot.
- Add formula from "test" column.
- Generate model report.
- Close Formula Depot window.
- Close "test" table without saving.
Example 3
Summary: Runs a series of data manipulation and analysis tasks in JMP Pro, including model fitting, partitioning, and formula publishing.
Code:
If( JMP Product Name() == "Pro",
fd = Formula Depot();
fd << Title( "FD Sanity Check" );
source = Open("data_table.jmp");
obj = Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Emphasis( "Minimal Report" ),
Run
);
mp1 = obj << Publish Prediction Formula;
obj = Partition( Y( :weight ), X( :sex, :age, :height ), Split Best( 3 ) );
mp2 = obj << Publish Prediction Formula;
source << New Column( "Test", Formula( :height + :weight ) );
mp3 = fd << Add Formula from Column( Table( source ), columns( "Test" ) );
invaliddt = Open("data_table.jmp");
target = Open("data_table.jmp");
fd << Copy Scripts();
str = Get Clipboard();
fd << Copy Scripts( abcd );
str = Get Clipboard();
fd << Copy Formulas as Transforms();
str = Get Clipboard();
fd << Copy Formulas as Transforms( abc );
str = Get Clipboard();
code = fd << Generate C Code( NoEditor );
code = fd << Generate Python Code( Formulas( {mp1, mp2} ), NoEditor );
code = fd << Generate Python Code( table(), Formulas( {mp1, mp2} ), NoEditor );
code = fd << Generate Javascript Code( table( source ), Formulas( {3} ), NoEditor );
code = fd << Generate SAS Code( Formulas( {3} ), NoEditor );
code = fd << Generate SQL Code( Formulas( mp1, "Partition - weight" ), "MySQL", NoEditor );
code = fd << Generate SQL Code( Formulas( mp2, 1 ), "SQL Server", NoEditor );
code = fd << Generate SQL Code( Formulas( {mp1, 2} ), NoEditor );
Close( source, nosave );
Close( invaliddt, nosave );
Close( target, nosave );
fd << close window;
);
Code Explanation:
- Check if JMP is Pro.
- Initialize Formula Depot.
- Set title for Formula Depot.
- Open data table;
- Fit model with weight as response.
- Publish prediction formula.
- Partition data on weight.
- Publish another prediction formula.
- Create new column with formula.
- Add formula to Formula Depot.
- Open data table;
- Open data table;
- Copy scripts from Formula Depot.
- Copy scripts with name "abcd".
- Copy formulas as transforms.
- Copy formulas as transforms named "abc".
- Generate C code.
- Generate Python code for formulas.
- Generate Python code for table and formulas.
- Generate JavaScript code for source table.
- Generate SAS code for formulas.
- Generate MySQL SQL code.
- Generate SQL Server SQL code.
- Generate generic SQL code.
- Close all datasets without saving.
- Close Formula Depot window.
Example 4
Summary: Fits a mixed-effects model, generating prediction and parameterized formulas, and publishing standard error and confidence limit formulas in JMP Pro.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
n1 = N Items( dt << get column names( string ) );
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Standard Least Squares" ),
Method( "EMS" ),
Run
);
obj << Prediction Formula( 1 );
pred formula1 = (dt:Pred Formula miles << get formula( 1 ));
pred formula1 eval = dt:Pred Formula miles << get values;
obj << Parameterized Formula( 1 );
pred param formula1 = (dt:Pred Param Formula miles << get formula( 1 ));
dt << Delete Columns( n1 + 1 :: N Cols( dt ) );
depot1 = obj << Publish Prediction Formula( 1 );
depot1 << Run Script( 1 );
pred formula2 = (dt:Pred Formula miles << get formula( 1 ));
pred formula2 eval = dt:Pred Formula miles << get values;
depot2 = obj << Publish Parameterized Formula( 1 );
obj << Publish Standard Error Formula( 1 );
obj << Publish Mean Confid Limit Formula( 1 );
obj << Publish Indiv Confid Limit Formula( 1 );
Close( dt, no save );
Window( "Formula Depot" ) << close window( 1 );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table;
- Count initial columns.
- Fit a mixed-effects model.
- Add prediction formula.
- Retrieve prediction formula.
- Evaluate prediction formula.
- Add parameterized formula.
- Retrieve parameterized formula.
- Delete added columns.
- Publish prediction formula.
- Run published script.
- Retrieve updated prediction formula.
- Publish parameterized formula.
- Publish standard error formula.
- Publish mean confidence limit formula.
- Publish individual confidence limit formula.
- Close dataset without saving.
- Close Formula Depot window.
Example 5
Summary: Fits two Partial Least Squares (PLS) models to predict ABRASION using different effects and captures logs for each model.
Code:
If( Contains( Build Information(), "Pro" ) > 0,
dt = Open("data_table.jmp");
log1 = Log Capture(
obj1 = Fit Model(
Y( :ABRASION ),
Effects( Log( :SILICA ), Sqrt( :SILANE ), Exp( :SULFUR ), Exp( :SULFUR ) * Log( :SILICA ), Exp( :SULFUR ) * Sqrt( :SILANE ) ),
Personality( "Partial Least Squares" ),
Run
)
);
log2 = Log Capture(
obj2 = Fit Model(
Y( :ABRASION ),
Effects( Log( :SILICA ), Sqrt( :SILANE ), Exp( :SULFUR ), :SULFUR * :SILICA, :SULFUR * :SILANE ),
Personality( "Partial Least Squares" ),
Run
)
);
Close( dt, no save );
);
Code Explanation:
- Check for Pro version.
- Open data table.
- Capture log for first model.
- Fit first model using PLS.
- Specify ABRASION as response.
- Define transformed effects.
- Run first model.
- Capture log for second model.
- Fit second model using PLS.
- Specify ABRASION as response.
- Define different effects.
- Run second model.
- Close data table without saving.
Example 6
Summary: Fits and creates reports for two random effects models with response screening in JMP Pro, extracting parameter estimates, variance components, and BLUPs.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Random Effects( Grouped( Column Group( "Markers" ) ) ),
Personality( "Response Screening" ),
Y( :Trait1 ),
Run
);
obj2 = dt << Fit Model(
Random Effects( Grouped( Column Group( "Markers" ) ) ),
Personality( "Response Screening" ),
Y( :Trait1 ),
Run
);
rpt1 = obj1 << report;
rpt2 = obj2 << report;
parmest1 = rpt1["Parameter Estimates"][Table Box( 1 )] << get as matrix;
parmest2 = rpt2["Parameter Estimates"][Table Box( 1 )] << get as matrix;
vc1 = rpt1["Variance Components"][Table Box( 1 )] << get as matrix;
vc2 = rpt2["Variance Components"][Table Box( 1 )] << get as matrix;
blups1 = rpt1["BLUPs - Random Effect Predictions"][Table Box( 1 )] << get as matrix;
blups2 = rpt2["BLUPs - Random Effect Predictions"][Table Box( 1 )] << get as matrix;
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro version.
- Open data_table data
- Fit first model with response screening.
- Fit second model with response screening.
- Retrieve first model's report.
- Retrieve second model's report.
- Extract parameter estimates from first report.
- Extract parameter estimates from second report.
- Extract variance components from first report.
- Extract variance components from second report.
Example 7
Summary: Creates a Fit Model dialog in JMP, capturing button names and titles, and logging output for analysis.
Code:
If( JMP Product Name() == "Pro",
IsPro = 1,
IsPro = 0
);
dt = Open("data_table.jmp");
dlg = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Response Screening" ),
);
dlgrpt = dlg << report;
Try(
check0 = dlgrpt[Button Box( 1 )] << get button name;
check1 = dlgrpt[Button Box( 2 )] << get button name;
check2 = dlgrpt[Button Box( 3 )] << get button name;
check3 = dlgrpt[Button Box( 4 )] << get button name;
check4 = dlgrpt[Button Box( 5 )] << get button name;
check5 = dlgrpt[Button Box( 6 )] << get button name;
check6 = dlgrpt[TabListBox( 1 )][Tab Page Box( 1 )] << get title;
check7 = dlgrpt[TabListBox( 1 )][Tab Page Box( 2 )] << get title;
check8 = dlgrpt[TabListBox( 1 )][Tab Page Box( 2 )][Button Box( 4 )] << get button name;
check9 = dlgrpt[TabListBox( 1 )][Tab Page Box( 2 )][Text Box( 2 )] << get text;
);
log1 = Log Capture(
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Response Screening" ),
Run
)
);
If( IsPro,
rpt = obj << report;
title1 = rpt[Outline Box( 1 )] << get title;
title2 = rpt[Outline Box( 2 )] << get title;
title3 = rpt[Outline Box( 3 )] << get title;
title4 = rpt[Outline Box( 4 )] << get title;
title5 = rpt[Outline Box( 5 )] << get title;
title6 = rpt[Outline Box( 6 )] << get title;
title7 = rpt[Outline Box( 7 )] << get title;
,
);
Code Explanation:
- Check if JMP version is Pro.
- Set
IsProvariable. - Open data table;
- Create Fit Model dialog.
- Define response variable and effects.
- Specify random effects.
- Set personality to Response Screening.
- Retrieve report from dialog.
- Attempt to capture button names and titles.
- Log captured output for analysis.
Example 8
Summary: Generalized regression analysis in JMP Pro, fitting a model to predict 'weight' based on 'age', 'sex', and 'height' effects.
Code:
If( Contains( Build Information(), "Pro" ) > 0,
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Generalized Regression" ),
Run( Fit( Estimation Method( Maximum Likelihood ), Validation Method( None ) ) )
);
rpt = obj << report;
obj << (fit[1] << Show Prediction Expression( 1 ));
a = Try( , 0 );
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table;
- Initiate Fit Model platform.
- Set response variable to "weight".
- Include effects: "age", "sex", "height".
- Use Generalized Regression personality.
- Run model with Maximum Likelihood estimation.
- Generate model report.
- Display prediction expression.
- Attempt to close dataset without saving.
Example 9
Summary: Fits a Generalized Regression model in JMP Pro, capturing window titles and item enabled states along the way.
Code:
If( Contains( Build Information(), "Pro" ) > 0,
dt = Open("data_table.jmp");
befaa = Associative Array( Window() << get window title );
obj = dt << Fit Model( Y( :Y Binary ), Target Level( "Low" ), Personality( "Generalized Regression" ), );
aftaa = Associative Array( Window() << getwindowtitle );
aftaa << Remove( befaa );
title = ((aftaa << getkeys)[1]);
modwin = Window( title );
items = modwin[Combo Box( 2 )] << getitems;
aEnabled = J( N Items( items ), 1, . );
For( i = 1, i <= N Items( items ), i++,
aEnabled[i] = modwin[Combo Box( 2 )] << itemenabled( i )
);
bEnabled = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
Close( dt, nosave );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Capture initial window titles.
- Fit Generalized Regression model.
- Capture new window titles.
- Remove initial window titles.
- Get model window title.
- Access model window.
- Retrieve combo box items.
- Compare item enabled states.
Example 10
Summary: Generalized regression analysis in JMP Pro, capturing window titles and closing windows as necessary.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
dt:sex[1 :: 40] = "M";
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
Fit Model( Y( :sex ), Target Level( "F" ), Effects( :age, :height, :weight ), Personality( "Generalized Regression" ), Run )
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
If( N Items( aftlst ) == 1,
tmp = Window( aftlst[1] );
tmp << close window( 1 );
);
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro.
- Open data table.
- Set first 40 sex entries to "M".
- Capture initial window titles.
- Fit generalized regression model.
- Capture new window titles.
- Remove initial titles from new titles.
- Get remaining window keys.
- If one key, close corresponding window.
- Close data table without saving.
Example 11
Summary: Generalized regression analysis in JMP Pro, fitting a model to the Damping response variable and selecting the best predictors using Forward Selection and AICc.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Damping ),
Effects( :CuSO4 & RS & Mixture, :Na2S2O3 & RS & Mixture, :CuSO4 * :Na2S2O3, :Glyoxal ),
Center Polynomials( 0 ),
No Intercept( 0 ),
Personality( "Generalized Regression" ),
Run( Fit( Estimation Method( Forward Selection ), Validation Method( AICc ) ) )
);
obj1 << Save Script to Report( 1 );
rpt = obj1 << report;
script1 = rpt[Text Box( 1 )] << get text;
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table.
- Start Fit Model.
- Set response variable.
- Define effects.
- Disable center polynomials.
- Enable intercept.
- Choose Generalized Regression.
- Run model with Forward Selection and AICc.
- Save script to report.
- Extract report.
- Retrieve script text.
- Close data table without saving.
Example 12
Summary: Fits a Generalized Linear Mixed Model in JMP Pro, enabling covariance analysis and generating a report with residual standard error and covariance of covariance parameters.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Y ),
Effects( :Treatment, :Month, :Month * :Treatment ),
NoBounds( 1 ),
Personality( "Generalized Linear Mixed Model" ),
Run
);
obj << (Fit[1] << Covariance of Covariance Parameters( 1 ));
obj << (Fit[1] << Covariance of All Parameters( 1 ));
rpt = obj << report;
resid stderr = (rpt["Fixed Effects Parameter Estimates"][Table Box( 2 )] << get as matrix)[2];
cov covparms = rpt["Covariance of Covariance Parameters"][Matrix Box( 1 )] << get;
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table;
- Fit Generalized Linear Mixed Model.
- Enable covariance of covariance parameters.
- Enable covariance of all parameters.
- Generate model report.
- Extract residual standard error.
- Extract covariance of covariance parameters.
- Close dataset without saving.
Example 13
Summary: Fits a mixed model with conditional profiler in JMP Pro, extracting prediction text and updating profiler settings.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :Defect ),
Effects( :Finishing Treatment ),
Random Effects( :Lot, :Lot * :Finishing Treatment ),
NoBounds( 1 ),
Personality( "Mixed Model" ),
Run(
Conditional Profiler(
1,
Confidence Intervals( 1 ),
Term Value( "Conditional", Finishing Treatment( 5, Lock( 0 ), Show( 1 ) ), Lot( 1, Lock( 0 ), Show( 1 ) ), )
)
)
);
rpt = obj << report;
pred1 = rpt["Conditional Model Profiler"][Text Box( 2 )] << get text;
obj << Conditional Profiler(
1,
Confidence Intervals( 0 ),
Term Value( "Conditional", Finishing Treatment( 5, Lock( 0 ), Show( 1 ) ), Lot( 1, Lock( 0 ), Show( 1 ) ), )
);
pred2 = rpt["Conditional Model Profiler"][Text Box( 2 )] << get text;
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table.
- Fit mixed model.
- Set effects and random effects.
- Disable bounds.
- Run model with profiler.
- Get profiler report.
- Extract prediction text.
- Update profiler settings.
- Extract updated prediction text.
- Close data table without saving.
Example 14
Summary: Fits a model to data and generating prediction formulas, confidence intervals, and prediction intervals.
Code:
If( Contains( JMP Product Name(), "Pro", ) > 0,
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Validation( :Validation ),
Y( :Y ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1, Confidence Intervals( 1 ), Prediction Intervals( 1 ), Arrange in Rows( 4 ), Set to Data in Row( 2 ) ) )
);
obj << Save Columns( Prediction Formula, Mean Confidence Limit Formula, Indiv Confidence Limit Formula );
rpt = obj << report;
pred1 = rpt["Prediction Profiler"][Text Box( 2 )] << get text;
ci1 = (rpt["Prediction Profiler"][Text Box( 3 )] << get text) || (rpt["Prediction Profiler"][Text Box( 4 )] << get text);
pi1 = rpt["Prediction Profiler"][Text Box( 5 )] << get text;
b test1 = (dt << get as matrix)[2, 13 :: 17];
Close( dt, no save );
);
Code Explanation:
- Check for JMP version.
- Open data table;
- Initiate Fit Model platform.
- Set validation method.
- Define response variable.
- Specify model effects.
- Choose Standard Least Squares personality.
- Request minimal report.
- Run Profiler with intervals.
- Save prediction formulas.
- Extract profiler report.
- Retrieve prediction text.
- Concatenate confidence interval texts.
- Fetch prediction interval text.
- Get beta test values.
- Close dataset without saving.
Example 15
Summary: Fits a model to a data table, generating a minimal report, and extracting specific test results.
Code:
If( Contains( JMP Product Name(), "Pro", ) > 0,
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Validation( :Validation ),
Y( Transform Column( "Log[Y]", Formula( Log( :Y ) ) ) ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1, Confidence Intervals( 1 ), Prediction Intervals( 1 ), Arrange in Rows( 4 ), Set to Data in Row( 2 ) ) )
);
obj << Save Columns( Prediction Formula, Mean Confidence Limit Formula, Indiv Confidence Limit Formula );
rpt = obj << report;
pred1 = rpt["Prediction Profiler"][Text Box( 2 )] << get text;
ci1 = (rpt["Prediction Profiler"][Text Box( 3 )] << get text) || (rpt["Prediction Profiler"][Text Box( 4 )] << get text);
pi1 = rpt["Prediction Profiler"][Text Box( 5 )] << get text;
b test1 = (dt << get as matrix)[2, 13 :: 17];
Close( dt, no save );
);
Code Explanation:
- Check for "Pro" in product name.
- Open data table;
- Fit model with specified parameters.
- Use Standard Least Squares personality.
- Generate minimal report.
- Run profiler with confidence and prediction intervals.
- Save prediction, mean confidence, and individual confidence limit formulas.
- Extract report from fitted model.
- Retrieve prediction, confidence interval, and prediction interval texts.
- Extract specific test results from dataset.
- Close dataset without saving.
Example 16
Summary: Fits a model to a data table, generating a minimal report with prediction formulas and confidence limits, and extracting text from the profiler report.
Code:
If( Contains( JMP Product Name(), "Pro", ) > 0,
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Validation( :Validation ),
Y( :Y ),
Freq( :Gender ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Profiler( 1, Confidence Intervals( 1 ), Prediction Intervals( 1 ), Arrange in Rows( 4 ), Set to Data in Row( 2 ) ) )
);
obj << Save Columns( Prediction Formula, Mean Confidence Limit Formula, Indiv Confidence Limit Formula );
rpt = obj << report;
pred1 = rpt["Prediction Profiler"][Text Box( 2 )] << get text;
ci1 = (rpt["Prediction Profiler"][Text Box( 3 )] << get text) || (rpt["Prediction Profiler"][Text Box( 4 )] << get text);
pi1 = rpt["Prediction Profiler"][Text Box( 5 )] << get text;
b test1 = (dt << get as matrix)[2, 13 :: 17];
Close( dt, no save );
);
Code Explanation:
- Check for "Pro" in product name.
- Open data table;
- Fit model using standard least squares.
- Set validation column.
- Specify response variable Y.
- Use Gender as frequency.
- Include multiple effects in model.
- Generate minimal report.
- Run profiler with confidence and prediction intervals.
- Save prediction formulas and confidence limits.
- Extract text from profiler report.
- Retrieve beta test results.
- Close dataset without saving.
Example 17
Summary: Fits a standard least squares model, generating a regression plot, and extracting marker segments from a data table in JMP Pro.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
dt:Validation[1 :: 10] = 3;
obj = Fit Model(
Validation( :Validation ),
Y( :Y ),
Effects( :BMI ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run
);
rpt = obj << report;
markers1 = (rpt[Outline Box( "Regression Plot" )][FrameBox( 1 )] << Find Seg( MarkerSeg )) << get markers;
dt << Recode Column( :Validation, {If( _rcNow <= 1, "Dot", _rcNow <= 2, "v", "t" )}, Target Column( "Test Marker" ) );
b markers1 = dt:Test Marker << get values;
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Set validation column.
- Fit standard least squares model.
- Generate regression plot.
- Extract marker segments.
- Recode validation column.
- Get test marker values.
- Close dataset without saving.
Example 18
Summary: Fits a standard least squares model to a data table, extracting the R-Square value, and generating a minimal report.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
Random Reset( 123 );
dt << New Column( "Freq1", formula( Random Integer( 1, 3 ) ) );
obj = Fit Model(
Freq( :Freq1 ),
Validation( :Validation ),
Y( :Y ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Effect Summary( 0 ) )
);
rpt = obj << report;
rsquare = rpt["Crossvalidation"][Number Col Box( "RSquare" )] << get as matrix;
Close( dt, no save );
);
b log1 =
"Note: The data table has changed. The output no longer represents the data. To synchronize the output with the data, select 'Sync to Data Table Changes' from the platform menu.";
Code Explanation:
- Check for JMP Pro version.
- Open data table;
- Set random seed.
- Add new column "Freq1".
- Fit standard least squares model.
- Specify validation method.
- Set response variable.
- Include multiple effects.
- Generate minimal report.
- Extract R-Square value.
Example 19
Summary: Fits four linear and mixed models to a data table, utilizing different weight and frequency options, and closes the dataset without saving.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
dt:age[1 :: 3] = .;
obj1 = dt << Fit Model( Y( :weight ), Effects( :sex ), Weight( :age ), Personality( "Standard Least Squares" ), Run );
obj2 = dt << Fit Model( Y( :weight ), Effects( :sex ), Weight( :age ), Personality( "Generalized Linear Mixed Model" ), Run );
obj3 = dt << Fit Model( Y( :weight ), Effects( :sex ), Freq( :age ), Personality( "Standard Least Squares" ), Run );
obj4 = dt << Fit Model( Y( :weight ), Effects( :sex ), Freq( :age ), Personality( "Generalized Linear Mixed Model" ), Run );
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table;
- Set first three ages to missing.
- Fit linear model with age as weight.
- Fit mixed model with age as weight.
- Fit linear model with age as frequency.
- Fit mixed model with age as frequency.
- Close the dataset without saving.
Example 20
Summary: Fits a mixed model in JMP Pro, generating random effects predictions, and closing windows without saving data.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
obj = dt << Fit Model(
Y( :NPN1, :PNP1, :PNP2 ),
Effects( :NPN2 ),
Random Effects( :lot_id, :wafer[:lot_id] ),
Personality( "Mixed Model" ),
Run( Results in Data Tables, )
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
obj << Random Effects Predictions( 1 );
For( i = 1, i <= N Items( aftlst ), i++,
Window( aftlst[i] ) << close window
);
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro.
- Open data table.
- Store initial window titles.
- Fit mixed model.
- Store updated window titles.
- Remove unchanged window titles.
- Get new window titles.
- Generate random effects predictions.
- Close new windows.
- Close data table without saving.
Example 21
Summary: Generates a mixed model analysis for yield prediction, utilizing JMP Pro's Fit Model platform to account for random effects and centering.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :Yield ),
Effects( :Moisture ),
Random Effects( Intercept[:Variety] & Random Coefficients( 1 ), :Moisture[:Variety] & Random Coefficients( 1 ) ),
Center Polynomials( 0 ),
Personality( "Mixed Model" ),
Run()
);
obj << Save Script to Report( 1 );
rpt = obj << report;
script1 = rpt[Outline Box( "Mixed Model for Yield" )][Text Box( 1 )] << get text;
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Fit mixed model analysis.
- Set response variable as Yield.
- Add Moisture as effect.
- Define random effects.
- Disable polynomial centering.
- Set personality to Mixed Model.
- Run the model.
- Save script to report.
Example 22
Summary: Analyze a mixed model with residual plots, selecting specific rows and excluding one, using JMP Pro's data manipulation and modeling capabilities.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
s = dt << Select Rows( [1, 2, 3, 4] );
s << Exclude( 1 );
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Mixed Model" ),
Run( Residual Plots( 1 ) )
);
rpt = obj << report;
Close( dt, no save );
);
Code Explanation:
- Check if JMP is Pro.
- Open data table;
- Select rows 1-4.
- Exclude row 1.
- Fit mixed model.
- Specify response variable miles.
- Define effects: species, subject, season, interaction.
- Set personality to Mixed Model.
- Generate residual plots.
- Retrieve report object.
Example 23
Summary: Fits a mixed model to a data table, generating residual plots, and reporting results in JMP Pro.
Code:
b hist1 = [0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0];
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
s = dt << Select Rows( [1, 2, 3, 4] );
s << Exclude( 1 );
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Mixed Model" ),
Run( Residual Plots( 1 ) )
);
rpt = obj << report;
Close( dt, no save );
);
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
s = dt << Select Rows( [1, 2, 3, 4] );
s << Exclude( 1 );
s << Hide( 1 );
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Mixed Model" ),
Run( Residual Plots( 1 ) )
);
rpt = obj << report;
Close( dt, no save );
);
Code Explanation:
- Define
b hist1array. - Check if JMP is Pro version.
- Open data table;
- Select rows 1-4.
- Exclude row 1.
- Fit mixed model on selected data.
- Generate residual plots.
- Store report in
rpt. - Close file without saving.
- Repeat steps 2-9, hiding row 1 instead of excluding.
Example 24
Summary: Fits a mixed-effects model analysis to predict miles traveled, incorporating species and season fixed effects, subject nested random effects, and displaying summary reports and residual plots.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Mixed Model" ),
Run
);
obj << Report View( Summary );
obj << Report View( Full );
obj << Residual Plots( 1 );
obj << Report View( Summary );
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Initiate Fit Model platform.
- Set response variable: miles.
- Define fixed effects: species, season, interaction.
- Specify random effect: subject nested in species.
- Use Mixed Model personality.
- Run the model.
- Display summary report.
- Display full report.
- Generate residual plots.
- Display summary report again.
- Close dataset without saving.
Example 25
Summary: Fits a mixed model to a dataset, using age and height as effects, with variance components analysis.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :weight ),
Effects( :age, :height ),
Personality( "Mixed Model" ),
Run( Linear Combination of Variance Components )
);
Close( dt, no save );
);
Code Explanation:
- Check if JMP is Pro.
- Open data table;
- Fit mixed model.
- Set response variable.
- Add age effect.
- Add height effect.
- Use Mixed Model personality.
- Run variance components.
- Close dataset without saving.
Example 26
Summary: Fits a mixed model to data, specifying miles as the response variable and including species, season, and interaction effects, with random effects for subject[:species].
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
NoBounds( 1 ),
No Intercept( 1 ),
Personality( "Mixed Model" ),
Run( Indicator Parameterization Estimates( 1 ), Repeated Effects Covariance Parameter Estimates( 0 ) )
);
rpt = obj << report;
test1 = Try( rpt[Outline Box( "Indicator Function Parameterization" )] << get as matrix, 1 );
Close( dt, no save );
);
Code Explanation:
- Check if JMP is Pro.
- Open data table.
- Fit mixed model to data.
- Specify miles as response.
- Add species, season, and interaction effects.
- Set subject[:species] as random effect.
- Disable bounds on parameters.
- Remove intercept from model.
- Use Mixed Model personality.
- Run model with specified options.
Example 27
Summary: Runs the fitting and prediction of mixed models in JMP Pro, generating reports for two separate models with specified effects.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Mixed Model" ),
Run
);
obj1 << Prediction Formula;
prop1 = dt:Pred Formula miles << get property( "Predicting" );
obj2 = dt << Fit Model( Y( :miles ), Effects( :species, :season, :species * :season ), Personality( "Mixed Model" ), Run );
rpt2 = obj2 << report;
obj2 << Prediction Formula;
prop2 = dt:Pred Formula miles 2 << get property( "Predicting" );
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table;
- Fit mixed model with specified effects.
- Add prediction formula to model.
- Retrieve predicting property from first model.
- Fit another mixed model with same effects.
- Generate report for second model.
- Add prediction formula to second model.
- Retrieve predicting property from second model.
- Close dataset without saving.
Example 28
Summary: Fits a mixed model to data, utilizing JMP Pro's capabilities for spatial analysis with nugget and exponential correlation function.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Yield ),
Effects,
Center Polynomials( 0 ),
Personality( "Mixed Model" ),
Repeated Effects( :Row, :Column ),
Repeated Structure( "Spatial with Nugget" ),
Repeated Structure Type( "Exponential" ),
Run( Random Effects Covariance Parameter Estimates( 0 ), Fitted Variogram( 1 ) )
);
rpt1 = Report( obj1 );
cov = rpt1[Outline Box( "Repeated Effects Covariance Parameter Estimates" )][Table Box( 1 )] << get as matrix;
sig2 = cov[3, 1];
rho2 = cov[1, 1];
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table.
- Fit mixed model to data.
- Set response variable as Yield.
- Specify model effects.
- Disable center polynomials.
- Choose mixed model personality.
- Define repeated effects.
- Select spatial structure with nugget.
- Use exponential correlation function.
Example 29
Summary: Fits a mixed model with repeated effects to analyze yield data, utilizing JMP Pro's advanced statistical capabilities.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Yield ),
Effects,
Center Polynomials( 0 ),
Personality( "Mixed Model" ),
Repeated Effects( :Row, :Column ),
Repeated Structure( "Spatial with Nugget" ),
Repeated Structure Type( "Power" ),
Run( Random Effects Covariance Parameter Estimates( 0 ), Variogram( 1 ) )
);
rpt1 = Report( obj1 );
cov = rpt1[Outline Box( "Repeated Effects Covariance Parameter Estimates" )][Table Box( 1 )] << get as matrix;
sig2 = cov[3, 1];
rho2 = cov[1, 1];
);
Code Explanation:
- Check for JMP Pro.
- Open data table.
- Initiate Fit Model platform.
- Set response variable.
- Define effects.
- Use Mixed Model personality.
- Specify repeated effects.
- Set spatial with nugget structure.
- Choose power structure type.
- Run model with random effects covariance.
Example 30
Summary: Generates a mixed model analysis with variogram creation for the 'miles' response variable, incorporating species and season effects, and utilizing Mixed Model personality.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Mixed Model" ),
Run( Actual by Predicted Plot( 0 ), Actual by Conditional Predicted Plot( 0 ) )
);
rpt1 = Report( obj1 );
obj1 << Variogram( X( :miles ), AR1( 1 ) );
obj1 << Variogram( 0 );
obj1 << Variogram( 1 );
obj1 << Variogram( Gaussian( 1 ) );
obj1 << Variogram( Exponential( 1 ) );
obj1 << Variogram( 0 );
obj1 << Variogram( 1 );
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro version.
- Open data table;
- Fit mixed model analysis.
- Set response variable to miles.
- Include species, season, interaction effects.
- Define subject:species as random effect.
- Use Mixed Model personality.
- Disable default plots.
- Generate report from fit model.
- Create variogram with AR1 model.
- Clear previous variogram settings.
- Create variogram with default settings.
- Create variogram with Gaussian model.
- Create variogram with Exponential model.
- Clear previous variogram settings.
- Create variogram with default settings.
- Close dataset without saving.
Example 31
Summary: Runs the analysis and prediction of brand preferences using a Nominal Logistic model, fitting data to various effects and publishing probability formulas in JMP Pro.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
n1 = N Items( dt << get column names( string ) );
obj = dt << Fit Model(
Freq( :count ),
Y( :brand ),
Effects(
:softness, :previous use, :softness * :previous use, :temperature, :softness * :temperature, :previous use * :temperature,
:softness * :previous use * :temperature
),
Personality( "Nominal Logistic" ),
Run
);
obj << Save Probability Formula( 1 );
lin1 = dt:Name( "Lin[x]" ) << get values( 1 );
prob1 = (dt:Name( "Prob[x]" ) << get values( 1 )) || (dt:Name( "Prob[m]" ) << get values( 1 ));
pred1 = dt:Most Likely brand << get values( 1 );
dt << Delete Columns( n1 + 1 :: N Cols( dt ) );
depot1 = obj << Publish Probability Formulas( 1 );
depot1 << Run Script( 1 );
lin2 = dt:Name( "Lin[x]" ) << get values( 1 );
prob2 = (dt:Name( "Prob[x]" ) << get values( 1 )) || (dt:Name( "Prob[m]" ) << get values( 1 ));
pred2 = dt:Most Likely brand << get values( 1 );
Close( dt, no save );
Window( "Formula Depot" ) << close window( 1 );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Count initial columns.
- Fit Nominal Logistic model.
- Save probability formula.
- Retrieve Lin[x] values.
- Retrieve Prob[x] and Prob[m] values.
- Retrieve Most Likely brand values.
- Delete new columns.
- Publish probability formulas.
- Run published script.
- Retrieve updated Lin[x] values.
- Retrieve updated Prob[x] and Prob[m] values.
- Retrieve updated Most Likely brand values.
- Close dataset without saving.
- Close Formula Depot window.
Example 32
Summary: Fits and creates reports for two nominal logistic models with decision thresholds, utilizing JMP Pro's data table and modeling capabilities.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :Y Binary ),
Effects( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Personality( "Nominal Logistic" ),
Target Level( "High" ),
Run( Decision Threshold( 1 ) )
);
rpt1 = obj1 << report;
test1 = rpt1["Decision Thresholds"][Table Box( 1 )] << get as matrix;
obj2 = dt << Fit Model(
Y( :Y Binary ),
Effects( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Validation( :Validation ),
Personality( "Nominal Logistic" ),
Run( Decision Threshold( 1 ) )
);
rpt2 = obj2 << report;
test2 = rpt2["Decision Thresholds"][Table Box( 1 )] << get as matrix;
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Fit nominal logistic model.
- Retrieve decision thresholds.
- Fit another nominal logistic model.
- Retrieve decision thresholds.
- Close dataset without saving.
Example 33
Summary: Performs a Partial Least Squares analysis with Leave-One-Out validation and generates Variable Importance Plots, utilizing the Fit Model platform to create two models with different fitting methods.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt2 = Open("data_table.jmp");
obj = dt2 << 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( "Leave-One-Out" ),
Fit( SVD( Classical ), Method( NIPALS ), Variable Importance Plot( 1 ), Set VIP Threshold( 1.5 ) ),
Fit( SVD( Classical ), Method( SIMPLS ), Number of Factors( 3 ), Variable Importance Plot( 1 ), Set VIP Threshold( 0.95 ) )
);
rpt = obj << report;
Close( dt2, no save );
dt2 = Open("data_table.jmp");
obj = dt2 << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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
),
Personality( "Partial Least Squares" ),
Run(
Validation Method( "Leave-One-Out" ),
Fit( SVD( Classical ), Method( NIPALS ), Variable Importance Plot( 1 ), Set VIP Threshold( 1.5 ) ),
Fit( SVD( Classical ), Method( SIMPLS ), Number of Factors( 3 ), Variable Importance Plot( 1 ), Set VIP Threshold( 0.95 ) )
)
);
rpt = obj << report;
befAA = Associative Array( Window() << get window title );
obj << (Fit[1] << Make Model Using VIP( 1 ));
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
dl1 = Window( aftlst[1] );
item1 = dl1[ListBoxBox( 7 )] << get items;
dl1 << Close Window;
befAA = Associative Array( Window() << get window title );
obj << (Fit[2] << Make Model Using VIP( 1 ));
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
dl2 = Window( aftlst[1] );
item2 = dl2[ListBoxBox( 7 )] << get items;
dl2 << Close Window;
Close( dt2, no save );
);
Code Explanation:
- Check if JMP is Pro.
- Open data table;
- Perform Partial Least Squares analysis.
- Use Leave-One-Out validation method.
- Apply two fitting methods: NIPALS and SIMPLS.
- Generate Variable Importance Plots.
- Set VIP thresholds.
- Save report.
- Close dataset without saving.
- Repeat steps 2-8 using Fit Model platform.
- Create associative array of window titles before model creation.
- Generate model using VIP for first fit.
- Create associative array of window titles after model creation.
- Remove initial windows from array.
- Get keys of remaining windows.
- Access specific window and list box.
- Retrieve items from list box.
- Close window.
- Repeat steps 11-18 for second fit.
- Close dataset without saving.
Example 34
Summary: Runs Partial Least Squares analysis with NIPALS and SIMPLS methods, generating reports and creating Variable Importance Plots for JMP Pro
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt2 = Open("data_table.jmp");
obj = dt2 << 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( "Leave-One-Out" ),
Fit( Method( NIPALS ), Variable Importance Plot( 1 ), Set VIP Threshold( 1.5 ) ),
Fit( Method( SIMPLS ), Number of Factors( 3 ), Variable Importance Plot( 1 ), Set VIP Threshold( 0.95 ) )
);
rpt = obj << report;
Close( dt2, no save );
dt2 = Open("data_table.jmp");
obj = dt2 << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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
),
Personality( "Partial Least Squares" ),
Run(
Validation Method( "Leave-One-Out" ),
Fit( Method( NIPALS ), Variable Importance Plot( 1 ), Set VIP Threshold( 1.5 ) ),
Fit( Method( SIMPLS ), Number of Factors( 3 ), Variable Importance Plot( 1 ), Set VIP Threshold( 0.95 ) )
)
);
rpt = obj << report;
befAA = Associative Array( Window() << get window title );
obj << (Fit[1] << Make Model Using VIP( 1 ));
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
dl1 = Window( aftlst[1] );
item1 = dl1[ListBoxBox( 7 )] << get items;
dl1 << Close Window;
befAA = Associative Array( Window() << get window title );
obj << (Fit[2] << Make Model Using VIP( 1 ));
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
dl2 = Window( aftlst[1] );
item2 = dl2[ListBoxBox( 7 )] << get items;
dl2 << Close Window;
Close( dt2, no save );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table.
- Perform Partial Least Squares analysis.
- Set validation method to "Leave-One-Out".
- Fit model using NIPALS method.
- Create Variable Importance Plot for NIPALS.
- Set VIP threshold to 1.5.
- Fit model using SIMPLS method.
- Create Variable Importance Plot for SIMPLS.
- Set number of factors to 3 for SIMPLS.
- Generate report from analysis.
- Close data table without saving.
- Reopen data table.
- Perform Fit Model with Partial Least Squares personality.
- Set validation method to "Leave-One-Out".
- Fit model using NIPALS method.
- Create Variable Importance Plot for NIPALS.
- Set VIP threshold to 1.5.
- Fit model using SIMPLS method.
- Create Variable Importance Plot for SIMPLS.
- Set number of factors to 3 for SIMPLS.
- Generate report from analysis.
- Store initial window titles in associative array.
- Create model using VIP for NIPALS fit.
- Store new window titles in associative array.
- Remove initial windows from associative array.
- Retrieve new window keys.
- Access first new window.
- Get items from ListBoxBox(7).
- Close first new window.
- Store initial window titles in associative array.
- Create model using VIP for SIMPLS fit.
- Store new window titles in associative array.
- Remove initial windows from associative array.
- Retrieve new window keys.
- Access second new window.
- Get items from ListBoxBox(7).
- Close second new window.
- Close data table without saving.
Example 35
Summary: Fits a Partial Least Squares model to predict weight based on height, sex, and age in a JMP Pro data table.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model(
Y( :weight ),
Effects( :height, :sex, :age ),
Standardize X( 0 ),
No Intercept,
Personality( "Partial Least Squares" ),
Run( Fit() )
)
);
obj << Close Window( 1 );
Close( dt, no save );
);
Code Explanation:
- Check if JMP is Pro.
- Open data table;
- Start logging output.
- Fit model using PLS.
- Set response variable.
- Include effects: height, sex, age.
- Do not standardize X.
- Exclude intercept.
- Use Partial Least Squares.
- Run the fit.
- Close model window.
- Close dataset without saving.
Example 36
Summary: Fits a Partial Least Squares model to predict weight based on height and sex, with no intercept and standardization.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :height, :sex ),
No Intercept,
Standardize X( 0 ),
Personality( "Partial Least Squares" ),
Run()
);
obj << Save Script to Report;
rpt = obj << report;
script1 = rpt[Outline Box( "Partial Least Squares" )][Text Box( 1 )] << get text;
Close( dt, no save );
);
Code Explanation:
- Check if JMP is Pro.
- Open data table.
- Fit model with weight as Y.
- Include height and sex as effects.
- Exclude intercept from model.
- Do not standardize predictors.
- Use Partial Least Squares personality.
- Run the model.
- Save script to report.
- Extract text from Partial Least Squares outline box.
- Close data table without saving.
Example 37
Summary: Fits a Partial Least Squares (PLS) model to a data table, generating reports and extracting text from them.
Code:
dt2 = Open("data_table.jmp");
If( Contains( JMP Product Name(), "Pro" ),
obj1 = Fit Model(
Y( :ls ),
Effects( :v1, :v2, :v3, :v4, :v5 ),
No Intercept,
Personality( "Partial Least Squares" ),
Standardize X( 0 ),
Run( Validation Method( None, Initial Number of Factors( 5 ) ), Fit( Method( NIPALS ) ), Fit( Method( SIMPLS ) ) )
);
rpt1 = obj1 << report;
obj1 << Save Script to Report;
txt1 = rpt1[Text Box( 1 )] << get text;
);
obj2 = Partial Least Squares(
Y( :ls ),
X( :v1, :v2, :v3, :v4, :v5 ),
Validation Method( None, Initial Number of Factors( 5 ) ),
Fit( Method( NIPALS ) ),
Fit( Method( SIMPLS ) )
);
rpt2 = obj2 << report;
obj2 << Save Script to Report;
txt2 = rpt2[Text Box( 1 )] << get text;
Code Explanation:
- Open data table;
- Check for JMP Pro version.
- Fit model using PLS.
- Store model report.
- Save script to report.
- Extract text from report.
- Perform PLS analysis.
- Store analysis report.
- Save script to report.
- Extract text from report.
Example 38
Summary: Fits a Partial Least Squares model to predict height based on sex, utilizing holdback validation and NIPALS fitting method.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
pls = dt << Fit Model(
Y( :height ),
Effects( :sex ),
Personality( "Partial Least Squares" ),
Impute Missing Data( 1 ),
Run( Validation Method( Holdback( 0.4 ) ), Initial Number of Factors( 2 ), Fit( Method( NIPALS ) ) )
);
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro version.
- Open data table.
- Fit Partial Least Squares model.
- Set response variable to height.
- Include sex as effect.
- Use Partial Least Squares personality.
- Enable missing data imputation.
- Run model with holdback validation.
- Set initial number of factors to 2.
- Use NIPALS fitting method.
Example 39
Summary: Fits a Partial Least Squares model to a data table, specifying response variable ls and effects v1-v6, while setting values for column v1.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt2 = Open("data_table.jmp");
dt2:v1 << Set Values( J( N Rows( dt2 ), 1, 10 ) );
obj1 = Fit Model(
Y( :ls ),
Effects( :v1, :v2, :v3, :v4, :v5, :v6 ),
Center Polynomials( 0 ),
Standardize X( 1 ),
No Intercept,
Personality( "Partial Least Squares" ),
Run()
);
rpt1 = Report( obj1 );
nfac = rpt1[Outline Box( "Model Launch" )][Number Edit Box( 2 )] << get;
Close( dt2, no save );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table;
- Set values for column v1.
- Fit a Partial Least Squares model.
- Specify response variable ls.
- Include specified effects in the model.
- Do not center polynomials.
- Standardize the predictors.
- Exclude intercept from the model.
- Retrieve the number of factors used.
Example 40
Summary: Fits a Partial Least Squares model to data, extracting the R-squared value and generating a model comparison summary.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt2 = Open("data_table.jmp");
obj = dt2 << Fit Model(
Freq( :ha ),
Y( :ls, :dt ),
Effects( :v1, :v2, :v3, :v4, :v5, :v6, :v7, :v8, :v9, :v10 ),
Center Polynomials( 0 ),
No Intercept,
Personality( "Partial Least Squares" ),
Run( Fit )
);
rpt = obj << report;
n1 = (rpt[Outline Box( "Model Comparison Summary" )][Table Box( 1 )] << get as matrix)[1, 1];
Close( dt2, no save );
);
Code Explanation:
- Check if JMP is Pro.
- Open data table;
- Fit Partial Least Squares model.
- Set frequency to :ha.
- Set response variables :ls, :dt.
- Include effects :v1 to :v10.
- Disable polynomial centering.
- Exclude intercept term.
- Retrieve model comparison summary.
- Extract R-squared value.
Example 41
Summary: Fits a Partial Least Squares (PLS) model to a data table, utilizing selected columns as effects and validating the results.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt2 = Open("data_table.jmp");
(dt2:v1)[7] = .;
dt2 << New Column( "Validation", values( [1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1] ) );
dt2 << Select Column Group( "Intensities" );
s = dt2 << Get Column Group( "Intensities" );
obj1 = dt2 << Fit Model(
Y( :ls, :ha, :dt ),
Effects( Eval( s ) ),
Validation( :Validation ),
Impute Missing Data( 1 ),
Personality( "Partial Least Squares " ),
Run( Set Random Seed( 134 ), Validation Method( KFold( 7 ) ), Fit )
);
Close( dt2, no save );
);
Code Explanation:
- Check if JMP Pro.
- Open data table;
- Set v1[7] to missing.
- Add "Validation" column.
- Select "Intensities" columns.
- Get selected columns.
- Fit model with PLS personality.
- Use selected columns as effects.
- Apply validation method.
- Close dataset without saving.
Example 42
Summary: Fits a Partial Least Squares model to a data table, selecting specific columns and generating a report.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt1 = Open("data_table.jmp");
obj1 = dt1 << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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
),
No Intercept( 1 ),
Center Polynomials( 0 ),
Personality( "Partial Least Squares" ),
Run( Initial Number of Factors( 15 ), Validation Method( KFold( 7 ), Initial Number of Factors( 15 ) ) )
);
rpt1 = obj1 << report;
s = dt1:v1 << Set Selected;
dt1 << Delete Columns();
Close( dt1, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table.
- Fit Partial Least Squares model.
- Set response variables: ls, ha, dt.
- Include all specified effects.
- Disable intercept.
- Do not center polynomials.
- Run model with 15 factors, K-Fold validation.
- Generate model report.
- Select column v1.
- Delete all columns.
- Close data table without saving.
Example 43
Summary: Fits a Partial Least Squares model to multiple response variables, utilizing K-Fold validation and publishing score formulas in JMP Pro.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt1 = Open("data_table.jmp");
obj1 = dt1 << Fit Model(
Y( :ls, :ha, :dt ),
Effects(
: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
),
No Intercept( 1 ),
Center Polynomials( 0 ),
Personality( "Partial Least Squares" ),
Run( Initial Number of Factors( 15 ), Validation Method( KFold( 7 ), Initial Number of Factors( 15 ) ), Fit )
);
rpt1 = obj1 << report;
s = Column( dt1, 12 ) << Set Selected;
dt1 << Delete Columns();
Log Capture(
obj1 << (Fit[1] << Save Score Formula( 1 ));
fd = obj1 << (Fit[1] << Publish Score Formula( 1 ));
);
Window( "Formula Depot" ) << close window( 1 );
Close( dt1, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table.
- Fit Partial Least Squares model.
- Include multiple response variables.
- Specify effects for the model.
- Exclude intercept from the model.
- Disable centering polynomials.
- Set initial number of factors to 15.
- Use K-Fold validation method.
- Save and publish score formula.
Example 44
Summary: Fits a Partial Least Squares model to a data table, validating specific columns, and capturing log output in JMP Pro.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
dt:Validation[3 :: 7] = 4;
dt:Validation[13 :: 16] = 5;
obj = Fit Model(
Y( :Y ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol ),
Validation( :Validation ),
Personality( "Partial Least Squares" ),
Run
);
log1 = Log Capture( obj << Fit );
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Set validation columns.
- Define model effects.
- Specify validation method.
- Use Partial Least Squares personality.
- Run the model fit.
- Capture log output.
- Close dataset without saving.
Example 45
Summary: Runs Partial Least Squares analysis and model fitting for a data table, generating two reports with titles extracted from outline boxes.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt1 = Open("data_table.jmp");
dt1 << New Column( "16Fold", numeric, formula( Row() ) );
obj1 = dt1 << Partial Least Squares(
Y( :ls, :ha, :dt ),
X( Column Group( "Intensities" ) ),
Validation( :"16fold"n ),
Method( SIMPLS ),
Initial Number of Factors( 15 ),
Go
);
obj2 = dt1 << Fit Model(
Y( :ls, :ha, :dt ),
Effects( Column Group( "Intensities" ) ),
Validation( :"16fold"n ),
Personality( "Partial Least Squares" ),
Run( Method( SIMPLS ), Initial Number of Factors( 15 ), Fit )
);
rpt1 = obj1 << report;
rpt2 = obj2 << report;
title1 = rpt1[Outline Box( 4 )] << get title;
title2 = rpt2[Outline Box( 4 )] << get title;
Close( dt1, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table.
- Add "16Fold" column.
- Perform Partial Least Squares analysis.
- Fit model using Partial Least Squares.
- Retrieve report from first analysis.
- Retrieve report from second analysis.
- Get title from first report outline box.
- Get title from second report outline box.
- Close data table without saving.
Example 46
Summary: Fits a Partial Least Squares model to a data table, setting specific values for v1 and retrieving maximum factors.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt2 = Open("data_table.jmp");
dt2:v1 << Set Values( J( N Rows( dt2 ), 1, 10 ) );
obj1 = Fit Model(
Y( :ls ),
Effects( :v1, :v2, :v3, :v4, :v5, :v6 ),
Center Polynomials( 0 ),
Standardize X( 1 ),
No Intercept,
Personality( "Partial Least Squares" ),
Run
);
rpt1 = obj1 << report;
maxfact = rpt1["Model Launch"][Number Edit Box( 2 )] << get;
Close( dt2, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Set v1 values to 10.
- Fit Partial Least Squares model.
- Assign model report to rpt1.
- Get max factors value.
- Close dataset without saving.
Example 47
Summary: Fits a Partial Least Squares model to a data table, selecting specific rows, and saving T Square values and prediction formulas.
Code:
If( Contains( JMP Product Name(), "Pro" ) > 0,
dt = Open("data_table.jmp");
dt << Clear Row States( 1 );
s = dt << Select Rows( 101 :: N Rows( dt ) );
s << Delete Rows;
obj = Fit Model(
Y( :LOAN ),
Effects( :MORTDUE, :REASON, :MORTDUE * :REASON ),
Impute Missing Data( 1 ),
Personality( "Partial Least Squares" ),
Run( Validation Method( "None" ), Fit() )
);
obj << (Fit[1] << Save T Square( 1 ));
obj << (Fit[1] << Save Prediction Formula( 1 ));
tsquare = dt:T² << get values;
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table.
- Clear row states.
- Select rows 101 to last.
- Delete selected rows.
- Fit model using Partial Least Squares.
- Save T Square to data table.
- Save prediction formula to data table.
- Retrieve T Square values.
- Close data table without saving.
Example 48
Summary: Fits two models with different random effects and saving prediction and interval formulas in JMP Pro.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
dt << New Column( "BMI_c", numeric, formula( :BMI - Col Mean( :BMI ) ) );
obj1 = dt << Fit Model(
Y( :Y ),
Effects( :LDL, :HDL ),
Random Effects( :BMI_c ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Run
);
obj1 << Save Columns( Prediction and Interval Formulas, Mean Confidence Interval, Indiv Confidence Interval );
obj2 = dt << Fit Model(
Y( :Y ),
Effects( :LDL, :HDL ),
Random Effects( :BMI ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Run
);
obj2 << Save Columns( Prediction and Interval Formulas, Mean Confidence Interval, Indiv Confidence Interval );
indiv ci1 = (dt:Lower 95% Mean Y << get values) || (dt:Upper 95% Mean Y << get values) || (dt:Lower 95% Mean Y 2 << get values) || (dt
:Upper 95% Mean Y 2 << get values);
indiv ci2 = (dt:Lower 95% Mean Y 3 << get values) || (dt:Upper 95% Mean Y 3 << get values) || (dt:Lower 95% Mean Y 4 << get values) ||
(dt:Upper 95% Mean Y 4 << get values);
Close( dt, no save );
);
Code Explanation:
- Check if JMP is Pro version.
- Open data table;
- Create new column BMI_c.
- Fit model with LDL, HDL as effects, BMI_c as random effect.
- Save prediction and interval formulas.
- Fit another model with LDL, HDL as effects, BMI as random effect.
- Save prediction and interval formulas.
- Extract individual confidence intervals.
- Combine confidence interval data.
- Close dataset without saving.
Example 49
Summary: Process of generating all possible models and extracting stepwise fit statistics for a given dataset, utilizing JMP Pro's modeling capabilities.
Code:
If( JMP Product Name() == "Pro",
For( nterms = 1, nterms <= 10, nterms++,
n best models = Random Integer( 10, 100 );
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Validation( :Validation ),
Y( :Y ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Stepwise" ),
Run,
SendToReport( Dispatch( {}, "Current Estimates", OutlineBox, {Close( 1 )} ) )
);
rpt = obj << report;
obj << All Possible Models( nterms, n best models );
all models stats = rpt["All Possible Models"][Table Box( 1 )] << get as matrix;
n models = N Rows( all models stats );
For( i = 1, i <= n models, i++,
rpt["All Possible Models"][Radio Box( 1 )] << set( i );
b stats = rpt["Stepwise Fit for Y"][Table Box( 2 )] << get as matrix;
);
);
Close( dt, no save );
For( nterms = 1, nterms <= 10, nterms++,
n best models = Random Integer( 10, 100 );
dt = Open("data_table.jmp");
dt << New Column( "Validation 2", nominal, formula( Random Category( 0.4, 0, 0.35, 1, 2 ) ) );
obj = dt << Fit Model(
Validation( :Validation 2 ),
Y( :Y ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Stepwise" ),
Run,
SendToReport( Dispatch( {}, "Current Estimates", OutlineBox, {Close( 1 )} ) )
);
rpt = obj << report;
obj << All Possible Models( nterms, n best models );
all models stats = rpt["All Possible Models"][Table Box( 1 )] << get as matrix;
n models = N Rows( all models stats );
For( i = 1, i <= n models, i++,
rpt["All Possible Models"][Radio Box( 1 )] << set( i );
b stats = rpt["Stepwise Fit for Y"][Table Box( 2 )] << get as matrix;
);
);
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro.
- Loop from 1 to 10 terms.
- Generate random number of models.
- Open data table;
- Fit model with validation.
- Specify response variable Y.
- Include all effects.
- Use Stepwise personality.
- Run the model.
- Close Current Estimates box.
- Get model report.
- Generate all possible models.
- Extract all models statistics.
- Loop through each model.
- Set current model.
- Extract stepwise fit statistics.
- Close dataset without saving.
- Repeat steps 3-17 with new validation column.
- Close dataset without saving.
Example 50
Summary: Fits a Nominal Logistic model to a data table, generating a confusion matrix and saving probability formulas for comparison.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Freq( :count ),
Target Level( "m" ),
Y( :brand ),
Effects(
:softness, :previous use, :softness * :previous use, :temperature, :softness * :temperature, :previous use * :temperature,
:softness * :previous use * :temperature
),
Personality( "Nominal Logistic" ),
Run( Confusion Matrix( 1 ), Save Probability Formula( 1 ) )
);
rpt1 = Report( obj );
obj2 = Model Comparison( Freq( :count ), Confusion Matrix( 1 ) );
rpt2 = Report( obj2 );
b confmat1 = rpt1[Outline Box( "Confusion Matrix" )][Table Box( 1 )] << get as matrix;
confmat1 = rpt2[Outline Box( "Confusion Matrix" )][Table Box( 1 )] << get as matrix;
b confmat2 = b confmat1 :/ Shape( V Sum( b confmat1` ), 2, 2 )`;
confmat2 = rpt2[Outline Box( "Confusion Matrix" )][Table Box( 2 )] << get as matrix;
confmat1_from = rpt2[Outline Box( "Confusion Matrix" )][Outline Box( "Predictor Fit Nominal Logistic" )][Col Span Box( 1 )] <<
get heading;
confmat1_to = rpt2[Outline Box( "Confusion Matrix" )][Outline Box( "Predictor Fit Nominal Logistic" )][Col Span Box( 2 )] <<
get heading;
confmat2_from = rpt2[Outline Box( "Confusion Matrix" )][Outline Box( "Predictor Fit Nominal Logistic" )][Col Span Box( 3 )] <<
get heading;
confmat2_to = rpt2[Outline Box( "Confusion Matrix" )][Outline Box( "Predictor Fit Nominal Logistic" )][Col Span Box( 4 )] <<
get heading;
col1_from = Char( Parse( rpt2[Outline Box( "Predictor Fit Nominal Logistic" )][Col Span Box( 1 )][String Col Box( 1 )] << get text ) );
col2_from = Char( Parse( rpt2[Outline Box( "Predictor Fit Nominal Logistic" )][Col Span Box( 3 )][String Col Box( 1 )] << get text ) );
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro is installed.
- Open data table;
- Fit Nominal Logistic model.
- Set frequency column.
- Define target level.
- Specify response variable.
- List model effects.
- Generate confusion matrix.
- Save probability formula.
- Compare models.
Example 51
Summary: Runs neural network analysis and logistic modeling to predict food product classification, utilizing JMP Pro's Neural platform and Fit Model features.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
nn = dt << Neural(
Y( :Calories, :Calories fr Fat ),
X( :Mfr, :Protein, :Fat, :Sodium, :Fiber Gr ),
Missing Value Coding( 0 ),
Validation Method( Holdback, 0.3333 ),
Fit( NTanH( 3 ) ),
Set Random Seed( 3000 )
);
nn << Save Validation;
nn << Close window;
fmnlogi = dt << Fit Model(
Y( :Name( "Hot/Cold" ) ),
Effects( :Calories, :Fiber, Sugars ),
Validation( :Validation ),
freq( :protein ),
Personality( Nominal Logistic ),
invisible,
Run()
);
fmnlogi << ROC Curve( 1 );
fmnlogi << Save Probability Formula;
rpt1 = fmnlogi << report;
mc2 = dt << Model Comparison(
Y( :Name( "Prob[C]" ), :Name( "Prob[H]" ) ),
freq( :protein ),
Group( :Validation ),
AUC Comparison( 1 )
);
rpt2 = mc2 << report;
stat1 = ((rpt1[Outline Box( "Fit Details" )][Table Box( 1 )][Number Col Box( 1 )] << get as matrix) | (rpt1[
Outline Box( "Fit Details" )][Table Box( 1 )][Number Col Box( 2 )] << get as matrix)) || ((rpt1[Outline Box( "Fit Details" )][
Table Box( 1 )][Number Col Box( 3 )] << get as matrix) | (rpt1[Outline Box( "Fit Details" )][Table Box( 1 )][Number Col Box( 4 )] <<
get as matrix));
stat2 = rpt2[Outline Box( "Measures of Fit for Hot/Cold" )][Table Box( 1 )] << get as matrix;
roc1 train = (rpt1[Outline Box( "Receiver Operating Characteristic on Training Data" )][Number Col Box( 1 )] << get as matrix)[1];
roc1 validation = (rpt1[Outline Box( "Receiver Operating Characteristic on Validation Data" )][Number Col Box( 1 )] << get as matrix)[1
];
roc2 train = Try(
(rpt2[Outline Box( "AUC Comparison for Hot/Cold=H for Validation=Training" )][Number Col Box( 1 )] << get as matrix)[1]
);
roc2 validation = Try(
(rpt2[Outline Box( "AUC Comparison for Hot/Cold=H for Validation=Validation" )][Number Col Box( 1 )] << get as matrix)[1]
);
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data table;
- Run neural network analysis.
- Save validation results.
- Close neural network window.
- Fit logistic model.
- Generate ROC curve.
- Save probability formula.
- Extract fit details.
- Compare models.
Example 52
Summary: Fits a model to predict sex based on age and height, with model comparison and probability formula saving for males.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :sex ), Effects( :age, :height ), Run );
obj1 << Save Probability Formula( 1 );
dt << Model Comparison( Model Averaging( 1 ) );
prop1 = dt:sex F Avg Predictor << Get Property( Response Probability );
prop2 = dt:sex M Avg Predictor << Get Property( Response Probability );
Close( dt, no save );
);
Code Explanation:
- Check for JMP Pro.
- Open data_table data
- Fit model with sex as response.
- Include age and height as effects.
- Run the model.
- Save probability formula for males.
- Perform model comparison.
- Average model predictors.
- Retrieve female response probability.
- Retrieve male response probability.
- Close data table without saving.
Example 53
Summary: Fits a linear model, retrieving reports, and comparing models in JMP Pro.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj1 = dt << Fit Model( Y( :MORTDUE ), Effects( :VALUE ), Personality( Standard Least Squares ), Emphasis( Minimal Report ), Run() );
rpt1 = Report( obj1 );
obj1 << Prediction Formula( 1 );
rsquare1 = (rpt1[Outline Box( "Summary of Fit" )][Table Box( 1 )] << Get as matrix)[1];
obj2 = dt << Model Comparison();
rpt2 = Report( obj2 );
rsquare2 = (rpt2[Outline Box( "Measures of Fit for MORTDUE" )][Table Box( 1 )] << get as matrix)[1];
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro.
- Open data_table data
- Fit linear model.
- Retrieve report object.
- Add prediction formula.
- Extract R-square value.
- Perform model comparison.
- Retrieve comparison report.
- Extract R-square from comparison.
- Close data without saving.
Example 54
Summary: Fits a Partial Least Squares model to a data table, validating its performance, and extracting fit measures in JMP Pro.
Code:
If( Contains( JMP Product Name(), "Pro" ),
dt = Open("data_table.jmp");
obj = Fit Model(
Validation( :Validation ),
Y( :Y ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
No Intercept( 1 ),
Center Polynomials( 0 ),
Personality( "Partial Least Squares" ),
Run( Initial Number of Factors( 11 ), Fit( Method( NIPALS ) ) ),
);
test1 = obj << (Fit[1] << get measures( 1 ));
obj << (Fit[1] << save prediction formula( 1 ));
rpt = obj << report;
obj2 = Model Comparison( Group( :Validation ) );
rpt2 = obj2 << report;
test2 = rpt2["Measures of Fit for Y"][Table Box( 1 )] << get as matrix;
Close( dt, no save );
);
Code Explanation:
- Check if JMP Pro.
- Open data table;
- Fit Partial Least Squares model.
- Set validation column.
- Specify response variable.
- Define effects variables.
- Exclude intercept term.
- Disable polynomial centering.
- Run model with NIPALS method.
- Save prediction formula.
- Retrieve model report.
- Compare models by validation.
- Extract fit measures matrix.
- Close dataset without saving.
Example 55
Summary: Runs the fitting and profiling of various models, including Partial Least Squares (PLS) and nonlinear regression, with customizable settings for validation methods and initial number of factors.
Code:
dt2 = Open("data_table.jmp");
If( JMP Product Name() == "Pro",
obj = dt2 << Fit Model(
Y( :ls, :ha, :dt ),
Effects( :v1, :v2, :v3, :v4, :v5, :v6, :v7, :v8, :v9, :v10 ),
No Intercept,
Personality( "Partial Least Squares" ),
Impute Missing Data( 1 ),
Run( Validation Method( KFold( 7 ), Initial Number of Factors( 15 ) ), Fit( Method( NIPALS ) ) )
),
obj = dt2 << Partial Least Squares(
Y( :ls, :ha, :dt ),
X( :v1, :v2, :v3, :v4, :v5, :v6, :v7, :v8, :v9, :v10 ),
Validation Method( Name( "Leave-One-Out" ), Initial Number of Factors( 10 ) ),
Fit( Method( SIMPLS ) )
)
);
rpt = obj << report;
obj << (Fit[1] << Spectral Profiler( 1 ));
r = rpt[Outline Box( "Spectral Profiler" )] << get scriptable object;
r << Independent Uniform Inputs;
r << Independent Resampled Inputs;
r << Dependent Resampled Inputs;
Close( dt2, No Save );
dt = Open("data_table.jmp");
obj = dt << Nonlinear( Y( :pop ), X( :Name( "X-formula" ) ), Go );
obj << Parameter Profiler( 1, Independent Uniform Inputs( 1 ), Independent Resampled Inputs( 1 ), Dependent Resampled Inputs( 1 ) );
Close( dt, No Save );
dt = Open("data_table.jmp");
obj = dt << Run Script( "Fit Parametric Survival" );
obj << Distribution Profiler( 1, Independent Uniform Inputs( 1 ), Independent Resampled Inputs( 1 ), Dependent Resampled Inputs( 1 ) );
Code Explanation:
- Open data table.
- Check if JMP version is Pro.
- If Pro, fit PLS model with specified settings.
- If not Pro, fit PLS model with different settings.
- Generate Spectral Profiler report.
- Configure profiler inputs.
- Close data_table.jmp without saving.
- Open data table.
- Fit nonlinear model.
- Generate Parameter Profiler report.
- Configure profiler inputs.
- Close data_table.jmp without saving.
- Open data table.
- Run Fit Parametric Survival script.
- Generate Distribution Profiler report.
- Configure profiler inputs.
Example 56
Summary: Fits a mixed model with specified effects and random effects, generating a summary report as a matrix.
Code:
If( JMP Product Name() == "Pro",
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Center Polynomials( 0 ),
Personality( Mixed Model ),
Run(
Repeated Effects Covariance Parameter Estimates( 0 ),
Profiler(
1,
Confidence Intervals( 1 ),
Independent Uniform Inputs( 1 ),
Reorder X Variables( :species, :season, :subject ),
Term Value( species( "COYOTE", Lock( 0 ), Show( 1 ) ), season( "fall", Lock( 0 ), Show( 1 ) ) )
)
)
);
rpt = obj << report;
sumRpt = rpt[Outline Box( "Summary Report" )][Table Box( 1 )] << get as matrix;
Close( dt, No Save );
);
Code Explanation:
- Check if JMP Product Name is Pro.
- Open data table;
- Fit mixed model with specified effects.
- Configure random effects.
- Disable centering of polynomials.
- Run model with profiler settings.
- Suppress repeated effects covariance estimates.
- Enable confidence intervals in profiler.
- Set independent uniform inputs.
- Reorder X variables in profiler.
- Lock and show specific term values.
- Extract summary report as matrix.
- Close dataset without saving.
Example 57
Summary: Analyze and extract intraclass correlation (ICC) estimates from a data table, utilizing OneWay analysis and report generation in JMP.
Code:
If( Num( Left( JMP Version(), 4 ) ) >= 20,
isPro = (Substr( Build Information(), -3 ) == "Pro");
dt = Open("data_table.jmp");
obj1 = dt << Oneway( Y( :Y ), X( :Soil ), Block( :Block ), intraclass correlation( 1 ) );
rpt1 = Report( obj1 );
ICCact = (rpt1["Intraclass Correlation", Number Col Box( "Estimate" )] << Get As Matrix);
ICCstderract = (rpt1["Intraclass Correlation", Number Col Box( "Std Error" )] << Get As Matrix);
ICCLoweract = (rpt1["Intraclass Correlation", Number Col Box( "95% Lower" )] << Get As Matrix);
ICCUpperact = (rpt1["Intraclass Correlation", Number Col Box( "95% Upper" )] << Get As Matrix);
ICCExp = [0.507769322528345, 8.52968255480063];
IccStdErrExp = [0.228206969849747, 3.47360962874902];
ICCLowerExp = [0.0604918806018222, 4.392073299774];
ICCUpperExp = [0.955046764454867, 23.1708460839664];
If( isPro == 1,
obj2 = dt << Fit Model(
Y( :Y ),
Effects,
Personality( "Mixed Model" ),
Subject( :Soil ),
Repeated Effects( :Block ),
Repeated Structure( "Compound Symmetry" ),
Run( Random Effects Covariance Parameter Estimates( 0 ) )
);
rpt2 = Report( obj2 );
ICCact = (rpt2["Repeated Effects Covariance Parameter Estimates", Number Col Box( "Estimate" )] << Get As Matrix);
ICCstderract = (rpt2["Repeated Effects Covariance Parameter Estimates", Number Col Box( "Std Error" )] << Get As Matrix);
ICCLoweract = (rpt2["Repeated Effects Covariance Parameter Estimates", Number Col Box( "95% Lower" )] << Get As Matrix);
ICCUpperact = (rpt2["Repeated Effects Covariance Parameter Estimates", Number Col Box( "95% Upper" )] << Get As Matrix);
,
donnothing = 1;
);
Close( dt, nosave );
,
donnothing = 1;
);
Code Explanation:
- Check JMP version.
- Determine if Pro version.
- Open data table.
- Perform OneWay analysis.
- Extract Intraclass Correlation report.
- Retrieve ICC estimate.
- Retrieve ICC standard error.
- Retrieve ICC lower bound.
- Retrieve ICC upper bound.
- Close data table without saving.
Fit Model using Get Preferences
Summary: Fits a linear model to predict weight based on age, sex, and height, while generating a minimal report with expanded estimates and prediction expression.
Code:
pref1 = Get Preferences( Default Field Width );
Preferences( Default Field Width( 8 ) );
dt = Open("data_table.jmp");
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( :weight << {Expanded Estimates( 1 ), Show Prediction Expression( 1 )} ),
SendToReport(
Dispatch( {"Response weight"}, "Effect Summary", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Lack Of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Summary of Fit", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Analysis of Variance", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Parameter Estimates", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight"}, "Effect Tests", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response weight", "Expanded Estimates"}, "Estimate", NumberColBox, {Set Format( "Best", 12 )} )
)
);
Eval( pref1 );
Code Explanation:
- Save default field width.
- Set new field width.
- Open data table;
- Fit linear model on weight.
- Include age, sex, height as effects.
- Use standard least squares personality.
- Generate minimal report.
- Show expanded estimates and prediction expression.
- Close effect summary, lack of fit, summary of fit, analysis of variance, parameter estimates, effect tests.
- Set estimate format to best with 12 digits.
- Restore default field width.
Fit Model using New Window
Example 1
Summary: Fits nominal logistic models for Date and Time responses, considering Abrasion and Shift effects, with detailed profiling and testing.
Code:
Open("data_table.jmp");
New Window( "data_table - Fit Nominal Logistic",
V List Box(
Fit Model(
Y( :Date ),
Effects( :Abrasion, :Shift ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler( 1, Term Value( Abrasion( 139.6, Lock( 0 ), Show( 1 ) ), Shift( "A", Lock( 0 ), Show( 1 ) ) ) )
)
),
Fit Model(
Y( :Time ),
Effects( :Abrasion, :Shift ),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler( 1, Term Value( Abrasion( 139.6, Lock( 0 ), Show( 1 ) ), Shift( "A", Lock( 0 ), Show( 1 ) ) ) )
)
)
)
);
Code Explanation:
- Open data table;
- Create new window titled "Abrasion - Fit Nominal Logistic".
- Add vertical list box to window.
- Fit model for Date response.
- Set response variable to Date.
- Include Abrasion and Shift as effects.
- Use Nominal Logistic personality.
- Run model with specified tests and profiler.
- Perform Likelihood Ratio Tests.
- Disable Wald Tests.
- Enable Profiler with specific term values and settings.
- Fit model for Time response.
- Set response variable to Time.
- Include Abrasion and Shift as effects.
- Use Nominal Logistic personality.
- Run model with specified tests and profiler.
- Perform Likelihood Ratio Tests.
- Disable Wald Tests.
- Enable Profiler with specific term values and settings.
Example 2
Summary: Runs a multiple correspondence analysis with supplementary rows for subject and gender, generating detailed coordinates and scaling for the first three dimensions.
Code:
dt = Open("data_table.jmp");
New Window( "test",
Outline Box( "Title1",
testPlat = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] & Random ),
Personality( Standard Least Squares ),
Method( REML ),
Emphasis( Minimal Report ),
Run(
:miles << {Analysis of Variance( 0 ), Lack of Fit( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )}
),
SendToReport( Dispatch( {}, "Response miles", OutlineBox, {Set Title( "Custom" )} ) )
)
)
);
testRedo = Report( testPlat << Redo Analysis );
Code Explanation:
- Open data table;
- Create new window titled "test".
- Add Outline Box named "Title1".
- Fit model with miles as response.
- Include species, season, and interaction effects.
- Specify random effects for subject within species.
- Use Standard Least Squares personality.
- Employ REML method.
- Minimize report emphasis.
- Redo analysis and store report.
Fit Model using Item Analysis
Summary: Analyze and visualize relationships between ABRASION, MODULUS, and ELONG responses using item analysis and a linear model with effect screening.
Code:
dt = Open("data_table.jmp");
obj = Item Analysis( Y( :Q1, :Q2, :Q3, :Q4, :Q5, :Q6, :Q7, :Q8, :Q9 ) );
dt = Open("data_table.jmp");
Fit Model(
Y( :ABRASION, :MODULUS, :ELONG ),
Effects(
:SILICA & RS, :SILANE & RS, :SULFUR & RS, :SILICA * :SILICA, :SILANE * :SILICA, :SILANE * :SILANE, :SULFUR * :SILICA,
:SULFUR * :SILANE, :SULFUR * :SULFUR
),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run( :ABRASION << {Scaled Estimates( 1 )}, :MODULUS << {Scaled Estimates( 1 )}, ),
SendToReport(
Dispatch( {"Response ABRASION"}, "Actual by Predicted Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response ABRASION"}, "Residual by Predicted Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response ABRASION"}, "Studentized Residuals", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response MODULUS"}, "Actual by Predicted Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response MODULUS"}, "Residual by Predicted Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response MODULUS"}, "Studentized Residuals", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response ELONG"}, "Actual by Predicted Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response ELONG"}, "Residual by Predicted Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {"Response ELONG"}, "Studentized Residuals", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Perform item analysis on Q1-Q9.
- Open data table;
- Fit model for ABRASION, MODULUS, ELONG.
- Define effects for silica, silane, sulfur.
- Set personality to Standard Least Squares.
- Emphasize effect screening.
- Enable scaled estimates for ABRASION and MODULUS.
- Close plots for ABRASION.
- Close plots for MODULUS and ELONG.
Fit Model using New Web Report
Example 1
Summary: Creates and configures a fit model report in JMP, including plotting actual vs. predicted values, residuals, and effect leverage.
Code:
Open("data_table.jmp");
webrpt = New Web Report();
webrpt << Add Report(
Report(
Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Run( :weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )} ),
)
)
);
rptPath = webrpt << Save( "$TEMP" );
If(
Host is( "Windows" ), folderPath = Substr( rptPath, 1, Length( Convert File Path( "$TEMP" ) ) + 35 ),
Host is( "Mac" ), folderPath = Substr( rptPath, 1, Length( Convert File Path( "$TEMP" ) ) + 36 )
);
Delete Directory( folderPath );
Code Explanation:
- Open data table.
- Create new web report.
- Add fit model report.
- Set response variable.
- Define effects variables.
- Choose regression personality.
- Run model with plots.
- Save web report to temp.
- Determine host operating system.
- Delete temporary directory.
Example 2
Summary: Creates and configures a fit model report in JMP, including specifying response and effect variables, choosing a standard least squares method, and customizing plot options.
Code:
dt = Open("data_table.jmp");
webrpt = New Web Report();
webrpt << Add Report(
Report(
Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Run( :weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )} ),
)
)
);
dirPath = "$TEMP\TempReports";
rptPath = webrpt << Save( dirPath );
Close( dt, NoSave );
webrpt << Reset();
Code Explanation:
- Open data table.
- Create new web report.
- Add fit model report.
- Set response variable.
- Specify effect variables.
- Choose standard least squares.
- Configure plot options.
- Save web report.
- Close data table.
- Reset web report.
Example 3
Summary: Creates and configures a web report to visualize the relationship between weight, age, sex, and height using standard least squares regression.
Code:
dt = Open("data_table.jmp");
webrpt = New Web Report();
webrpt << Add Report(
Report(
Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( Standard Least Squares ),
Run( :weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )} ),
)
)
);
dirPath = "$TEMP\TempReports";
rptPath = webrpt << Save( dirPath );
Code Explanation:
- Open data table.
- Create new web report.
- Add report to web report.
- Fit model with specified effects.
- Set personality to standard least squares.
- Run model with specified plots.
- Save actual by predicted plot.
- Save residual by predicted plot.
- Save effect leverage plot.
- Save web report to directory.
Fit Model using Format
Summary: Fits two models to a data table, generating reports for each model, and profiling the fit group.
Code:
dt = Open("data_table.jmp");
dt:Runtime << set values(
[8.17, 8.63, 8.65, ., 8.95, 9.22, 9.4, ., 9.93, 10, 10.07, 10.08, 10.13, 10.25, 10.33, 10.47, 10.5, 10.6, 10.85, 10.95, 11.08, ., 11.17,
11.37, 11.5, 11.63, 11.95, 12.63, 12.88, 13.08, 14.03]
);
dt:RunPulse << set values(
[., 170, 156, 146, 180, 178, ., ., ., 162, 185, 168, 168, 162, 166, 186, 170, 162, 162, 168, ., 176, 156, ., 170, 176, 176, 174, 168,
174, .]
);
dt:RunPulse << Format( Fixed, 6, 2 );
obj = dt << Fit Model(
Y( :Runtime, :RunPulse ),
Effects( :Age, :Weight, :Sex ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Fit Separately )
);
rpt = Current Report();
(rpt["Fit Group"] << get scriptable object) << Profiler( 1 );
rpt1 = obj[1] << report;
rpt2 = obj[2] << report;
obj1 = dt << Fit Model(
Y( :Runtime ),
Effects( :Age, :Weight, :Sex ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run()
);
obj1 << Profiler( 1 );
rpt1 = Report( obj1 );
obj2 = dt << Fit Model(
Y( :RunPulse ),
Effects( :Age, :Weight, :Sex ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run()
);
obj2 << Profiler( 2 );
rpt2 = Report( obj2 );
Code Explanation:
- Open data table.
- Set Runtime column values.
- Set RunPulse column values.
- Format RunPulse column.
- Fit model for Runtime and RunPulse.
- Get current report.
- Enable Profiler for Fit Group.
- Create report for Runtime fit.
- Create report for RunPulse fit.
- Fit model for Runtime.
- Enable Profiler for Runtime fit.
- Create report for Runtime fit.
- Fit model for RunPulse.
- Enable Profiler for RunPulse fit.
- Create report for RunPulse fit.
Fit Model using Set Property
Example 1
Summary: Fits a nominal logistic model to analyze the relationship between softness, previous use, and temperature on brand count, while also generating a report object with saved probability formulas.
Code:
dt = Open("data_table.jmp");
dt:softness << Set Property( Value Ordering, {med, soft, hard} );
obj = dt << Fit Model(
Freq( :count ),
Y( :brand ),
Target Level( "m" ),
Effects( :softness, :previous use, :temperature ),
Personality( "Nominal Logistic" ),
Run Model( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ), Confidence Intervals( 0.05 ), Odds Ratios( 1 ), )
);
obj << Save Probability Formula;
rpt = Report( obj );
saved prob = (dt << get as matrix)[0, 2 :: 4];
Code Explanation:
- Open data table.
- Set value ordering for softness.
- Fit nominal logistic model.
- Specify frequency column.
- Set response variable.
- Define target level.
- Include effects variables.
- Choose nominal logistic personality.
- Run model with specified tests.
- Save probability formula.
- Generate report object.
- Extract saved probabilities.
Example 2
Summary: Analyze a data table by fitting a model with specified effects, generating prediction formulas, and calculating predicted values.
Code:
dt = Open("data_table.jmp");
dt:Time[4] = .;
dt:Time[7] = .;
dt:Time << Set Property( "Coding", {2, 5} );
obj = Fit Model(
Y( :Number Popped ),
Effects( :Brand, :Time, :Power, :Brand * :Time, :Brand * :Power, :Time * :Power, :Time * :Time, :Power * :Power ),
Informative Missing( 1 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run()
);
obj << Prediction Formula;
obj << Predicted Values;
pred1 = dt:Pred Formula Number Popped << get values;
pred2 = dt:Predicted Number Popped << get values;
Code Explanation:
- Open table.
- Remove missing Time values.
- Set coding for Time.
- Fit model with specified effects.
- Enable informative missing data.
- Use standard least squares personality.
- Minimal report emphasis.
- Run the model.
- Generate prediction formula.
- Calculate predicted values.
Example 3
Summary: Analyze mean profit by product line and quarter from the Profit by Product dataset using Graph Builder, fitting a nominal logistic model with specified profit matrix.
Code:
dt = Open("data_table.jmp");
dt:sex << Set Property( "Profit Matrix", {[0 - 1, -1.5 0, . .], {"F", "M", "Undecided"}} );
obj1 = Fit Model( Y( :sex ), Target Level( "F" ), Effects( :weight, :height ), Personality( "Nominal Logistic" ), Run );
obj1 << Save Probability Formula( 1 );
values1 = (dt << get as matrix)[0, 4 :: 10];
dt:sex << Delete Property( "Profit Matrix" );
obj2 = Fit Model(
Y( :sex ),
Target Level( "F" ),
Effects( :weight, :height ),
Personality( "Nominal Logistic" ),
Run( Specify Profit Matrix( [0 -1, -1.5 0, . .], "F", "M", "Undecided" ) )
);
obj2 << Save Probability Formula( 1 );
values2 = (dt << get as matrix)[0, 11 :: 17];
Close( dt, no save );
b saved exp = [14.441741822, 14.441741822, 14.441741822, 14.441741822, 14.441741822, 14.28721429, 14.28721429, 14.28721429, 14.441741822,
14.441741822, 14.441741822, 14.28721429, 14.28721429, 14.28721429, 14.28721429, 14.441741822, 14.441741822, 14.441741822, 14.441741822,
14.441741822, 14.28721429, 14.28721429, 14.28721429, 14.28721429, 14.28721429, 14.28721429, 14.28721429, 14.441741822, 14.441741822,
14.28721429, 14.28721429, 14.28721429, 14.28721429, 14.28721429, 14.441741822, 14.441741822, 14.28721429, 14.441741822, 14.28721429,
14.28721429];
Code Explanation:
- Open data table;
- Set profit matrix for sex.
- Fit nominal logistic model.
- Save probability formula.
- Extract model values.
- Remove profit matrix property.
- Fit nominal logistic model again.
- Specify profit matrix during fit.
- Save probability formula.
- Extract model values.
Example 4
Summary: Fits and saves two nominal logistic models with specified profit matrices, extracting matrix values for further analysis.
Code:
dt = Open("data_table.jmp");
dt:sex << Set Property( "Profit Matrix", {[0 - 1, -1.5 0, . .], {"F", "M", "Undecided"}} );
obj1 = Fit Model( Y( :sex ), Target Level( "F" ), Effects( :weight, :height ), Personality( "Nominal Logistic" ), Run );
obj1 << Save Probability Formula( 1 );
values1 = (dt << get as matrix)[0, 4 :: 10];
dt:sex << Delete Property( "Profit Matrix" );
obj2 = Fit Model(
Y( :sex ),
Target Level( "F" ),
Effects( :weight, :height ),
Personality( "Nominal Logistic" ),
Run( Specify Profit Matrix( [0 -1, -1.5 0, . .], "F", "M", "Undecided" ) )
);
obj2 << Save Probability Formula( 1 );
values2 = (dt << get as matrix)[0, 11 :: 17];
Code Explanation:
- Open data table.
- Set profit matrix property.
- Fit nominal logistic model.
- Save probability formula.
- Extract matrix values.
- Delete profit matrix property.
- Fit another nominal logistic model.
- Specify profit matrix.
- Save probability formula again.
- Extract new matrix values.
Example 5
Summary: Analyze ordinal logistic model for predicting Y Ordinal, utilizing Fit Model and report features to extract unit odds ratios, parameter estimates, and range odds ratios.
Code:
dt = Open("data_table.jmp");
dt:Y Ordinal << Set Property( "Value Order", {Custom Order( {"High", "Low", "Medium"} )} );
obj = dt << Fit Model(
Y( :Y Ordinal ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Ordinal Logistic" ),
Run( Odds Ratios( 1 ) )
);
rpt = obj << report;
unit OR = rpt["Unit Odds Ratios"][Table Box( 1 )] << get as matrix;
OR = rpt["Odds Ratios for Gender"][Table Box( 1 )] << get as matrix;
range = V Concat(
Col Max( dt:Age ) - Col Min( dt:Age ),
Col Max( dt:BMI ) - Col Min( dt:BMI ),
Col Max( dt:BP ) - Col Min( dt:BP ),
Col Max( dt:Total Cholesterol ) - Col Min( dt:Total Cholesterol ),
Col Max( dt:LDL ) - Col Min( dt:LDL ),
Col Max( dt:HDL ) - Col Min( dt:HDL ),
Col Max( dt:TCH ) - Col Min( dt:TCH ),
Col Max( dt:LTG ) - Col Min( dt:LTG ),
Col Max( dt:Glucose ) - Col Min( dt:Glucose )
);
parmest1 = rpt["Parameter Estimates"][Table Box( 1 )] << get as matrix;
parmest2 = parmest1[3, 0] |/ parmest1[5 :: 12, 0];
b range OR = Exp( parmest2[0, 1] :* range );
range OR = rpt["Range Odds Ratios"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Set custom value order for Y.
- Fit ordinal logistic model.
- Run odds ratios.
- Get unit odds ratios.
- Get odds ratios for gender.
- Calculate variable ranges.
- Get parameter estimates.
- Extract relevant parameters.
- Calculate range odds ratios.
Fit Model using Neural
Summary: Generates a neural network analysis to predict log life in the Weld-Repaired Castings dataset, including model comparison and residual plotting, with interactive filtering capabilities.
Code:
dt = Open("data_table.jmp");
nn = dt << Neural(
Y( :Calories, :Calories fr Fat ),
X( :Mfr, :Protein, :Fat, :Sodium, :Fiber Gr ),
Missing Value Coding( 0 ),
Validation Method( Holdback, 0.3333 ),
Fit( NTanH( 3 ) ),
Set Random Seed( 5000 ),
invisible
);
nn << Save Profile Formulas;
nn << Save Validation;
fmnlogi = dt << Fit Model(
Y( :Name( "Hot/Cold" ) ),
Effects( :Mfr, :Protein, :Fat, :Sodium, :Fiber Gr ),
Validation( :Validation ),
Personality( Nominal Logistic ),
Run(),
invisible
);
fmnlogi << Save Probability Formula;
obj = dt << Model Comparison( Group( :Validation ) );
obj << Plot Actual by Predicted;
obj << Plot Residual by Row;
obj << Local Data Filter(
Location( {0, 0} ),
Add Filter( columns( :Sugars ), Where( :Sugars >= 6 & :Sugars <= 10 ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
obj << Automatic Recalc( 0 );
dt << Select Where( :Mfr == "N" );
dt << Exclude();
rpt = obj << Report;
actN = rpt[Outline Box( "Measures of Fit for Calories" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Perform neural network analysis.
- Set output invisible.
- Save profile formulas.
- Save validation results.
- Fit nominal logistic model.
- Set output invisible.
- Save probability formula.
- Compare models by validation.
- Plot actual vs predicted.
- Plot residual vs row.
- Add local data filter.
- Disable automatic recalculation.
- Exclude rows where Mfr is "N".
- Generate report.
- Extract fit measures matrix.
Fit Model using Local
Example 1
Summary: Fits a model to predict height based on weight and age, with emphasis on effect leverage, and generates predicted values.
Code:
dt2 = Open("data_table.jmp");
Local( {obj},
obj = dt2 << Fit Model(
Y( :height ),
Effects( :weight, :age ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:height << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ), Plot Effect Leverage( 1 ),
Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )}
),
Where( :sex == "F" )
);
obj << Predicted Values;
obj << Close Window;
);
vals3 = :Predicted height << Get as matrix;
Code Explanation:
- Open data table.
- Fit model to height.
- Use weight and age as effects.
- Set personality to Standard Least Squares.
- Emphasize effect leverage.
- Run summary of fit.
- Run analysis of variance.
- Run parameter estimates.
- Generate predicted values.
- Close window.
Example 2
Summary: Fits a Manova model to a data table, generating canonical scores for contrast response and retrieving column names.
Code:
dt2 = Open("data_table.jmp");
Local( {obj},
obj = Data Table("data_table") << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
Effects( :drug, :dep1, :drug * :dep1 ),
Personality( "Manova" ),
Run( Response Function( "Contrast" ), Response Function( "Sum" ) )
);
obj << (Response["Contrast"] << (Effect["Whole Model"] << Save Canonical Scores));
obj << Close Window;
);
cols2 = dt2 << get column names();
Code Explanation:
- Open data table;
- Create local variable
obj. - Fit model using Manova personality.
- Set response variables.
- Define effects: drug, dep1, interaction.
- Run model with Contrast and Sum response functions.
- Save canonical scores for Contrast response.
- Close model window.
- Retrieve column names from dataset.
- Assign column names to
cols2.
Fit Model using Run Script
Example 1
Summary: Analyze and visualize a virtual join script, fitting a nominal logistic model to predict customer ratings based on age and gender, and generating a report with frequency outline and table box data.
Code:
dt3 = Open("data_table.jmp");
obj = dt3 << Run Script( " Distribution: Virtual Join - Age and Rating" );
rep = obj << Report;
freq = rep[Outline Box( 6 )] << Get Title;
quant = rep[Table Box( 1 )] << make into data table;
Close( quant, nosave );
obj2 = dt3 << Fit Model(
Y( Referenced Column( "Rating[ItemNo]", Reference( Column( :Item Number ), Reference( Column( :Rating ) ) ) ) ),
Effects(
Referenced Column( "Age[CustID]", Reference( Column( :Customer ID ), Reference( Column( :Age ) ) ) ),
Referenced Column( "Gender[CustID]", Reference( Column( :Customer ID ), Reference( Column( :Gender ) ) ) )
),
Personality( "Nominal Logistic" ),
Run(
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Profiler(
1,
Term Value( Name( "Age[CustID]" )(52.12, Lock( 0 ), Show( 1 )), Name( "Gender[CustID]" )("F", Lock( 0 ), Show( 1 )) )
)
),
SendToReport(
Dispatch( {"Prediction Profiler"}, "Profiler", FrameBox, {Frame Size( 120, 105 )} ),
Dispatch( {"Prediction Profiler"}, "Profiler", FrameBox( 3 ), {Frame Size( 120, 105 )} )
)
);
rpt = obj2 << report;
est = rpt["Effect Summary"][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Run virtual join script.
- Extract report object.
- Get frequency outline title.
- Convert table box to data table.
- Close temporary data table.
- Fit nominal logistic model.
- Set likelihood ratio tests.
- Disable Wald tests.
- Configure profiler settings.
Example 2
Summary: Fits a model, configuring multiple comparisons for age, and deleting a selected column in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Run Script( "Fit Model" );
dt:weight << Set Selected;
dt << Delete Column;
obj << Multiple Comparisons(
Effect( age ),
Comparisons with Overall Average( 1, Comparisons with Overall Average Decision Chart( ANOM( 1, Point Options( "Show Needles" ) ) ) )
);
Close( dt, no save );
dt = Open("data_table.jmp");
obj = Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Standard Least Squares" ),
Run
);
obj << Sequential Tests( 1 );
rpt = obj << report;
test1 = Try( rpt[Outline Box( "Response miles" )][Outline Box( "Sequential (Type 1) Tests" )], "Sequential Tests removed for REML" );
Code Explanation:
- Open data table;
- Run "Fit Model" script.
- Select "weight" column.
- Delete selected column.
- Configure multiple comparisons for "age".
- Close "data_table.jmp" without saving.
- Open data table;
- Fit model with specified effects.
- Enable sequential tests.
- Extract and try accessing "Sequential Tests".
Fit Model using Set Values
Example 1
Summary: Runs a two-stage screening analysis and model fitting process to identify significant effects in the Strength variable, utilizing JMP's Screening and Fit Model platforms.
Code:
dt = Open("data_table.jmp");
:Strength << Set Values( [999] );
obj = Screening( Y( :Strength ), X( :Liquid, :Sugar, :Flour, :Sifted, :Type, :Temp, :Salt, :Clamp, :Coat ) );
model = Fit Model(
Y( :Strength ),
Effects( :Sifted ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
:Strength << {Lack of Fit( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
)
);
:Strength << Set Property( "Missing Value Codes", 999 );
obj2 = Screening( Y( :Strength ), X( :Liquid, :Sugar, :Flour, :Sifted, :Type, :Temp, :Salt, :Clamp, :Coat ) );
model2 = Fit Model(
Y( :Strength ),
Effects( :Sifted ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
:Strength << {Lack of Fit( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Effect Leverage( 0 )}
)
);
rpt = model2 << Report;
actN = (rpt[Number Col Box( 3 )]);
a = actN << get( 5 );
Code Explanation:
- Open data table.
- Set Strength values to 999.
- Run screening analysis on all variables.
- Fit model with Strength as Y and Sifted as effect.
- Configure model to suppress plots.
- Set Missing Value Codes for Strength to 999.
- Run second screening analysis.
- Fit second model with same settings.
- Extract report from second model.
- Retrieve value from fifth row of third column box.
Example 2
Summary: Fits a model to predict oxygen levels based on various factors, including sex, maximum pulse, and runtime, while generating individual confidence intervals and displaying confidence limit formulas.
Code:
dt = Open("data_table.jmp");
dt:Oxy << Set Values(
[59.571, 60.055, 54.297, ., 49.156, 49.874, 48.673, 45.441, 50.545, 46.672, 45.313, 50.388, ., 46.774, 51.855, 45.79, 47.467, 47.273,
49.091, 40.836, 45.118, 44.754, 46.08, 44.609, 47.92, 44.811, ., 39.407, 39.203, 39.442, 37.388]
);
obj1 = dt << Fit Model(
Weight( :Weight ),
Y( :Oxy ),
Effects( :Sex, :MaxPulse, :Runtime, :Sex * :MaxPulse, ::Runtime * :Runtime ),
Personality( "Standard Least Squares" ),
Emphasis( Minimal Report ),
Run()
);
obj1 << Indiv Confidence Interval;
obj1 << Indiv Confidence Limit Formula;
indiv lcl1 = dt:Name( "Lower 95% Indiv Oxy" ) << get values;
indiv ucl1 = dt:Name( "Upper 95% Indiv Oxy" ) << get values;
indiv lcl2 = dt:Name( "Lower 95% Indiv Oxy 2" ) << get values;
indiv ucl2 = dt:Name( "Upper 95% Indiv Oxy 2" ) << get values;
Code Explanation:
- Open data table;
- Modify Oxy column values.
- Initiate Fit Model platform.
- Set Weight as weight variable.
- Set Oxy as response variable.
- Include specified effects.
- Choose Standard Least Squares personality.
- Generate minimal report.
- Run the model.
- Add individual confidence intervals.
- Display confidence limit formula.
- Retrieve Lower 95% Indiv Oxy values.
- Retrieve Upper 95% Indiv Oxy values.
- Retrieve Lower 95% Indiv Oxy 2 values.
- Retrieve Upper 95% Indiv Oxy 2 values.
Example 3
Summary: Analyze and visualize individual confidence intervals for oxygen levels in a dataset, utilizing JMP's Fit Model platform to specify model parameters.
Code:
dt = Open("data_table.jmp");
dt:Runtime << Set Values(
[., 8.63, 8.65, 8.92, ., 9.22, 9.4, 9.63, 9.93, 10, 10.07, 10.08, 10.13, 10.25, 10.33, 10.47, 10.5, 10.6, 10.85, 10.95, 11.08, 11.12,
11.17, ., 11.5, 11.63, 11.95, 12.63, 12.88, 13.08, .]
);
obj1 = dt << Fit Model(
Weight( :Weight ),
Y( :Oxy ),
Effects( :Sex, :MaxPulse, :Runtime, :Sex * :MaxPulse, ::Runtime * :Runtime ),
Personality( "Standard Least Squares" ),
Emphasis( Minimal Report ),
Run()
);
obj1 << Indiv Confidence Interval;
obj1 << Indiv Confidence Limit Formula;
indiv lcl1 = dt:Name( "Lower 95% Indiv Oxy" ) << get values;
indiv ucl1 = dt:Name( "Upper 95% Indiv Oxy" ) << get values;
indiv lcl2 = dt:Name( "Lower 95% Indiv Oxy 2" ) << get values;
indiv ucl2 = dt:Name( "Upper 95% Indiv Oxy 2" ) << get values;
Code Explanation:
- Open data table;
- Set values for Runtime.
- Fit model with specified parameters.
- Enable individual confidence interval.
- Enable individual confidence limit formula.
- Retrieve lower 95% individual Oxy values.
- Retrieve upper 95% individual Oxy values.
- Retrieve lower 95% individual Oxy 2 values.
- Retrieve upper 95% individual Oxy 2 values.
Example 4
Summary: Fits a model to predict Oxy values based on Weight, Sex, MaxPulse, and Runtime variables, with individual confidence intervals and limit formulas.
Code:
dt = Open("data_table.jmp");
dt:Weight << Set Values(
[68.15, ., 85.84, ., 81.42, 89.02, ., 76.32, 59.08, 77.91, 75.07, 73.37, 73.03, 91.63, ., 73.71, ., 79.15, 81.19, 69.63, 67.25, 66.45,
79.38, 89.47, 61.24, 77.45, 75.98, 73.37, 91.63, 81.42, 87.66]
);
obj1 = dt << Fit Model(
Weight( :Weight ),
Y( :Oxy ),
Effects( :Sex, :MaxPulse, :Runtime, :Sex * :MaxPulse, ::Runtime * :Runtime ),
Personality( "Standard Least Squares" ),
Emphasis( Minimal Report ),
Run()
);
obj1 << Indiv Confidence Interval;
obj1 << Indiv Confidence Limit Formula;
indiv lcl1 = dt:Name( "Lower 95% Indiv Oxy" ) << get values;
indiv ucl1 = dt:Name( "Upper 95% Indiv Oxy" ) << get values;
indiv lcl2 = dt:Name( "Lower 95% Indiv Oxy 2" ) << get values;
indiv ucl2 = dt:Name( "Upper 95% Indiv Oxy 2" ) << get values;
Code Explanation:
- Open data table;
- Set new weight values.
- Launch Fit Model platform.
- Specify Weight as response.
- Specify Oxy as Y variable.
- Add effects: Sex, MaxPulse, Runtime, interaction, quadratic term.
- Use Standard Least Squares personality.
- Request minimal report.
- Run the model.
- Add individual confidence intervals.
- Add confidence limit formula.
- Extract Lower 95% Indiv Oxy values.
- Extract Upper 95% Indiv Oxy values.
- Extract Lower 95% Indiv Oxy 2 values.
- Extract Upper 95% Indiv Oxy 2 values.
Fit Model using Group Columns
Summary: Fits a least squares model to a table, transforming the weight column, and configuring plot options for visualization.
Code:
dt = Open("data_table.jmp");
dt << Group Columns( "Factors", :age, 3 );
New Window( "data_table - Fit Least Squares",
Fit Model(
Weight( Transform Column( "Log[weight] 2", Formula( Log( :weight ) ) ) ),
Y( Transform Column( "Log[weight]", Formula( Log( :weight ) ) ) ),
Effects,
Personality( Standard Least Squares ),
Emphasis( Effect Leverage ),
Run(
:Name( "Log[weight]" ) << {Lack of Fit( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )}
)
)
) << Move Window( 58, 0 ) << Size Window( 390, 901 ) << Set Window Icon( "Model" );
Code Explanation:
- Open table.
- Group columns.
- Create new window.
- Fit least squares model.
- Transform weight column.
- Set Y variable.
- Define effects.
- Set personality.
- Set emphasis.
- Configure plot options.
Fit Model using JMP Product Name
Summary: Fits a model to data, retrieving dialog reports, and capturing logs in JMP Pro.
Code:
isPro = (JMP Product Name() == "Pro");
dt = Open("data_table.jmp");
dlg = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Response Screening" ),
);
dlgrpt = dlg << report;
Try(
check0 = dlgrpt[Button Box( 1 )] << get button name;
check1 = dlgrpt[Button Box( 2 )] << get button name;
check2 = dlgrpt[Button Box( 3 )] << get button name;
check3 = dlgrpt[Button Box( 4 )] << get button name;
check4 = dlgrpt[Button Box( 5 )] << get button name;
check5 = dlgrpt[Button Box( 6 )] << get button name;
check6 = dlgrpt[TabListBox( 1 )][Tab Page Box( 1 )] << get title;
check7 = dlgrpt[TabListBox( 1 )][Tab Page Box( 2 )] << get title;
check8 = dlgrpt[TabListBox( 1 )][Tab Page Box( 2 )][Button Box( 4 )] << get button name;
check9 = dlgrpt[TabListBox( 1 )][Tab Page Box( 2 )][Text Box( 2 )] << get text;
);
If( IsPro, , );
log1 = Log Capture(
obj = dt << Fit Model(
Y( :miles ),
Effects( :species, :season, :species * :season ),
Random Effects( :subject[:species] ),
Personality( "Response Screening" ),
Run
)
);
If( IsPro,
rpt = obj << report;
title1 = rpt[Outline Box( 1 )] << get title;
title2 = rpt[Outline Box( 2 )] << get title;
title3 = rpt[Outline Box( 3 )] << get title;
title4 = rpt[Outline Box( 4 )] << get title;
title5 = rpt[Outline Box( 5 )] << get title;
title6 = rpt[Outline Box( 6 )] << get title;
title7 = rpt[Outline Box( 7 )] << get title;
,
);
Code Explanation:
- Check if JMP Pro.
- Open data table;
- Launch Fit Model dialog.
- Set response variable to miles.
- Add species, season, and interaction effects.
- Define random effects.
- Use Response Screening personality.
- Retrieve dialog report.
- Attempt to get button names and titles.
- If JMP Pro, fit model and capture log.
Fit Model using N Items
Summary: Fits a mixed model to a data table, specifying validation grouping and response variable, and saving simulation formulas.
Code:
dt = Open("data_table.jmp");
ncols1 = N Items( dt << Get Column Names );
obj = dt << Fit Model(
By( :Validation ),
Y( :Y ),
Effects( :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH ),
Personality( "Mixed Model" ),
Run( Save Simulation Formula )
);
ncols2 = N Items( dt << Get Column Names );
Code Explanation:
- Open data table;
- Count initial columns.
- Fit mixed model.
- Specify validation grouping.
- Set response variable.
- Define model effects.
- Choose mixed model personality.
- Run model with simulation formula.
- Save simulation formula.
- Count final columns.
Fit Model using Log Capture
Example 1
Summary: Fits a linear model to predict weight based on age, sex, and height using Standard Least Squares personality.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model( Y( :weight ), Effects( Grouped( :age, :sex, :height ) ), Personality( "Standard Least Squares" ), Run )
);
Code Explanation:
- Open data table.
- Capture log output.
- Assign data table to variable.
- Launch Fit Model platform.
- Set response variable.
- Define grouped effects.
- Select Standard Least Squares personality.
- Execute model fit.
Example 2
Summary: Fits a model using age vector as the response variable, including height as an effect, and utilizing standard least squares personality.
Code:
dt = Open("data_table.jmp");
Log Capture( obj = Fit Model( Y( :age vector ), Effects( height ), Personality( "Standard Least Squares" ), Run ) );
Code Explanation:
- Open data table.
- Capture log output.
- Fit model using age vector.
- Include height as effect.
- Use standard least squares personality.
- Run the model.
Example 3
Summary: Fits a random effects model to predict height, with 10 iterations using REML method and standard least squares personality.
Code:
dt = Open("data_table.jmp");
Log Capture(
For( i = 1, i <= 10, i++,
obj = Fit Model(
Y( :height ),
Random Effects( :name, :age[:name], :sex[:name, :age] ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
NoBounds( 0 ),
Run
)
)
);
Code Explanation:
- Open data table.
- Start log capture.
- Loop 10 times.
- Fit model for height.
- Specify random effects.
- Set personality to SLR.
- Use REML method.
- Disable bounds.
- Run the model.
- End loop.
Example 4
Summary: Fits a Cox Mixtures model to a data table, capturing log output and specifying effects, personality, and report emphasis.
Code:
dt = Open("data_table.jmp");
test1 = Log Capture(
obj = Fit Model(
Y( :Y ),
Effects( :p1 & RS & Mixture, :p2 & RS & Mixture, :p3 & RS & Mixture, :p2 * :p1, :p3 * :p1, :p3 * :p2 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Cox Mixtures( p1( 0.6615 ), p2( 0.126 ), p3( 0.2125 ) ) )
)
);
Code Explanation:
- Open data table;
- Capture log output.
- Fit model with specified effects.
- Set personality to Standard Least Squares.
- Emphasize minimal report.
- Run Cox Mixtures analysis.
- Specify p1 value.
- Specify p2 value.
- Specify p3 value.
Example 5
Summary: Fits a linear model to a data table, capturing log output and including effects for age, sex, their interaction, and quadratic terms.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture( dt << Fit Model( Y( :weight ), Effects( :age, :sex, :age * :sex, :age * :age, :sex * :sex ), Run ) );
Code Explanation:
- Open data table;
- Capture log output.
- Fit model to data.
- Set response variable to weight.
- Include age effect.
- Include sex effect.
- Include interaction age*sex.
- Include quadratic age term.
- Include quadratic sex term.
- Run the model.
Example 6
Summary: Fits a Cox mixture model to data, capturing log information and generating a minimal report, while also fitting a separate linear regression model for height with sex and age interactions.
Code:
dt = Open("data_table.jmp");
test1 = Log Capture(
obj = Fit Model(
Y( :Y ),
Effects( :p1 & RS & Mixture, :p2 & RS & Mixture, :p3 & RS & Mixture, :p2 * :p1, :p3 * :p1, :p3 * :p2 ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run( Cox Mixtures( p1( 0.6615 ), p2( 0.126 ), p3( 0.2125 ) ) )
)
);
Close( dt, no save );
dt = Open("data_table.jmp");
obj1 = dt << Fit Model(
Y( :height ),
Effects( :sex, :age, :age * :sex ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run()
);
rpt1 = Report( obj1 );
title1 = "";
Try( title1 = rpt1[Outline Box( "Whole Model" )][Outline Box( "Contour Profiler" )] << get title );
Code Explanation:
- Open data table;
- Capture log for Fit Model.
- Fit model with specified effects.
- Use Standard Least Squares personality.
- Create minimal report.
- Run Cox Mixtures with given parameters.
- Close data_table dataset without saving.
- Open data table;
- Fit model for height with sex and age.
- Include interaction between age and sex.
Example 7
Summary: Fits a linear model to a data table, capturing log output and performing a Durbin-Watson test.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model(
Freq( :age ),
Y( :weight ),
Effects( :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( Effect Leverage ),
Set Alpha Level( 0.05 ),
Run( :weight << {Durbin Watson Test( 1 )} )
)
);
Code Explanation:
- Open data table;
- Capture log output.
- Start Fit Model.
- Use age as frequency.
- Set weight as response.
- Include sex and height effects.
- Choose Standard Least Squares personality.
- Focus on effect leverage.
- Set alpha level to 0.05.
- Run Durbin-Watson test.
Example 8
Summary: Fits a mixed model to analyze spatial relationships in data, utilizing repeated effects and a spherical structure.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model(
Y( :Yield ),
Effects,
Center Polynomials( 0 ),
Personality( "Mixed Model" ),
Repeated Effects( :Row, :Column ),
Repeated Structure( "Spatial with Nugget" ),
Repeated Structure Type( "Spherical" ),
Run( Random Effects Covariance Parameter Estimates( 0 ), Empirical Standard Errors( 1 ), Containment Degrees of Freedom( 1 ) )
)
);
Code Explanation:
- Open data table.
- Start log capture.
- Fit mixed model.
- Specify response variable.
- Define effects.
- Set polynomial centering.
- Choose mixed model personality.
- Define repeated effects.
- Set spatial structure.
- Configure spherical structure.
Example 9
Summary: Runs the fitting and prediction of a mixed model with spatial anisotropic repeated structure, extracting fit statistics from the report.
Code:
dt = Open("data_table.jmp");
Log Capture(
obj1 = dt << Fit Model(
Y( :Y ),
Center Polynomials( 0 ),
Repeated Effects( :log10 Rw, :log10 R, :Tu, :Tl, :Hu, :Hl, :L, :Kw ),
Repeated Structure( Spatial Anisotropic ),
Repeated Structure Type( Spherical ),
Personality( "Mixed Model" ),
Run
)
);
obj1 << Prediction Formula( 1 );
Log Capture(
obj2 = dt << Fit Model(
Y( :Pred Formula Y ),
Center Polynomials( 0 ),
Repeated Effects( :log10 Rw, :log10 R, :Tu, :Tl, :Hu, :Hl, :L, :Kw ),
Repeated Structure( Spatial Anisotropic ),
Repeated Structure Type( Spherical ),
Personality( "Mixed Model" ),
Run()
)
);
rpt2 = obj2 << report;
fitstat = rpt2[Outline Box( "Fit Statistics" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table.
- Start log capture.
- Fit mixed model.
- Set prediction formula.
- Start another log capture.
- Fit model with prediction.
- Retrieve report object.
- Extract fit statistics table.
- Convert table to matrix.
Example 10
Summary: Fits a mixed model to a data table, capturing log information and extracting relevant statistics, covariance parameters, and correlations.
Code:
dt = Open("data_table.jmp");
Log Capture(
obj1 = dt << Fit Model(
Y( :Y ),
Center Polynomials( 0 ),
Repeated Effects( :log10 Rw, :log10 R, :Tu, :Tl, :Hu, :Hl, :L, :Kw ),
Repeated Structure( Spatial Anisotropic ),
Repeated Structure Type( Spherical ),
Personality( "Mixed Model" ),
Run()
)
);
rpt1 = Report( obj1 );
Try( text = rpt1[Outline Box( "Fit Statistics" )][Text Box( 1 )] << get text );
fitstat = rpt1[Outline Box( "Fit Statistics" )][Table Box( 1 )] << get as matrix;
covparm = rpt1[Outline Box( "Repeated Effects Covariance Parameter Estimates" )][Table Box( 1 )] << get as matrix;
obj1 << Covariance of Fixed Effects( 1 );
cov fixed = rpt1[Outline Box( "Covariance of Fixed Effects" )][Matrix Box( 1 )] << get;
obj1 << Covariance of Covariance Parameters( 1 );
cov covparm = rpt1[Outline Box( "Covariance of Covariance Parameters" )][Matrix Box( 1 )] << get;
obj1 << Covariance of All Parameters( 1 );
cov all = rpt1[Outline Box( "Covariance of All Parameters" )][Matrix Box( 1 )] << get;
obj1 << Correlation of Fixed Effects( 1 );
corr fixed = rpt1[Outline Box( "Correlation of Fixed Effects" )][Matrix Box( 1 )] << get;
obj1 << Mean Confidence Interval( 1 );
mean ci = (dt:Lower 95% Mean Y << get values) || (dt:Upper 95% Mean Y << get values);
Code Explanation:
- Open table.
- Fit mixed model.
- Capture log.
- Extract report.
- Get fit statistics text.
- Extract fit statistics matrix.
- Extract covariance parameter estimates matrix.
- Enable covariance of fixed effects.
- Extract covariance of fixed effects matrix.
- Enable covariance of covariance parameters.
Example 11
Summary: Fits a linear model to predict Stretch values based on Silica and Sulfur * Silane interactions, suppressing missing effects warnings.
Code:
Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model(
Y( :Stretch ),
Effects( :Silica, :Sulfur * :Silane ),
Suppress Warning for Missing Effects( 1 ),
Personality( "Standard Least Squares" ),
Run
)
);
Code Explanation:
- Open data table;
- Capture log output.
- Start fitting model.
- Set response variable.
- Define effect terms.
- Suppress missing effects warning.
- Choose personality method.
- Execute model fit.
- End log capture.
- Store results.
Example 12
Summary: Fits a model to predict Stretch based on Silica, Sulfur, and Silane variables in a data table, suppressing missing effects warnings and using Stepwise personality.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model(
Y( :Stretch ),
Effects( :Silica, :Sulfur * :Silane ),
Suppress Warning for Missing Effects( 1 ),
Personality( "Stepwise" ),
Run
)
);
Code Explanation:
- Open data table.
- Capture log output.
- Launch Fit Model dialog.
- Set response variable.
- Define model effects.
- Suppress missing effects warning.
- Choose Stepwise personality.
- Execute the model fit.
Example 13
Summary: Fits a model to a data table, capturing log output, and suppressing missing effect warnings.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model(
Y( :Stretch ),
Effects( :Silica, :Sulfur * :Silane ),
Suppress Warning for Missing Effects( 1 ),
Personality( "Response Screening" ),
Run
)
);
Code Explanation:
- Open data table.
- Capture log output.
- Launch Fit Model dialog.
- Set response variable.
- Add effects to model.
- Suppress missing effect warnings.
- Choose Response Screening personality.
- Run the model.
Example 14
Summary: Fits a mixed model to a data table, capturing log output and suppressing missing effects warnings.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model(
Y( :Stretch ),
Effects( :Silica, :Sulfur * :Silane ),
Suppress Warning for Missing Effects( 1 ),
Personality( "Mixed Model" ),
Run
)
);
Code Explanation:
- Open data table.
- Capture log output.
- Launch Fit Model dialog.
- Set response variable.
- Add main effects.
- Add interaction effect.
- Suppress missing effects warning.
- Set model personality.
- Run the model.
- Close log capture.
Example 15
Summary: Fits a Partial Least Squares model to predict Stretch based on Silica, Sulfur, and Silane variables in a data table.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model(
Y( :Stretch ),
Effects( :Silica, :Sulfur * :Silane ),
Suppress Warning for Missing Effects( 1 ),
Personality( "Partial Least Squares" ),
Run( Fit )
)
);
Code Explanation:
- Open data table.
- Capture log output.
- Initiate Fit Model platform.
- Set response variable.
- Define model effects.
- Suppress missing effects warning.
- Choose Partial Least Squares personality.
- Execute model fit.
Example 16
Summary: Fits a standard least squares model to predict Weight, incorporating interactions between Age, Oxy1, and Runtime1.
Code:
dt = Open("data_table.jmp");
Log Capture( dt << Fit Model( Y( :Weight ), Effects( :Age, :Oxy1[:Age], :Runtime1[:Age] ), Personality( Standard Least Squares ), Run() ) );
Code Explanation:
- Open data table;
- Start Log Capture.
- Initiate Fit Model dialog.
- Set response variable to Weight.
- Add Age effect.
- Add interaction: Oxy1 and Age.
- Add interaction: Runtime1 and Age.
- Select Standard Least Squares personality.
- Run the model.
- End Log Capture.
Example 17
Summary: Fits a model to predict weight based on age, sex, and their interactions, capturing log output and checking for error messages.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture( dt << Fit Model( Y( :weight ), Effects( :age, :sex, :age * :sex, :age * :age, :sex * :sex ), Run ) );
Close( dt, no save );
b log1 = "Random or secondary effects specified in a fitting personality that does not support them";
Code Explanation:
- Open data table;
- Capture log output.
- Fit model with weight as response.
- Include age, sex, and interaction terms.
- Run the model.
- Close dataset without saving.
- Check for error message.
Example 18
Summary: Fits a model to predict weight based on age, sex, and height, capturing log output with Super Duper personality.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture( obj = dt << Fit Model( Y( :weight ), Effects( :age, :sex, :height ), Personality( "Super Duper" ), Run() ) );
Code Explanation:
- Open data table;
- Capture log output.
- Fit model with weight as response.
- Include age, sex, height as effects.
- Use Super Duper personality.
- Run the model.
Example 19
Summary: Opens a data table and captures log messages during mixed model fit execution in JMP Pro.
Code:
dt = Open("data_table.jmp");
b log1 = "The fitting personality \!"Mixed Model\!" is available only in JMP Pro";
log1 = Log Capture( obj = dt << Fit Model( Y( :weight ), Effects( :age, :sex, :height ), Personality( "Mixed Model" ), Run() ) );
Code Explanation:
- Open data table.
- Define mixed model log message.
- Capture log during fit model execution.
Example 20
Summary: Fits a Partial Least Squares model to a data table, capturing log output and displaying a message about the available personality.
Code:
dt = Open("data_table.jmp");
b log1 = "The fitting personality \!"Partial Least Squares\!" is available only in JMP Pro";
log1 = Log Capture( obj = dt << Fit Model( Y( :weight ), Effects( :age, :sex, :height ), Personality( "Partial Least Squares" ), Run() ) );
Code Explanation:
- Open data table.
- Define log message.
- Capture log output.
Example 21
Summary: Fits a linear model to a data table, capturing log output, and extracting effect tests.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :height, :age * :age, :age * :height, :height * :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
)
);
rpt = obj << report;
effect list = rpt["Effect Tests"][String Col Box( 1 )] << get;
Code Explanation:
- Open data table;
- Capture log output.
- Fit model with specified effects.
- Use standard least squares personality.
- Generate minimal report.
- Run the model.
- Retrieve report object.
- Extract effect tests section.
- Get string column box content.
- Assign to effect list variable.
Example 22
Summary: Fits a Partial Least Squares model to a data table, capturing log information and specifying response variables and effects.
Code:
dt1 = Open("data_table.jmp");
dt1:v1[1 :: 16] = .;
log1 = Log Capture(
obj = dt1 << Fit Model(
Y( :ls, :ha, :dt ),
Effects( :v1, :V2, :v3 ),
Personality( "Partial Least Squares" ),
Impute Missing Data( 1 ),
Run( Validation Method( "None" ), Fit )
)
);
Close( dt1, no save );
Try( Window( "Report: Fit Model" ) << close window( 1 ) );
Code Explanation:
- Open data table;
- Set first 16 values of v1 to missing.
- Start log capture.
- Launch Fit Model platform.
- Specify response variables: ls, ha, dt.
- Add effects: v1, V2, v3.
- Choose Partial Least Squares personality.
- Enable missing data imputation.
- Run model without validation.
- Close dataset without saving.
- Attempt to close Fit Model report window.
Example 23
Summary: Fits a Partial Least Squares model to predict ls, ha, and dt using v1, V2, and v3 as effects, with missing data imputation and no validation.
Code:
dt1 = Open("data_table.jmp");
dt1:v1[1 :: 16] = .;
log1 = Log Capture(
obj = dt1 << Fit Model(
Y( :ls, :ha, :dt ),
Effects( :v1, :V2, :v3 ),
Personality( "Partial Least Squares" ),
Impute Missing Data( 1 ),
Run( Validation Method( "None" ), Fit )
)
);
Code Explanation:
- Open data table;
- Set first 16 values of v1 to missing.
- Capture log output.
- Fit model with ls, ha, dt as Y.
- Include v1, V2, v3 as effects.
- Use Partial Least Squares personality.
- Enable missing data imputation.
- Run model without validation.
- Perform fit operation.
- End log capture.
Example 24
Summary: Fits a radial model to population data, incorporating random effects and standard least squares personality.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
fm = Fit Model( Y( :pop ), Effects( Radial( :year ) & Random ), Personality( Standard Least Squares ), Method( REML ), Run )
);
Code Explanation:
- Open data table;
- Capture log output.
- Define Fit Model object.
- Set response variable to population.
- Specify radial effect for year.
- Include random effects.
- Use standard least squares personality.
- Apply REML method.
- Execute model fitting.
- Store results in fm variable.
Example 25
Summary: Fits a radial model to data, capturing log output, and creating SAS jobs from the fit model and its report.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture( fm = Fit Model( Y( :height ), Effects( Radial( :weight ) & Random ) ) );
fm << Create SAS Job;
s1 = Concat Items( (Window( "data_tableModel" )[Script Box( 1 )] << Get lines)[46 :: 49], "\!N" );
Window( "data_tableModel" ) << close window;
ls = fm << Run;
ls << Model Dialog;
dlg = Window( "Report: Fit Model" );
obj = dlg["Model Specification"] << get scriptable object;
obj << Create SAS Job;
s2 = Concat Items( (Window( "data_tableModel" )[Script Box( 1 )] << Get lines)[46 :: 49], "\!N" );
Window( "data_tableModel" ) << close window;
Code Explanation:
- Open data table;
- Fit model with height as response.
- Capture log output.
- Create SAS job from fit model.
- Extract specific lines from log.
- Close model window.
- Run fit model.
- Open model dialog.
- Access report window.
- Create SAS job from report.
Example 26
Summary: Fits a model with multiple effects to predict NPN1, utilizing stepwise personality and running all possible models.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
Fit Model(
Y( :NPN1 ),
Effects(
:PNP1, :PNP2, :NPN2, :PNP3, :IVP1, :PNP4, :NPN3, :IVP2, :NPN4, :SIT1, :INM1, :INM2, :VPM1, :VPM2, :VPM3, :PMS1, :SNM1, :SPM1,
:NPN5, :EP2, :ZD6, :PBA, :PLG, :CAP, :PBA 2, :PLG 2, :PNP5, :NPN6, :PNP6, :PNP7, :NPN7, :PNP8, :IVP3, :IVP4, :IVP5, :IVP6,
:PNP9, :NPN8, :NPN9, :IVP7, :NPN10, :N_1, :PBA1, :WPR1, :B10, :PLY10, :VBE210, :VTN210, :VTP210, :SIT2, :SIT3, :INV2, :INV3,
:INV4, :INV5, :FST1, :FST2, :RES1, :RES2, :PNM1, :PPM1, :FNM1, :FPM1, :FST3, :FST4, :RES3, :RES4, :A1, :B1, :A2N, :A2P, :A2P1,
:IVP8, :IVP9, :DE_H1, :NF_H1, :ESM1, :ESM2, :ESP1, :YFU1, :VPM4, :PBA2, :PBB1, :LYA1, :LYB1, :DEM1, :DEP1, :NFM1
),
Personality( "Stepwise" ),
Run( All Possible Models( 4, 56 ) )
)
);
Code Explanation:
- Open data table.
- Start log capture.
- Fit model with NPN1 as response.
- Include multiple effects.
- Use stepwise personality.
- Run all possible models.
- Specify minimum terms.
- Specify maximum terms.
- End log capture.
Example 27
Summary: Creates a new column, random assignment of integers, and execution of a Fit Model with Stepwise personality in JMP.
Code:
dt = Open("data_table.jmp");
log1 = Log Capture(
dt << New Column( "Validation", formula( Random Integer( 1, 5 ) ) );
Fit Model( Validation( :Validation ), Y( :sex ), Effects( :height, :weight ), Personality( "Stepwise" ), Run );
);
Code Explanation:
- Open data table;
- Create new column "Validation".
- Assign random integers to "Validation".
- Start Fit Model.
- Set validation method.
- Specify response variable.
- Add effects: height, weight.
- Choose Stepwise personality.
- Run the model.
- Capture log output.
Example 28
Summary: Analyze recurring events in a data table, capturing log output and fitting a power nonhomogeneous Poisson process model to identify patterns.
Code:
dt = Open("data_table.jmp");
lcap = Log Capture(
obj = dt << Recurrence Analysis(
Y( :event time ),
Label( :System ID ),
Grouping( :System ID ),
Timestamp at Start( :orig time ),
Age Scaling( "DateTime to Hour" ),
Default End Timestamp( "04Dec1994 2:20 AM" ),
Fit Model( Scale Effects( :System ID ), Run Model, Model Type( Power Nonhomogeneous Poisson Process ) )
)
);
Code Explanation:
- Open data table.
- Capture log output.
- Perform recurrence analysis.
- Set response variable.
- Assign system labels.
- Group by system ID.
- Define start timestamp.
- Scale age to hours.
- Set default end timestamp.
- Fit power nonhomogeneous Poisson process model.
Example 29
Summary: Analyze a data table using recurrence analysis, capturing log events and fitting a Power Nonhomogeneous Poisson Process model.
Code:
dt = Open("data_table.jmp");
lCap = Log Capture(
obj1 = dt << Recurrence Analysis(
Y( :Age ),
Cost( :Cost ),
Label( :EngineID ),
Event Plot( 0 ),
Fit Model( Run Model, Model Type( Power Nonhomogeneous Poisson Process ) )
)
);
Code Explanation:
- Open data table.
- Begin log capture.
- Launch recurrence analysis.
- Set Y variable to Age.
- Set Cost variable to Cost.
- Set Label variable to EngineID.
- Disable event plot.
- Fit model using Power Nonhomogeneous Poisson Process.
Example 30
Summary: Analyze a table by performing recurrence analysis, setting response and label variables, and fitting a loglinear nonhomogeneous Poisson process model.
Code:
dt = Open("data_table.jmp");
lCap = Log Capture(
obj1 = dt << Recurrence Analysis(
Y( :Age ),
Label( :EngineID ),
Cost( :Cost ),
Event Plot( 0 ),
Fit Model( Run Model, Model Type( "Loglinear Nonhomogeneous Poisson Process" ) )
)
);
Code Explanation:
- Open table.
- Create log capture.
- Perform recurrence analysis.
- Set response variable.
- Set label variable.
- Set cost variable.
- Disable event plot.
- Fit loglinear model.
Example 31
Summary: Fits a linear model to a data table, generating a surface profiler and redoing analysis with emphasis on effect screening.
Code:
dt = Open("data_table.jmp");
Log Capture(
obj = dt << Fit Model(
Y( :Number Popped, :Total Kernels ),
Effects( :Brand, :Time, :Power, :Brand * :Time, :Brand * :Power, :Time * :Power, :Time * :Time, :Power * :Power ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run
)
);
obj << Surface Profiler;
Log Capture( obj << Redo Analysis );
Code Explanation:
- Open data table.
- Start log capture.
- Fit linear model.
- Specify response variables.
- Define model effects.
- Set personality to least squares.
- Emphasize effect screening.
- Run the analysis.
- Stop log capture.
- Create surface profiler.
- Redo analysis.
Example 32
Summary: Analyze and visualize a nominal logistic model to predict readiness, utilizing profiler reports and probability formulas.
Code:
ut relative epsilon = 1e-2;
dt = Open("data_table.jmp");
Log Capture( dt << New Column( "ReadyOld", Character, Nominal, Formula( If( :ready == "Not Ready", 1, 0 ) ) ) );
dt:ReadyOld << Delete Formula;
obj = dt << Fit Model( Freq( :count ), Y( :ReadyOld ), Effects( :heat, :soak ), Personality( "Nominal Logistic" ), Run Model );
obj << Save Probability Formula;
Log Capture(
obj = dt << Profiler(
Y( :Name( "Prob[0]" ), :Name( "Prob[1]" ), :Most Likely ReadyOld ),
Profiler( 1, Term Value( heat( 50 ), soak( 2.5 ) ) ),
Expand,
SendToReport(
Dispatch( {"Prediction Profiler"}, "2", ScaleBox, {Min( 0 ), Max( 60 ), Inc( 10 ), Rotated Labels( 1 )} ),
Dispatch( {"Prediction Profiler"}, "1", ScaleBox, {Max( 100 ), Inc( 20 ), Minor Ticks( 0 ), Rotated Labels( 1 )} )
)
)
);
indicator = Is Scriptable( obj );
formLin = Column( "Lin[1]" ) << get formula;
formProb0 = Column( "Prob[0]" ) << get formula;
formProb1 = Column( "Prob[1]" ) << get formula;
Substitute Into( formLin, Expr( :heat ), Expr( x1 ), Expr( :soak ), Expr( x2 ) );
Substitute Into( formProb0, Expr( :Name( "Lin[1]" ) ), Expr( LinValue ) );
Substitute Into( formProb1, Expr( :Name( "Lin[1]" ) ), Expr( LinValue ) );
nTest = 10;
For( i = 1, i <= nTest, i++,
x1 = Random Uniform( 40, 80 );
x2 = Random Uniform( 5, 15 );
obj << Profiler( Term Value( heat( x1, Max( 80 ) ), soak( x2, Max( 15 ) ) ) );
rpt = obj << report;
observedLike = Num( rpt[Text Box( 3 )] << get text );
LinValue = Eval( formLin );
expProb0 = Eval( formProb0 );
expProb1 = Eval( formProb1 );
expLike = Match( Max( expProb0, expProb1 ), expProb0, 0, expProb1, 1, . );
);
Code Explanation:
- Set relative epsilon.
- Open data table.
- Create new column "ReadyOld".
- Remove formula from "ReadyOld".
- Fit nominal logistic model.
- Save probability formula.
- Generate profiler report.
- Check scriptability of profiler.
- Retrieve formulas for columns.
- Substitute variables in formulas.
Example 33
Summary: Creates and analyzes a nominal logistic model, generating a profiler report with predicted probabilities and observed likelihoods.
Code:
dt = Open("data_table.jmp");
Log Capture( dt << New Column( "ReadyOld", Character, Nominal, Formula( If( :ready == "Not Ready", 1, 0 ) ) ) );
dt:ReadyOld << Delete Formula;
obj = dt << Fit Model( Freq( :count ), Y( :ReadyOld ), Effects( :heat, :soak ), Personality( "Nominal Logistic" ), Run Model );
obj << Save Probability Formula;
Log Capture(
obj = dt << Profiler(
Y( :Name( "Prob[0]" ), :Name( "Prob[1]" ), :Most Likely ReadyOld ),
Profiler( 1, Term Value( heat( 50 ), soak( 2.5 ) ) ),
Expand,
SendToReport(
Dispatch( {"Prediction Profiler"}, "2", ScaleBox, {Min( 0 ), Max( 60 ), Inc( 10 ), Rotated Labels( 1 )} ),
Dispatch( {"Prediction Profiler"}, "1", ScaleBox, {Max( 100 ), Inc( 20 ), Minor Ticks( 0 ), Rotated Labels( 1 )} )
)
)
);
indicator = Is Scriptable( obj );
formLin = Column( "Lin[1]" ) << get formula;
formProb0 = Column( "Prob[0]" ) << get formula;
formProb1 = Column( "Prob[1]" ) << get formula;
Substitute Into( formLin, Expr( :heat ), Expr( x1 ), Expr( :soak ), Expr( x2 ) );
Substitute Into( formProb0, Expr( :Name( "Lin[1]" ) ), Expr( LinValue ) );
Substitute Into( formProb1, Expr( :Name( "Lin[1]" ) ), Expr( LinValue ) );
nTest = 10;
For( i = 1, i <= nTest, i++,
x1 = Random Uniform( 40, 80 );
x2 = Random Uniform( 5, 15 );
obj << Profiler( Term Value( heat( x1, Max( 80 ) ), soak( x2, Max( 15 ) ) ) );
rpt = obj << report;
observedLike = Num( rpt[Text Box( 3 )] << get text );
LinValue = Eval( formLin );
expProb0 = Eval( formProb0 );
expProb1 = Eval( formProb1 );
expLike = Match( Max( expProb0, expProb1 ), expProb0, 0, expProb1, 1, . );
);
Code Explanation:
- Open data table;
- Create new column "ReadyOld".
- Delete formula from "ReadyOld".
- Fit nominal logistic model.
- Save probability formula.
- Create profiler report.
- Check if object is scriptable.
- Get formulas for columns.
- Substitute variables in formulas.
- Perform tests with random values.
Example 34
Summary: Runs a recurrence analysis on the provided data table, utilizing the Proportional Intensity Poisson Process model to analyze Age and Cost variables, with interactive features for grouping by Treatment Group and labeling by Patient Number.
Code:
dt = Open("data_table.jmp");
Log Capture(
obj = dt << Recurrence Analysis(
Y( :Age ),
Cost( :Cost ),
Event Plot( 0 ),
Grouping( :Treatment Group ),
Label( :Patient Number ),
Fit Model(
Scale Effects( :Treatment Group, :Initial Number of Tumors, :Initial Size of Tumors ),
Run Model,
Model Type( Proportional Intensity Poisson Process ),
Save Intensity Formula( 1 ),
Save Cumulative Formula( 1 ),
Profiler( 1 )
)
)
);
rpt = obj << report;
predProfScptObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object;
Match( Random Integer( 1, 3 ),
1, predProfScptObj << Independent Uniform Inputs( 1 ),
2, predProfScptObj << Independent Resampled Inputs( 1 ),
3, predProfScptObj << Dependent Resampled Inputs( 1 )
);
Code Explanation:
- Open data table;
- Perform recurrence analysis.
- Set Y variable as Age.
- Include Cost variable.
- Disable event plot.
- Group by Treatment Group.
- Label by Patient Number.
- Fit proportional intensity Poisson process model.
- Save intensity formula.
- Save cumulative formula.
- Enable profiler.
- Retrieve prediction profiler report.
- Get prediction profiler scriptable object.
- Randomly select input method for profiler.
Example 35
Summary: Runs time series forecasting and analysis by capturing logs, performing forecasts, and adding a new column in JMP.
Code:
dt = Open("data_table.jmp");
dt << select rows( 1 :: 8977 );
dt << delete rows;
log1 = Log Capture(
dt << Time Series Forecast(
Y( :Y ),
Grouping( :Series ),
Time( :Time ),
Fit Model(
NAhead( 8 ),
NHoldout( 8 ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecast Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
)
);
log2 = Log Capture( dt << Time Series( Y( :Y ), Time( :Time ), ) );
Close( dt, no save );
dt = Open("data_table.jmp");
dt << New Column( "missing", numeric );
For( i = 1, i <= 30, i++,
obj2 = dt << Time Series Forecast(
Y( :missing ),
Grouping( :Series ),
Time( :Time ),
Fit Model(
NAhead( 8 ),
NHoldout( 8 ),
Other Options(
Preserve Model Selection Criterion( 0 ),
Forecast Interval Level( 0.95 ),
Imputation for Applicable Models( "None" )
)
)
);
obj2 << close window;
);
Code Explanation:
- Open data table.
- Select specific rows.
- Delete selected rows.
- Capture log of time series forecast.
- Perform time series analysis.
- Capture another log of time series.
- Close data table without saving.
- Reopen data table.
- Add new column "missing".
- Loop to perform time series forecast 30 times.
Fit Model using N Cols
Example 1
Summary: Fits a linear model to predict ABRASION values based on SILICA, SILANE, and SULFUR variables, with Standard Least Squares personality and minimal report emphasis.
Code:
dt = Open("data_table.jmp");
dtncols = N Cols( dt );
obj = dt << Fit Model(
Y( :ABRASION ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj << Predicted Values( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << Predicted Values( 1 );
obj << Predicted Values( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
obj << StdErr Pred Formula( 1 );
dtcols = dt << get column names;
Remove From( dtcols, 1, dtncols );
Code Explanation:
- Open data table;
- Count number of columns.
- Fit linear model.
- Set response variable ABRASION.
- Include predictors SILICA, SILANE, SULFUR.
- Use Standard Least Squares personality.
- Minimal report emphasis.
- Run the model.
- Add predicted values.
- Add standard error formulas multiple times.
Example 2
Summary: Analyzes and creates reports for recurrence models for multiple causes, including intensity and cumulative formulas, using JMP's Recurrence Analysis platform.
Code:
dt = Open("data_table.jmp");
nCol = N Cols( dt );
obj = dt << Recurrence Analysis(
Y( :Age ),
Label( :Patient Number ),
Cost( :Cost ),
Cause( :Cause of Death ),
Fit Model( Run Model, Model Type( Power Nonhomogeneous Poisson Process ) )
);
rpt = obj << report;
scptObj = rpt[Outline Box( "Multiple Cause Models" )] << get scriptable object;
scptObj1 = rpt[Outline Box( "Fitted Recurrence Model Cause=Alive" )] << get scriptable object;
scptObj2 = rpt[Outline Box( "Fitted Recurrence Model Cause=Bladder Cancer" )] << get scriptable object;
scptObj3 = rpt[Outline Box( "Fitted Recurrence Model Cause=Other Cause" )] << get scriptable object;
scptObj << Save Intensity Formula;
scptObj1 << Save Intensity Formula;
scptObj2 << Save Intensity Formula;
scptObj3 << Save Intensity Formula;
_mat = dt << get as matrix( {nCol + 1 :: (nCol + 4)} );
dt << delete Columns( {nCol + 1 :: (nCol + 4)} );
scptObj << Save Cumulative Formula;
scptObj1 << Save Cumulative Formula;
scptObj2 << Save Cumulative Formula;
scptObj3 << Save Cumulative Formula;
_mat1 = dt << get as matrix( {nCol + 1 :: (nCol + 4)} );
Code Explanation:
- Open data table;
- Count number of columns.
- Perform Recurrence Analysis.
- Extract report from analysis.
- Get scriptable object for multiple causes.
- Get scriptable object for cause 'Alive'.
- Get scriptable object for cause 'Bladder Cancer'.
- Get scriptable object for cause 'Other Cause'.
- Save intensity formula for each cause.
- Delete added columns.
Fit Model using For Each Row
Example 1
Summary: Fits a model to a data table, including transforming columns, specifying effects, and configuring model settings, while also generating profiler plots and retrieving effect details.
Code:
dt = Open("data_table.jmp");
For Each Row( :Damping = 10 * :Damping );
dt << New Column( "LogDamping", continus, formula( Log( :Damping ) ) );
obj1 = dt << Fit Model(
Transform Column( "Log[Damping]", Formula( Log( :Damping ) ) ),
Y( :"Log[Damping]"n ),
Effects(
:CuSO4 & RS & Mixture, :Na2S2O3 & RS & Mixture, :Glyoxal & RS & Mixture, :CuSO4 * :Na2S2O3, :CuSO4 * :Glyoxal, :CuSO4 * :Wavelength,
:Na2S2O3 * :Glyoxal, :Na2S2O3 * :Wavelength, :Glyoxal * :Wavelength
),
No Intercept( 1 ),
Center Polynomials( 0 ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Adapt Y Axis( 1 ),
Profile at Boundary( "Turn at Boundaries" ),
Term Value(
CuSO4( 0.512, Min( 0.2 ), Max( 0.8 ), Lock( 0 ), Show( 1 ) ),
Na2S2O3( 0.237653363059103, Min( 0.2 ), Max( 0.8 ), Lock( 0 ), Show( 1 ) ),
Glyoxal( 0.250346636940897, Max( 0.6 ), Lock( 0 ), Show( 1 ) ),
Wavelength( "L3", Lock( 0 ), Show( 1 ) )
)
)
)
);
rpt1 = obj1 << report;
axis max = rpt1["Prediction Profiler"][AxisBox( 1 )] << get max;
Close( dt, no save );
dt = As Table( J( 500, 2, Random Normal( 0, 1 ) ), <<Column Names( {"X1", "Y"} ) );
obj1 = dt << Fit Model( Y( :Y ), Effects( :X1 ), Personality( "Standard Least Squares" ), Emphasis( "Minimal report" ), Run );
obj1 << Effect details( 1 );
obj1 << Profiler( 1 );
obj1 << Plot Effect Leverage( 1 );
rpt1 = obj1 << report;
title1 = Try( rpt1["Effect Details"][Outline Box( 3 )] << get title, "Leverage Plot Missing" );
obj2 = dt << Fit Model( Y( :Y ), Effects( :X1 ), Personality( "Standard Least Squares" ), Emphasis( "Minimal report" ), Run );
obj2 << Effect details( 1 );
obj2 << Plot Effect Leverage( 1 );
obj2 << Profiler( 1 );
rpt2 = obj2 << report;
title2 = Try( rpt2["Effect Details"][Outline Box( 3 )] << get title, "Leverage Plot Missing" );
Code Explanation:
- Open data table.
- Multiply Damping column by 10.
- Create new LogDamping column.
- Fit model with LogDamping response.
- Include specified effects in model.
- Configure model settings.
- Run model with profiler.
- Retrieve prediction profiler axis max.
- Close data table without saving.
- Create new random data table.
- Fit simple linear model.
- Enable effect details.
- Generate profiler plot.
- Plot effect leverage.
- Retrieve effect details title.
- Repeat steps 10-15 for second model.
Example 2
Summary: Fits a model to a data table, using LogDamping as the response variable and specifying various effects for analysis.
Code:
dt = Open("data_table.jmp");
For Each Row( :Damping = 10 * :Damping );
dt << New Column( "LogDamping", continus, formula( Log( :Damping ) ) );
obj1 = dt << Fit Model(
Transform Column( "Log[Damping]", Formula( Log( :Damping ) ) ),
Y( :"Log[Damping]"n ),
Effects(
:CuSO4 & RS & Mixture, :Na2S2O3 & RS & Mixture, :Glyoxal & RS & Mixture, :CuSO4 * :Na2S2O3, :CuSO4 * :Glyoxal, :CuSO4 * :Wavelength,
:Na2S2O3 * :Glyoxal, :Na2S2O3 * :Wavelength, :Glyoxal * :Wavelength
),
No Intercept( 1 ),
Center Polynomials( 0 ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run(
Profiler(
1,
Confidence Intervals( 1 ),
Adapt Y Axis( 1 ),
Profile at Boundary( "Turn at Boundaries" ),
Term Value(
CuSO4( 0.512, Min( 0.2 ), Max( 0.8 ), Lock( 0 ), Show( 1 ) ),
Na2S2O3( 0.237653363059103, Min( 0.2 ), Max( 0.8 ), Lock( 0 ), Show( 1 ) ),
Glyoxal( 0.250346636940897, Max( 0.6 ), Lock( 0 ), Show( 1 ) ),
Wavelength( "L3", Lock( 0 ), Show( 1 ) )
)
)
)
);
rpt1 = obj1 << report;
axis max = rpt1["Prediction Profiler"][AxisBox( 1 )] << get max;
Code Explanation:
- Open data table.
- Multiply Damping by 10.
- Create new column LogDamping.
- Fit model using LogDamping.
- Specify response variable.
- Define model effects.
- Exclude intercept.
- Disable center polynomials.
- Use standard least squares personality.
- Emphasize effect screening.
Fit Model using Associative Array
Example 1
Summary: Fits a linear model to a data table, generating plots for actual vs. predicted values and residuals, while also managing window operations.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
test = Try(
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, Log( 5 * :height + 3 ) ),
Personality( "Standard Least Squares" ),
Run( :weight << {Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Effect Leverage( 1 )} )
),
1
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( Window( aftlst[1] ) << close window );
Code Explanation:
- Open data table.
- Create associative array before fitting model.
- Attempt to fit linear model.
- Specify response variable.
- Define effects for model.
- Set personality to standard least squares.
- Run model with specific plots.
- Create associative array after fitting model.
- Remove windows present before fitting model.
- Close the first remaining window.
Example 2
Summary: Fits a linear regression model to a data table, capturing window titles before and after the fit, and verifying if the 'Fit Model' window exists.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
obj1 = dt << Fit Model( Y( :weight ), Effects( :height ), Personality( Standard Least Squares ), Emphasis( "Minimal Report" ), Run Model );
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
test = Contains( aftlst, "Fit Model" );
Code Explanation:
- Open data table.
- Create associative array before fit model.
- Fit linear regression model.
- Create associative array after fit model.
- Remove unchanged windows from array.
- Get remaining window titles.
- Check if "Fit Model" window exists.
Example 3
Summary: Fits a linear model to data, storing window titles before and after the fit, and verifying the presence of 'Fit Model' in the remaining titles.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
obj1 = dt << Fit Model( Y( :weight ), Effects( :height ), Personality( Standard Least Squares ), Emphasis( "Minimal Report" ), Run );
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
test = Contains( aftlst, "Fit Model" );
Code Explanation:
- Open data table.
- Store initial window titles.
- Fit linear model.
- Store new window titles.
- Remove unchanged titles.
- Get remaining titles.
- Check for "Fit Model" title.
Example 4
Summary: Fits a linear model to data, capturing log output, and verifying the presence of a fit model report.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
Log Capture(
obj1 = dt << Fit Model(
Y( :weight_abc ),
Effects( :height ),
Personality( Standard Least Squares ),
Emphasis( "Minimal Report" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
test = Contains( aftlst, "Report: Fit Model" );
Code Explanation:
- Open data table.
- Create associative array before fit.
- Capture log output.
- Fit linear model to data.
- Create associative array after fit.
- Remove unchanged windows.
- Get keys of remaining windows.
- Check for fit model report.
Example 5
Summary: Fits a model to a data table, verifying the fit, and repeating the process multiple times.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
obj1 = dt << Fit Model( Y( :weight ), Effects( :height ), Personality( Standard Least Squares ), Emphasis( "Minimal Report" ), Run Model );
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
test = Contains( aftlst, "Fit Model" );
Close( dt, no save );
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
obj1 = dt << Fit Model( Y( :weight ), Effects( :height ), Personality( Standard Least Squares ), Emphasis( "Minimal Report" ), Run Model );
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
test = Contains( aftlst, "Fit Model" );
Close( dt, no save );
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
obj1 = dt << Fit Model( Y( :weight ), Effects( :height ), Personality( Standard Least Squares ), Emphasis( "Minimal Report" ), Run );
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
test = Contains( aftlst, "Fit Model" );
Code Explanation:
- Open data table;
- Create associative array of window titles.
- Fit model with weight as Y and height as effect.
- Create associative array of window titles again.
- Remove initial window titles from new array.
- Get remaining window titles.
- Check if "Fit Model" is in window titles.
- Close "data_table.jmp" without saving.
- Repeat steps 1-7.
- Fit model with weight as Y and height as effect.
- Create associative array of window titles again.
- Remove initial window titles from new array.
- Get remaining window titles.
- Check if "Fit Model" is in window titles.
Example 6
Summary: Fits a model to data, capturing window titles and checking for specific keywords in the report.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
obj1 = dt << Fit Model(
Y( :weight ),
Effects( :height ),
Personality( Standard Least Squares ),
Emphasis( "Minimal Report" ),
Keep Dialog Open( 1 ),
Run
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
test = Contains( aftlst, "Fit Model" );
Close( dt, no save );
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
Log Capture(
obj1 = dt << Fit Model(
Y( :weight_abc ),
Effects( :height ),
Personality( Standard Least Squares ),
Emphasis( "Minimal Report" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
test = Contains( aftlst, "Report: Fit Model" );
Code Explanation:
- Open data table;
- Create associative array of window titles.
- Fit model with weight as Y and height as effect.
- Set minimal report emphasis.
- Keep dialog open.
- Run the fit model.
- Create new associative array of window titles.
- Remove original window titles from new array.
- Get keys from updated associative array.
- Check if "Fit Model" is in keys.
- Close dataset without saving.
- Reopen data_table dataset
- Create associative array of window titles.
- Log capture fit model with incorrect Y variable.
- Create new associative array of window titles.
- Remove original window titles from new array.
- Get keys from updated associative array.
- Check if "Report: Fit Model" is in keys.
Example 7
Summary: Fits a model to a data table, capturing log messages, and managing window titles.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
obj = dt << Fit Model(
Y( :Y ),
Effects( :p1 & RS & Mixture, :p2 & Random & RS & Mixture & Knotted, :p3 & RS & Mixture, :p1 * :p2, :p1 * :p3, :p2 * :p3 ),
Center Polynomials( 0 ),
No Intercept,
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Close( dt, no save );
b log1 =
"You have entered categorical effects that interact with a main effect (age). These effects have been removed from the analysis.You have entered categorical effects that interact with a main effect (sex). These effects have been removed from the analysis.";
Code Explanation:
- Open data table.
- Capture initial window titles.
- Start log capture.
- Fit model with specified effects.
- Stop log capture.
- Capture final window titles.
- Remove initial titles from final titles.
- Get remaining window keys.
- Close remaining windows if any.
- Close data table without saving.
Example 8
Summary: Fits a model to a data table, capturing log information during the fit, and managing window titles before and after the fit.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Response Screening" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
If( Contains( JMP Product Name(), "Pro" ) > 0,
,
);
Code Explanation:
- Open data table;
- Create associative array before fitting model.
- Capture log while fitting model.
- Specify response variable "miles".
- Define effects for model.
- Set personality to "Response Screening".
- Run the model.
- Create associative array after fitting model.
- Remove unchanged windows from associative array.
- Close the new window if it exists.
Example 9
Summary: Fits a nominal logistic model to data, capturing log information, and closing windows with duplicate titles.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model( Y( :season ), Effects( :species, :subject[:species] & Random, :season ), Personality( "Nominal Logistic" ), Run )
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Code Explanation:
- Open data table.
- Create associative array before fitting model.
- Capture log of fit model command.
- Create associative array after fitting model.
- Remove common windows from associative arrays.
- Get unique window titles after fitting model.
- Try to close the first unique window.
Example 10
Summary: Fits a model to data, capturing window titles, and closing the data table without saving.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Partial Least Squares" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Close( dt, no save );
b log1 = "Random or secondary effects specified in a fitting personality that does not support them";
Code Explanation:
- Open data table.
- Capture current window titles.
- Log capture begins.
- Fit model with specified parameters.
- Set model personality to Partial Least Squares.
- Run the model.
- Capture new window titles.
- Remove unchanged titles from associative array.
- Get keys of remaining titles.
- Close the model window if exists.
- Close data table without saving.
Example 11
Summary: Fits a model to data, capturing window titles before and after the fit, and logging output. It also checks for JMP Pro and logs a specific message if necessary.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Stepwise" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Close( dt, no save );
If( Contains( JMP Product Name(), "Pro" ) > 0,
b log1 = "Random or secondary effects specified in a fitting personality that does not support them",
b log1 = "The fitting personality \!"Generalized Regression\!" is available only in JMP Pro."
);
Code Explanation:
- Open data table.
- Capture current window titles.
- Start logging Fit Model output.
- Fit model with specified effects and personality.
- Capture new window titles after fitting.
- Remove initial window titles from new titles.
- Get remaining window titles.
- Close the first remaining window if any.
- Close data table without saving.
- Check for JMP Pro and log appropriate message.
Example 12
Summary: Fits a model to a data table, capturing window titles at various stages, and logging errors for unsupported effects.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Manova" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Close( dt, no save );
b log1 = "Random or secondary effects specified in a fitting personality that does not support them";
Code Explanation:
- Open data table;
- Capture initial window titles.
- Log model fitting process.
- Fit model with specified parameters.
- Capture final window titles.
- Remove initial titles from final titles.
- Get remaining window keys.
- Close the first remaining window if any.
- Close dataset without saving.
- Log error message for unsupported effects.
Example 13
Summary: Fits a model, capturing window titles, and generating reports in JMP.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Loglinear Variance" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Close( dt, no save );
b text = "Lenth PSE is zero because a number of estimates are zero.";
dt = New Table( "test",
Add Rows( 8 ),
New Script(
"Source",
Data Table("data_table") << Stack( columns( :Name( "1" ), :Name( "2" ) ), Source Label Column( "B" ), Stacked Data Column( "Y" ) )
),
New Column( "L", Numeric, "Continuous", Format( "Best", 16 ), Set Values( [-1, -1, 1, 1, -1, -1, 1, 1] ) ),
New Column( "S", Numeric, "Continuous", Format( "Best", 16 ), Set Values( [-1, -1, -1, -1, 1, 1, 1, 1] ) ),
New Column( "B", Numeric, "Continuous", Format( "Best", 4 ), Set Values( [-1, 1, -1, 1, -1, 1, -1, 1] ) ),
New Column( "Y", Numeric, "Continuous", Format( "Best", 10 ), Set Values( [76, 83, 82, 89, 80, 86, 86, 92] ) )
);
obj = dt << Fit Model(
Y( :Y ),
Effects( Full Factorial( :L, :S, :B ) ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
obj << Normal Plot( 1 );
obj << Pareto Plot( 1 );
rpt = obj << report;
text = rpt[Outline Box( "Effect Screening" )][Text Box( 3 )] << get text;
pse = rpt[Outline Box( "Effect Screening" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Capture initial window titles.
- Fit model with specified effects and personality.
- Capture final window titles.
- Remove initial window titles from final list.
- Get list of new window titles.
- Close the new window if it exists.
- Close data_table.jmp dataset without saving.
- Create new table "test" with specific columns and values.
- Fit model with full factorial effects and standard least squares personality.
Example 14
Summary: Fits a model to a data table, capturing initial and final window titles, and closing any remaining windows.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
obj = dt << Fit Model(
Y( :Y ),
Effects( :p1 & RS & Mixture, :p2 & Random & RS & Mixture & Knotted, :p3 & RS & Mixture, :p1 * :p2, :p1 * :p3, :p2 * :p3 ),
Center Polynomials( 0 ),
No Intercept,
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Code Explanation:
- Open data table;
- Capture initial window titles.
- Start log capture.
- Fit model with specified effects.
- Use Standard Least Squares personality.
- Use REML method.
- Stop log capture.
- Capture final window titles.
- Remove initial window titles from final list.
- Close the remaining window if any.
Example 15
Summary: Fits a model to data, capturing the log of the execution, and closing the first remaining window if it exists.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Partial Least Squares" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Code Explanation:
- Open data table;
- Create associative array of open windows.
- Capture log of Fit Model execution.
- Fit model with specified effects.
- Set model personality to PLS.
- Run the model.
- Create associative array of open windows again.
- Remove original window titles from new array.
- Get keys of remaining windows.
- Close the first remaining window if it exists.
Example 16
Summary: Fits a linear model to data, capturing log information, and managing windows in JMP.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Stepwise" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Code Explanation:
- Open data table;
- Create associative array before fitting model.
- Start log capture.
- Fit linear model with specified effects.
- End log capture.
- Create associative array after fitting model.
- Remove unchanged windows from associative array.
- Get keys of remaining windows.
- Try to close the first remaining window.
Example 17
Summary: Fits a model to a data table, capturing log output, and managing window titles.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Manova" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Code Explanation:
- Open data table;
- Store current window titles.
- Capture log output.
- Fit model with specified parameters.
- Store updated window titles.
- Remove initial window titles from updated list.
- Extract remaining window keys.
- Close the first remaining window if any.
Example 18
Summary: Fits a log-linear model to data, capturing window titles before and after the fit, and closing any new windows created.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model(
Y( :miles ),
Effects( :species, :subject[:species] & Random, :season, :species * :season ),
Personality( "Loglinear Variance" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Code Explanation:
- Open data table;
- Capture current window titles.
- Start log capture.
- Fit model with specified effects.
- Use Loglinear Variance personality.
- Run the model.
- End log capture.
- Capture updated window titles.
- Remove original window titles.
- Close the new window if it exists.
Example 19
Summary: Fits a Partial Least Squares (PLS) model to data and generating a report, utilizing log capture and associative arrays.
Code:
befAA = Associative Array( Window() << get window title );
dt2 = Open("data_table.jmp");
dt2:v1 << Set Values( [., ., ., ., ., ., ., .] );
dt2:ls << Set Values( [3.011, 0, 0, 1.482, 1.116, 3.397, 2.428, 4.024, ., ., ., ., ., ., ., .] );
log2 = Log Capture(
obj2 = dt2 << Fit Model(
Y( :ls, :ha, :dt ),
Effects( :v1, :v2, :v3, :v4, :v5 ),
No Intercept,
Standardize X( 0 ),
Personality( "Partial Least Squares" ),
Run()
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
test = Contains( aftlst, "Report: Fit Model" );
If( test > 0,
Window( aftlst[test] ) << Close Window
);
Code Explanation:
- Create associative array.
- Open data table;
- Set v1 values to missing.
- Set ls values.
- Start log capture.
- Fit model with PLS personality.
- End log capture.
- Update associative array.
- Remove unchanged windows.
- Check for "Report: Fit Model".
Example 20
Summary: Fits a model to a data table, capturing window titles before and after the fit, and closing individual windows.
Code:
dt = Open("data_table.jmp");
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
obj = dt << Fit Model(
Y( :weight ),
Effects( :height, :age vector & random ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Run
)
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
Window( aftlst[i] ) << Close Window( 1 )
);
Code Explanation:
- Open data table.
- Capture initial window titles.
- Start logging.
- Fit model with REML method.
- Stop logging.
- Capture final window titles.
- Remove initial titles from final list.
- Get remaining window keys.
- Loop through remaining windows.
- Close each window.
Example 21
Summary: Fits a model and extracting relevant tables from the results, while maintaining a record of window titles throughout the analysis.
Code:
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
obj = Fit Model( Effects( :Process, :Site, :Process * :Site ), Personality( Response Screening ), Y( Column Group( "Responses" ) ), Run );
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "PValues" ),
dt2 = Data Table( aftlst[i] )
);
If( Contains( aftlst[i], "Y Fits" ),
dt3 = Data Table( aftlst[i] )
);
);
Close( dt, no save );
Code Explanation:
- Open data table;
- Store initial window titles.
- Fit model with specified effects.
- Store updated window titles.
- Remove initial titles from updated list.
- Get remaining window titles.
- Loop through window titles.
- Identify "PValues" window.
- Assign "PValues" table to dt2.
- Identify "Y Fits" window.
- Assign "Y Fits" table to dt3.
- Close original dataset without saving.
Example 22
Summary: Runs the analysis process by opening a data table, fitting a model with specified effects, and extracting relevant tables from window titles.
Code:
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
obj = Fit Model( Effects( :Process, :Site, :Process * :Site ), Personality( Response Screening ), Y( Column Group( "Responses" ) ), Run );
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "PValues" ),
dt2 = Data Table( aftlst[i] )
);
If( Contains( aftlst[i], "Y Fits" ),
dt3 = Data Table( aftlst[i] )
);
);
Code Explanation:
- Open data table;
- Create associative array before analysis.
- Fit model with specified effects.
- Create associative array after analysis.
- Remove unchanged windows from array.
- Get list of remaining window keys.
- Loop through each window key.
- Check for "PValues" in window title.
- Assign PValues table to dt2.
- Check for "Y Fits" in window title.
- Assign Y Fits table to dt3.
Example 23
Summary: Fits a model to data, saving effect tests and overall fit, and comparing new and old windows in JMP.
Code:
Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
test = Is Scriptable(
obj = Fit Model( Y( :ABRASION, :HARDNESS ), Effects( :SILICA, :SILANE, :SULFUR ), Personality( Response Screening ), Run )
);
obj << Save Effect Tests;
obj << Save Overall Fit;
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "Effect Tests" ),
dt2 = Data Table( aftlst[i] )
);
If( Contains( aftlst[i], "Y Fits" ),
dt3 = Data Table( aftlst[i] )
);
);
Code Explanation:
- Open data_table data
- Create associative array of windows.
- Check if scriptable.
- Fit model with ABRASION, HARDNESS as Y.
- Add SILICA, SILANE, SULFUR as effects.
- Use Response Screening personality.
- Run the model.
- Save effect tests.
- Save overall fit.
- Compare new and old windows.
Example 24
Summary: Fits models, saving effect tests and overall fit, and generating data tables for abrasion and hardness analysis.
Code:
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
test = Is Scriptable(
obj = Fit Model( Y( :ABRASION, :HARDNESS ), Effects( :SILICA, :SILANE, :SULFUR ), Personality( Response Screening ), Run )
);
obj << Save Effect Tests;
obj << Save Overall Fit;
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "Effect Tests" ),
dt2 = Data Table( aftlst[i] )
);
If( Contains( aftlst[i], "Y Fits" ),
dt3 = Data Table( aftlst[i] )
);
);
Close( dt, no save );
Close( dt2, no save );
Close( dt3, no save );
dt = Open("data_table.jmp");
test = Is Scriptable( obj = Fit Model( Model Dialog ) );
Close( dt, no save );
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
test = Is Scriptable( obj = Response Screening( Y( :Height, :Weight ), X( :Age, :Sex ) ) );
obj << Save PValues;
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "PValues" ),
dt2 = Data Table( aftlst[i] )
)
);
Code Explanation:
- Open data table;
- Create associative array before script.
- Fit model for abrasion and hardness.
- Save effect tests.
- Save overall fit.
- Create associative array after script.
- Remove before array from after array.
- Get keys from after array.
- Loop through keys.
- Check for "Effect Tests" and "Y Fits".
- Close all data tables without saving.
- Reopen data_table.jmp.
- Fit model using Model Dialog.
- Close data_table.jmp without saving.
- Open data table;
- Create associative array before script.
- Perform response screening on height and weight.
- Save p-values.
- Create associative array after script.
- Remove before array from after array.
- Get keys from after array.
- Loop through keys.
- Check for "PValues".
Fit Model using Exclude
Summary: Fits a linear model to a dataset, extracting sigma2 values, and visualizing studentized residuals.
Code:
dt = Open("data_table.jmp");
dt << select where( :height < 60 );
s = dt << get selected rows;
dt << Exclude( 1 );
For( i = 1, i <= N Rows( dt ), i++,
dt << Select Rows( i );
dt << Exclude( 1 );
obj = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
invisible,
Run
);
rpt = obj << report;
sigma2 = ((rpt[Outline Box( "Summary of Fit" )][Table Box( 1 )] << get as matrix)[3, 1]);
dt << Clear Row States( 1 );
dt << Select Rows( s );
dt << Exclude( 1 );
dt << Clear Select;
);
dt << New Column( "sigma_i", values( sigma2 ) );
obj2 = dt << Fit Model(
Y( :weight ),
Effects( :age, :sex, :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run
);
rpt2 = obj2 << report;
obj2 << Save Columns( Residuals );
obj2 << Save Columns( Hats );
dt << New Column( "Ext Studentized Resid", formula( :Residual weight / (:sigma_i * Sqrt( 1 - :h weight )) ) );
rmse = (rpt2["Summary of Fit"][Table Box( 1 )] << get as matrix)[3, 1];
dt << New Column( "Int Studentized Resid", formula( :Residual weight / (rmse * Sqrt( 1 - :h weight )) ) );
b ext resid = dt:Ext Studentized Resid << get values;
b int resid = dt:Int Studentized Resid << get values;
obj2 << Plot Studentized Residuals( 1 );
y = (rpt2[Outline Box( "Studentized Residuals" )][FrameBox( 1 )] << Find Seg( Marker Seg( 1 ) )) << Get Y Values;
obj2 << Externally Studentized Residuals( 1 );
ext resid = dt:Externally Studentized Residuals weight << get values;
obj2 << Studentized Residuals( 1 );
int resid = dt:Studentized Resid weight << get values;
Code Explanation:
- Open table.
- Select rows where height < 60.
- Get selected rows.
- Exclude selected rows.
- Loop through all rows.
- Select current row.
- Exclude current row.
- Fit model with specified effects.
- Get report from model.
- Extract sigma2 value.
- Clear row states.
- Re-select excluded rows.
- Exclude rows again.
- Clear selection.
- Create new column for sigma_i.
- Fit model again.
- Get report from second model.
- Save residuals and hats.
- Create new column for Ext Studentized Resid.
- Extract RMSE value.
- Create new column for Int Studentized Resid.
- Get values of Ext Studentized Resid.
- Get values of Int Studentized Resid.
- Plot Studentized Residuals.
- Find Y values of plot.
- Calculate externally studentized residuals.
- Get values of externally studentized residuals.
- Calculate internally studentized residuals.
- Get values of internally studentized residuals.
Fit Model using Set Modeling Type
Example 1
Summary: Fits an ordinal logistic model to a data table, capturing window titles and removing initial titles from the final list.
Code:
dt = Open("data_table.jmp");
dt:season << Set Modeling Type( "ordinal" );
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model( Y( :season ), Effects( :species, :subject[:species] & Random, :season ), Personality( "Ordinal Logistic" ), Run )
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Close( dt, no save );
If( Contains( JMP Product Name(), "Pro" ) > 0,
b log1 = "Random or secondary effects specified in a fitting personality that does not support them",
b log1 = "The fitting personality \!"Partial Least Squares\!" is available only in JMP Pro."
);
Code Explanation:
- Open data table;
- Set season as ordinal.
- Capture initial window titles.
- Fit ordinal logistic model.
- Capture final window titles.
- Remove initial titles from final list.
- Get remaining window keys.
- Close the first remaining window if any.
- Close the dataset without saving.
- Check for JMP Pro version.
Example 2
Summary: Fits an ordinal logistic model to examine the relationship between season and species, capturing log information during the process.
Code:
dt = Open("data_table.jmp");
dt:season << Set Modeling Type( "ordinal" );
befAA = Associative Array( Window() << get window title );
log1 = Log Capture(
dt << Fit Model( Y( :season ), Effects( :species, :subject[:species] & Random, :season ), Personality( "Ordinal Logistic" ), Run )
);
aftAA = Associative Array( Window() << get window title );
aftAA << Remove( befAA );
aftlst = aftAA << get keys;
Try( If( Is Empty( aftlst ) == 0, Window( aftlst[1] ) << close window( 1 ) ) );
Code Explanation:
- Open data table;
- Set "season" column to ordinal.
- Create associative array before model fit.
- Capture log during model fitting.
- Fit ordinal logistic model.
- Create associative array after model fit.
- Remove pre-model windows from associative array.
- Get keys from post-model associative array.
- Close the first remaining window if exists.
Example 3
Summary: Runs a nominal logistic regression model to predict the probability of 'High' target level based on various effects, including Age, Gender, BMI, and others, using JMP's Fit Model platform.
Code:
dt = Open("data_table.jmp");
dt:Y Ordinal << Set Modeling Type( "Nominal" );
obj = dt << Fit Model(
Y( :Y Ordinal ),
Effects( :Age, :Gender, BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Nominal Logistic" ),
Target Level( "High" ),
Run
);
obj << Decision Threshold( 1 );
rpt = obj << report;
test1 = Try( rpt["Decision Tresholds"] << get title, 1 );
Code Explanation:
- Open data table;
- Set Y Ordinal as Nominal.
- Start Fit Model process.
- Specify Y as Y Ordinal.
- Include Age, Gender, BMI, BP, Total Cholesterol, LDL, HDL, TCH, LTG, Glucose as effects.
- Choose Nominal Logistic personality.
- Set target level as High.
- Run the model.
- Set decision threshold to 1.
- Retrieve report and check for "Decision Tresholds" title.
Example 4
Summary: Fits an ordinal logistic model to analyze the relationship between Type and Weight, with Turning Circle as a covariate, for vehicles from Japan.
Code:
dt = Open("data_table.jmp");
dt:Type << Set Modeling Type( "Ordinal" );
obj1 = dt << Fit Model(
Y( :Type ),
Effects( :Weight, :Turning Circle ),
Where( :Country == "Japan" ),
Personality( "Ordinal Logistic" ),
Run
);
obj1 << Save Probability Formula( 1 );
b save1 = (dt:Name( "Prob[Sporty] Where" ) << get values) || (dt:Name( "Prob[Small] Where" ) << get values) || (dt
:Name( "Prob[Compact] Where" ) << get values) || (dt:Name( "Prob[Medium] Where" ) << get values) || (dt:Name( "Prob[Large] Where" ) <<
get values);
Code Explanation:
- Open table.
- Set modeling type.
- Fit ordinal logistic model.
- Specify response variable.
- Include effects.
- Apply country filter.
- Use ordinal personality.
- Run the model.
- Save probability formula.
- Extract probability values.
Example 5
Summary: Fits an ordinal logistic model to analyze the relationship between Type, Weight, and Turning Circle in a dataset filtered by Country == USA.
Code:
dt = Open("data_table.jmp");
dt:Type << Set Modeling Type( "Ordinal" );
obj1 = dt << Fit Model(
Y( :Type ),
Effects( :Weight, :Turning Circle ),
Where( :Country == "USA" ),
Personality( "Ordinal Logistic" ),
Run
);
obj1 << Save Probability Formula( 1 );
b save2 = (dt:Name( "Prob[Sporty] Where" ) << get values) || (dt:Name( "Prob[Small] Where" ) << get values) || (dt
:Name( "Prob[Compact] Where" ) << get values) || (dt:Name( "Prob[Medium] Where" ) << get values) || (dt:Name( "Prob[Large] Where" ) <<
get values);
Code Explanation:
- Open data table;
- Set Type modeling type to Ordinal.
- Fit ordinal logistic model.
- Include Weight and Turning Circle effects.
- Filter data for Country == USA.
- Run the model.
- Save probability formula.
- Extract Prob[Sporty] values.
- Extract Prob[Small] values.
- Concatenate all probability values.
Example 6
Summary: Fits an ordinal logistic model to analyze the relationship between Type, Weight, and Turning Circle in a filtered dataset where Country is 'Other', and saves the probability formula.
Code:
dt = Open("data_table.jmp");
dt:Type << Set Modeling Type( "Ordinal" );
obj1 = dt << Fit Model(
Y( :Type ),
Effects( :Weight, :Turning Circle ),
Where( :Country == "Other" ),
Personality( "Ordinal Logistic" ),
Run
);
obj1 << Save Probability Formula( 1 );
b save3 = (dt:Name( "Prob[Sporty] Where" ) << get values) || (dt:Name( "Prob[Small] Where" ) << get values) || (dt
:Name( "Prob[Compact] Where" ) << get values) || (dt:Name( "Prob[Medium] Where" ) << get values) || (dt:Name( "Prob[Large] Where" ) <<
get values);
Code Explanation:
- Open table.
- Set modeling type ordinal.
- Fit ordinal logistic model.
- Include specific effects.
- Apply country filter.
- Run model.
- Save probability formula.
- Extract probability values.
- Concatenate probability arrays.
Example 7
Summary: Fits an ordinal logistic model to analyze the relationship between Type and Weight, with Turning Circle as a covariate, by Country, and saves probability formulas for each country.
Code:
dt = Open("data_table.jmp");
dt:Type << Set Modeling Type( "Ordinal" );
val = dt:Country << get values;
obj = dt << Fit Model( Y( :Type ), Effects( :Weight, :Turning Circle ), by( :Country ), Personality( "Ordinal Logistic" ), Run );
obj << Save Probability Formula( 1 );
save = (dt:Name( "Prob[Sporty] By Country" ) << get values) || (dt:Name( "Prob[Small] By Country" ) << get values) || (dt
:Name( "Prob[Compact] By Country" ) << get values) || (dt:Name( "Prob[Medium] By Country" ) << get values) || (dt
:Name( "Prob[Large] By Country" ) << get values);
For( i = 1, i <= N Items( val ), i++,
Match( val[i], "Japan", , "USA", , "Other", )
);
Code Explanation:
- Open table.
- Set modeling type.
- Get country values.
- Fit ordinal logistic model.
- Save probability formula.
- Concatenate probability values.
- Loop through country values.
- Match country values.
Example 8
Summary: Analyze ordinal logistic regression model predictions using Prediction Profiler and saves bagged predictions.
Code:
dt = Open("data_table.jmp");
:Sex << Set Modeling Type( "Ordinal" );
obj = Fit Model( Y( :sex ), Effects( :height, :weight ), Personality( "Ordinal Logistic" ), Run( Profiler( 1 ) ) );
rpt = obj << report;
scptObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object;
scptObj << Save Bagged Predictions( 2 );
n = dt << Get Column Names( string );
col1 = Contains( n, "Pred Formula sex=F Bagged Mean" );
col2 = Contains( n, "sex=F Bootstrap Std Err" );
col3 = Contains( n, "StdError sex=F Bagged Mean" );
Code Explanation:
- Open data table;
- Set Sex modeling type to Ordinal.
- Fit Ordinal Logistic model.
- Run Prediction Profiler.
- Extract report object.
- Get Prediction Profiler scriptable object.
- Save Bagged Predictions.
- Retrieve column names from dataset.
- Check for "Pred Formula sex=F Bagged Mean".
- Check for "sex=F Bootstrap Std Err".
- Check for "StdError sex=F Bagged Mean".
Example 9
Summary: Fits an ordinal logistic model to predict sex based on height and weight, generating a prediction profiler report with bagged predictions.
Code:
dt = Open("data_table.jmp");
:Sex << Set Modeling Type( "Ordinal" );
obj = Fit Model( Y( :sex ), Effects( :height, :weight ), Personality( "Ordinal Logistic" ), Run( Profiler( 1 ) ) );
rpt = obj << report;
scptObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object;
scptObj << Save Bagged Predictions( 2, Random Seed( 12345 ) );
latest = Column( "Pred Formula sex=F Bagged Mean" ) << getasmatrix;
Close( dt, nosave );
previous = [0.0000466518950843597, 0.00396672485296142, 0.00486116581691323, 0.0424610911345717, 0.044098968754727, 0.0447115319786343,
0.0463189462498474, 0.087799166915582, 0.0903526022466633, 0.100926733882372, 0.106483411245844, 0.107196962640889, 0.0246004165222032,
0.0696393864083769, 0.155811400305345, 0.183501618157499, 0.332461559167312, 0.375996332034806, 0.381641359259519, 0.547627277814303,
0.601608456150515, 0.628920852025775, 0.087780354712625, 0.136533128103669, 0.237098943175992, 0.313690562280029, 0.431802410916644,
0.509208392539839, 0.511705758230795, 0.517882730568811, 0.726980349739599, 0.728954720712524, 0.74391377783697, 0.760501007158788,
0.762659883759114, 0.867363650807755, 0.952466503304748];
Code Explanation:
- Open data table.
- Set Sex modeling type.
- Fit ordinal logistic model.
- Generate prediction profiler.
- Retrieve report object.
- Access prediction profiler scriptable object.
- Save bagged predictions.
- Extract latest predictions matrix.
- Close data table without saving.
- Define previous predictions array.
Example 10
Summary: Analyze ordinal logistic regression with bagged predictions for a given dataset, utilizing the Prediction Profiler to visualize and extract results.
Code:
dt = Open("data_table.jmp");
:Sex << Set Modeling Type( "Ordinal" );
obj = Fit Model( Y( :sex ), Effects( :height, :weight ), Personality( "Ordinal Logistic" ), Run( Profiler( 1 ) ) );
rpt = obj << report;
scptObj = rpt[Outline Box( "Prediction Profiler" )] << get scriptable object;
scptObj << Save Bagged Predictions( 2, Random Seed( 12345 ) );
latest = Column( "Pred Formula sex=F Bagged Mean" ) << getasmatrix;
Code Explanation:
- Open data table.
- Set modeling type for Sex.
- Fit ordinal logistic model.
- Run profiler.
- Extract report.
- Get prediction profiler object.
- Save bagged predictions.
- Retrieve latest predictions matrix.
Example 11
Summary: Fits a model to examine the relationship between diameter and day, while also extracting specific dates from the journal.
Code:
dt = Open("data_table.jmp");
dt:DAY << Set Modeling Type( "Continuous" );
obj = dt << Fit Model(
Y( :DIAMETER ),
Effects( :DAY, :OPERATOR, :DAY * :OPERATOR ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
Run(
:DIAMETER << {Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Tests( 0 ), Effect Details( 0 ),
Lack of Fit( 0 ), Scaled Estimates( 0 ), Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ),
Profiler( 1, Confidence Intervals( 1 ), Interaction Profiler( 1 ) )},
Effect Summary( 0 )
)
);
rpt = obj << report;
journal = rpt << get journal;
count = 0;
For( i = 1, i <= Length( journal ), i++,
pos = Contains( journal, "05/01/1998", i );
i = pos + 1;
If( pos == 0, Break() );
count++;
);
If( count == 1,
pos = Contains( journal, "05/01/1998" )
);
count = 0;
For( i = 1, i <= Length( journal ), i++,
pos = Contains( journal, "06/09/1998", i );
i = pos + 1;
If( pos == 0, Break() );
count++;
);
If( count == 1,
pos = Contains( journal, "06/09/1998" )
);
Code Explanation:
- Open table.
- Set DAY as continuous.
- Fit model with DAY, OPERATOR, and interaction.
- Use Standard Least Squares personality.
- Minimal report emphasis.
- Disable most reports.
- Enable Profiler with confidence intervals and interaction.
- Disable Effect Summary.
- Get report.
- Count occurrences of specific dates in journal.
Fit Model using Random Uniform
Summary: Process of performing nonlinear modeling and linear modeling on a data table, generating reports and extracting estimates, standard errors, sum of squares, degrees of freedom, mean square error, and root mean square error.
Code:
dt = Open("data_table.jmp");
frequencies = J( 40, 1, Random Uniform( 0, 2 ) );
dt << New Column( "Fractional Frequencies", Set Values( frequencies ) );
obj1 = dt << Nonlinear(
Y( :height ),
Model( Parameter( {a = 50, b = 0.12}, a + b * :weight ) ),
Freq( :Fractional Frequencies ),
Newton,
Finish
);
rpt1 = obj1 << report;
est1 = Matrix( rpt1[Number Col Box( "Estimate" )] << get );
std1 = Matrix( rpt1[Number Col Box( "ApproxStdErr" )] << get );
sse1 = Matrix( rpt1[Number Col Box( "SSE" )] << get );
df1 = Matrix( rpt1[Number Col Box( "DFE" )] << get );
mse1 = Matrix( rpt1[Number Col Box( "MSE" )] << get );
rmse1 = Matrix( rpt1[Number Col Box( "RMSE" )] << get );
obj2 = dt << Fit Model(
Freq( :Fractional Frequencies ),
Y( :height ),
Effects( :weight ),
Personality( Standard Least Squares ),
Emphasis( Effect Leverage ),
Run
);
rpt2 = obj2 << report;
est2 = Matrix( rpt2[Number Col Box( "Estimate" )] << get );
std2 = Matrix( rpt2[Number Col Box( "Std Error" )] << get );
sse2 = Matrix( (rpt2[Outline Box( "Analysis of Variance" )][Number Col Box( "Sum of Squares" )] << get)[2] );
df2 = Matrix( (rpt2[Outline Box( "Analysis of Variance" )][Number Col Box( "DF" )] << get)[2] );
mse2 = Matrix( (rpt2[Outline Box( "Analysis of Variance" )][Number Col Box( "Mean Square" )] << get)[2] );
rmse2 = Matrix( (rpt2[Outline Box( "Summary of Fit" )][Number Col Box( 1 )] << get)[3] );
Code Explanation:
- Open data table.
- Generate random frequencies.
- Add new column for frequencies.
- Perform nonlinear modeling.
- Extract model report.
- Retrieve parameter estimates.
- Retrieve standard errors.
- Retrieve sum of squares.
- Retrieve degrees of freedom.
- Retrieve mean square error.
- Retrieve root mean square error.
- Perform linear modeling.
- Extract model report.
- Retrieve parameter estimates.
- Retrieve standard errors.
- Retrieve sum of squares.
- Retrieve degrees of freedom.
- Retrieve mean square error.
- Retrieve root mean square error.
Fit Model using Add Properties to Table
Summary: Process of adding a constraint script to a data table and launching the Fit Model platform for analysis, with emphasis on effect screening.
Code:
dt1 = Open("data_table.jmp");
dt1 << Add Properties to Table( {New Script( "Constraint", {1 * :LDL + 1 * :HDL <= 200} )} );
obj1 = dt1 << Fit Model(
Y( :Y ),
Effects( :Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run( Profiler( 1 ) )
);
Code Explanation:
- Open data table;
- Add constraint script.
- Launch Fit Model platform.
- Set response variable.
- Define model effects.
- Choose Standard Least Squares personality.
- Set Effect Screening emphasis.
- Run the model.
- Generate Profiler.
- Display Profiler window.
Fit Model using Subset
Summary: Runs time series forecasting and report generation for a subset of data based on seasonality, utilizing JMP's Time Series Forecasting feature.
Code:
dt1 = Open("data_table.jmp");
dt2 = dt1 << Subset( All rows, Selected columns only( 0 ) );
s1 = dt1 << Select Where( :Season < 7 );
dt1 << Exclude;
obj1 = dt1 << Time Series Forecast( Y( :Log Passengers, :Passengers ), Fit Model( NAhead( 10 ), Seasonality( 12 ), NHoldout( 0 ) ) );
rpt1 = obj1 << report;
test1 = rpt1[Outline Box( "Model Summary" )][Table Box( 1 )] << get as matrix;
s2 = dt2 << Select Where( :Season < 7 );
dt2 << Delete Rows;
obj2 = dt2 << Time Series Forecast( Y( :Log Passengers, :Passengers ), Fit Model( NAhead( 10 ), Seasonality( 12 ), NHoldout( 0 ) ) );
rpt2 = obj2 << report;
test2 = rpt2[Outline Box( "Model Summary" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open table.
- Subset all rows.
- Select where season < 7.
- Exclude selected rows.
- Fit time series forecast.
- Get model summary report.
- Convert report to matrix.
- Select where season < 7 in subset.
- Delete selected rows.
- Fit time series forecast on subset.
Fit Model using Data Table
Example 1
Summary: Process of forecasting time series data using a stacked data column and selecting specific rows based on seasonality, then generates a model summary report.
Code:
dt1 = Open("data_table.jmp");
dt2 = Data Table("data_table") << Stack(
columns( :Passengers, :Log Passengers ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Stack By Row( 0 )
);
dt3 = dt2 << Subset( All rows, Selected columns only( 0 ) );
s1 = dt2 << Select Where( :Season < 7 );
dt2 << Exclude;
obj1 = dt2 << Time Series Forecast( Y( :Data ), Grouping( :Label ), Fit Model( NAhead( 10 ), Seasonality( 12 ), NHoldout( 0 ) ) );
rpt1 = obj1 << report;
test1 = rpt1[Outline Box( "Model Summary" )][Table Box( 1 )] << get as matrix;
s3 = dt3 << Select Where( :Season < 7 );
dt3 << Delete Rows;
obj2 = dt3 << Time Series Forecast( Y( :Data ), Grouping( :Label ), Fit Model( NAhead( 10 ), Seasonality( 12 ), NHoldout( 0 ) ) );
rpt2 = obj2 << report;
test2 = rpt2[Outline Box( "Model Summary" )][Table Box( 1 )] << get as matrix;
Close( dt3, no save );
Code Explanation:
- Open data_table data
- Stack columns into new table.
- Subset all rows, selected columns.
- Select where season less than 7.
- Exclude selected rows.
- Perform time series forecast on dt2.
- Extract model summary report.
- Get model summary as matrix.
- Select where season less than 7 in dt3.
- Delete selected rows in dt3.
Example 2
Summary: Runs time series forecasting and model summarization for a subset of data, utilizing the Time Series Forecast platform in JMP.
Code:
dt1 = Open("data_table.jmp");
dt2 = Data Table("data_table") << Stack(
columns( :Passengers, :Log Passengers ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Stack By Row( 0 )
);
dt3 = dt2 << Subset( All rows, Selected columns only( 0 ) );
s1 = dt2 << Select Where( :Season < 7 );
dt2 << Exclude;
obj1 = dt2 << Time Series Forecast( Y( :Data ), Grouping( :Label ), Fit Model( NAhead( 10 ), Seasonality( 12 ), NHoldout( 0 ) ) );
rpt1 = obj1 << report;
test1 = rpt1[Outline Box( "Model Summary" )][Table Box( 1 )] << get as matrix;
s3 = dt3 << Select Where( :Season < 7 );
dt3 << Delete Rows;
obj2 = dt3 << Time Series Forecast( Y( :Data ), Grouping( :Label ), Fit Model( NAhead( 10 ), Seasonality( 12 ), NHoldout( 0 ) ) );
rpt2 = obj2 << report;
test2 = rpt2[Outline Box( "Model Summary" )][Table Box( 1 )] << get as matrix;
Code Explanation:
- Open data table;
- Stack columns "Passengers", "Log Passengers".
- Create subset of all rows.
- Select rows where :Season < 7.
- Exclude selected rows.
- Perform time series forecast on remaining data.
- Retrieve model summary from first forecast.
- Select rows where :Season < 7 in subset.
- Delete selected rows in subset.
- Perform time series forecast on modified subset data.
Fit Model using Is Scriptable
Summary: Process of checking scriptability for a model dialog fit in JMP, ensuring seamless integration with data tables.
Code:
dt = Open("data_table.jmp");
test = Is Scriptable( obj = Fit Model( Model Dialog ) );
Code Explanation:
- Open data table;
- Check if scriptable.
- Fit model dialog.
Fit Model using V List Box
Summary: Creates an interactive ANOVA GUI, allowing users to select response and factor columns and generate a report.
Code:
dt = Open("data_table.jmp");
// Create a placeholder for the report
reportBox = V List Box();
New Window("ANOVA GUI",
Panel Box("Select Columns",
Lineup Box(NCol(2),
Text Box("Response Column:"),
cbResponse = Combo Box(dt << Get Column Names( numeric, string ), <<Set Width(150)),
Text Box("Factor Column:"),
cbFactor = Combo Box(dt << Get Column Names( character, string ), <<Set Width(150))
),
Button Box("Run ANOVA",
responseColName = cbResponse << Get Selected;
factorColName = cbFactor << Get Selected;
If(
Is Missing(responseColName) | Is Missing(factorColName),
New Window("Error", Text Box("Please select both a response and a factor column.")),
// Run the Fit Model platform
modelReport = dt << Fit Model(
Y( Eval( Column(responseColName) ) ),
Effects( Eval( Column(factorColName) ) ),
Personality("Standard Least Squares"),
Emphasis("Minimal Report"),
Run
);
// Extract the report and insert it into the placeholder
report = modelReport << Report;
reportBox << Prepend(report);
modelReport << Close window;
// pare the placeholder back down to just one item if necessary
if (n items (reportBox) > 1, reportBox[2] << Delete;);
// Window("ANOVA GUI 22")["Response weight"]
// reportbox << XPath("//OutlineBox[1]") << Close window;
)
),
reportBox
)
);
Code Explanation:
- Open data table.
- Create placeholder for report.
- Initialize new window.
- Add panel for column selection.
- Add lineup box for input fields.
- Add combo box for response column.
- Add combo box for factor column.
- Add button to run ANOVA.
- Retrieve selected column names.
- Check for missing selections.
- Run Fit Model platform.
- Extract report from model.
- Insert report into placeholder.
- Close model report window.
- Ensure only one report in placeholder.