Multivariate
Example 1
Summary: Calculates multivariate correlations between various anthropometric measurements, generating a scatterplot matrix with density ellipses and Mahalanobis distances.
Code:
// Multivariate Correlations
// Open data table
dt = Open("data_table.jmp");
// Multivariate Correlations
Multivariate(
Y(
:"Age (years)"n, :"Weight (lbs)"n,
:"Height (inches)"n,
:"Neck circumference (cm)"n,
:"Chest circumference (cm)"n,
:"Abdomen circumference (cm)"n,
:"Hip circumference (cm)"n,
:"Thigh circumference (cm)"n,
:"Knee circumference (cm)"n,
:"Ankle circumference (cm)"n,
:
"Biceps (extended) circumference (cm)"n,
:"Forearm circumference (cm)"n,
:"Wrist circumference (cm)"n
),
Estimation Method( "Row-wise" ),
Scatterplot Matrix(
Density Ellipses( 1 ),
Shaded Ellipses( 0 ),
Ellipse Color( 3 )
),
Mahalanobis Distances( 1 )
);
Code Explanation:
- Open table.
- Define multivariate analysis.
- Specify response variables.
- Set estimation method.
- Create scatterplot matrix.
- Enable density ellipses.
- Disable shaded ellipses.
- Set ellipse color.
- Calculate Mahalanobis distances.
Example 2
Summary: Generates a factor score correlation matrix for a set of variables, using the Multivariate platform in JMP to visualize relationships between Privacy, Security, Reputation, Trust, and Purchase Intent.
Code:
// Factor Score Correlations
// Open data table
dt = Open("data_table.jmp");
// Factor Score Correlations
Multivariate(
Y(
:Privacy, :Security, :Reputation,
:Trust, :Purchase Int
),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix(
Density Ellipses( 0 ),
Shaded Ellipses( 0 )
),
Color Map on Correlations( 1 )
);
Code Explanation:
- Open data table.
- Define analysis variables.
- Perform multivariate analysis.
- Set estimation method.
- Specify matrix format.
- Generate scatterplot matrix.
- Disable density ellipses.
- Disable shaded ellipses.
- Enable color map on correlations.
Example 3
Summary: Visualizes the relationship between multiple variables in a multivariate analysis, using row-wise estimation and scatterplot matrices with density ellipses to identify correlations.
Code:
// Multivariate
// Open data table
dt = Open("data_table.jmp");
// Multivariate
Multivariate(
Y( :Tmax2, :z2, :Fi2 ),
Estimation Method( "Row-wise" ),
Scatterplot Matrix(
Density Ellipses( 1 ),
Shaded Ellipses( 0 )
),
SendToReport(
Dispatch( {"Scatterplot Matrix"},
"102", ScaleBox,
{Min( 0.385563909774436 ),
Max( 0.576842105263158 ),
Inc( 0.025 ),
Minor Ticks( 0 )}
),
Dispatch( {"Scatterplot Matrix"},
"101", ScaleBox,
{Min( 0.5675 ),
Max( 0.636453182118107 ),
Inc( 0.01 ), Minor Ticks( 0 )
}
),
Dispatch( {"Scatterplot Matrix"},
"100", ScaleBox,
{Min( 272.586320371566 ),
Max( 292.665882156916 ),
Inc( 5 ), Minor Ticks( 1 )}
)
)
);
Code Explanation:
- Open table.
- Define variables.
- Run Multivariate analysis.
- Specify response variables.
- Set estimation method.
- Create scatterplot matrix.
- Add density ellipses.
- Remove shaded ellipses.
- Adjust scale for first variable.
- Adjust scale for second variable.
- Adjust scale for third variable.
Example 4
Summary: Opens a data table, performs a multivariate analysis with row-wise estimation method, and generates a scatterplot matrix with density ellipses and custom ellipse color.
Code:
// Multivariate
// Open data table
dt = Open("data_table.jmp");
// Multivariate
Multivariate(
Y(
:Thickness 01, :Thickness 02,
:Thickness 03, :Thickness 04,
:Thickness 05, :Thickness 06,
:Thickness 07, :Thickness 08,
:Thickness 09, :Thickness 10,
:Thickness 11, :Thickness 12
),
Estimation Method( "Row-wise" ),
Scatterplot Matrix(
Density Ellipses( 1 ),
Shaded Ellipses( 0 ),
Ellipse Color( 3 )
)
);
Code Explanation:
- Open table.
- Define data table variable.
- Run Multivariate analysis.
- Specify response variables.
- Set estimation method.
- Generate scatterplot matrix.
- Add density ellipses.
- Disable shaded ellipses.
- Set ellipse color.
Example 5
Summary: Generates a scatterplot matrix to visualize the relationships between Aperture, Ranging, Cadence, and Yield variables in a data table, with density ellipses displayed for each pair of columns.
Code:
// Scatterplot matrix
// Open data table
dt = Open("data_table.jmp");
// Scatterplot matrix
Multivariate(
Columns(
:Aperture, :Ranging, :Cadence,
:Yield
),
Scatterplot Matrix(
Density Ellipses( 1 ),
Ellipse Color( 3 )
)
);
Code Explanation:
- Open data table.
- Create scatterplot matrix.
- Select columns for analysis.
- Display density ellipses.
- Set ellipse color.
Example 6
Summary: Opens a data table, specifies columns for multivariate analysis, and creates a scatterplot matrix with density ellipses to visualize relationships between variables.
Code:
// Multivariate
// Open data table
dt = Open("data_table.jmp");
// Multivariate
Multivariate(
Columns(
:Ether, :"1-Octanol"n,
:Carbon Tetrachloride, :Benzene,
:Hexane, :Chloroform
),
Scatterplot Matrix(
Density Ellipses( 1 ),
Ellipse Color( 3 )
)
);
Code Explanation:
- Open table.
- Call Multivariate function.
- Specify columns.
- Create Scatterplot Matrix.
- Enable Density Ellipses.
- Set Ellipse Color.
Example 7
Summary: Opens a data table, performs multivariate analysis with row-wise estimation, and generates a scatterplot matrix with density ellipses, shaded ellipses disabled, vertical orientation, and ellipse color set to 3. The script also enables the color map on correlations.
Code:
// Multivariate
// Open data table
dt = Open("data_table.jmp");
// Multivariate
Multivariate(
Y(
:Disso, :Mill Time, :Blend Time,
:Blend Speed, :Force,
:Coating Viscosity, :Inlet Temp,
:Exhaust Temp, :Spray Rate,
:Atomizer Pressure
),
Estimation Method( "Row-wise" ),
Scatterplot Matrix(
Density Ellipses( 1 ),
Shaded Ellipses( 0 ),
Vertical( 1 ),
Ellipse Color( 3 )
),
Color Map On Correlations( 1 )
);
Code Explanation:
- Open data table.
- Perform multivariate analysis.
- Set estimation method.
- Create scatterplot matrix.
- Enable density ellipses.
- Disable shaded ellipses.
- Set vertical orientation.
- Set ellipse color.
- Enable color map on correlations.
Example 8
Summary: Opens a data table, performs a multivariate analysis with pairwise estimation method, and generates a scatterplot matrix with density ellipses and custom ellipse color.
Code:
// Multivariate
// Open data table
dt = Open("data_table.jmp");
// Multivariate
Multivariate(
Y(
:Household Income, :IQ,
:Eighth Grade Math,
:High School Graduates,
:Gross State Product,
:Vegetable Consumption, :Smokers,
:Physical Activity, :Obese,
:College Degrees,
:Alcohol Consumption
),
Estimation Method( "Pairwise" ),
Scatterplot Matrix(
Density Ellipses( 1 ),
Shaded Ellipses( 0 ),
Ellipse Color( 3 )
)
);
Code Explanation:
- Open table.
- Define variables.
- Run Multivariate analysis.
- Specify Y variables.
- Set estimation method.
- Generate scatterplot matrix.
- Add density ellipses.
- Disable shaded ellipses.
- Set ellipse color.
Example 9
Summary: Creates a multivariate analysis object with row-wise estimation method, scatterplot matrix, and customized report title.
Code:
dt under test = Open("data_table.jmp");
obj = Multivariate(
Y( :Discus, :Pole Vault, :Javelin, :Name( "1500m" ) ),
Estimation Method( "Row-wise" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
SendToReport(
Dispatch( {}, "Multivariate ", OutlineBox, {Set Title( "Time tick labels on Y axis" )} ),
Dispatch( {}, "Correlations", OutlineBox, {Close( 1 )} )
)
);
Code Explanation:
- Open data table;
- Create multivariate analysis object.
- Set response variables: Discus, Pole Vault, Javelin, 1500m.
- Use row-wise estimation method.
- Generate scatterplot matrix.
- Enable density ellipses.
- Disable shaded ellipses.
- Set ellipse color to blue.
- Set report title to "Time tick labels on Y axis".
- Close "Correlations" outline box.
Example 10
Summary: Generates a scatterplot matrix with density ellipses for multivariate analysis, filtered by specific conditions on the 'MW' column.
Code:
Open("data_table.jmp");
Multivariate(
Y( :Fuel, :Steam Flow, :Steam Temp ),
Estimation Method( "Row-wise" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
Local Data Filter( Add Filter( columns( :MW ), Where( :MW >= 20.1112 & :MW <= 21.78 ) ) )
);
Code Explanation:
- Open data table.
- Launch Multivariate analysis.
- Specify response variables.
- Set estimation method.
- Create scatterplot matrix.
- Enable density ellipses.
- Disable shaded ellipses.
- Set ellipse color.
- Add local data filter.
- Define filter conditions.
Example 11
Summary: Performs a multivariate analysis to visualize relationships between 12 variables, including Household Income, IQ, and Vegetable Consumption, using a pairwise estimation method and scatterplot matrix with density ellipses.
Code:
dt = Open("data_table.jmp");
Multivariate(
Y(
:Household Income, :IQ, :Eighth Grade Math, :High School Graduates, :Gross State Product, :Vegetable Consumption, :Smokers,
:Physical Activity, :Obese, :College Degrees, :Alcohol Consumption
),
Estimation Method( "Pairwise" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
Pairwise Correlations( 1 ),
Parallel Coord Plot,
Ellipsoid 3D Plot( :Household Income, :IQ, :Eighth Grade Math ),
SendToReport(
Dispatch( {"Ellipsoid 3D"}, "1", ScaleBox,
{Format(
"Custom",
Formula(
x = Char( value );
If( Ends With( x, "000" ),
Substr( x, 1, 2 ) || "K"
);
),
9
)}
)
)
);
Code Explanation:
- Open data table.
- Launch Multivariate analysis.
- Set response variables.
- Choose pairwise estimation method.
- Create scatterplot matrix.
- Enable density ellipses.
- Disable shaded ellipses.
- Set ellipse color.
- Generate pairwise correlations.
- Display parallel coordinates plot.
- Create 3D ellipsoid plot.
- Format axis labels.
Example 12
Summary: Performs a multivariate analysis to visualize the relationship between multiple response variables, utilizing row-wise estimation and a scatterplot matrix with density ellipses.
Code:
dt = Open("data_table.jmp");
dt << Multivariate(
Y( :height, :weight ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Horizontal( 1 ), Ellipse Color( 3 ) )
);
Code Explanation:
- Open table.
- Run Multivariate analysis.
- Set response variables.
- Choose Row-wise estimation.
- Select Square matrix format.
- Create Scatterplot Matrix.
- Add Density Ellipses.
- Disable Shaded Ellipses.
- Enable Horizontal display.
- Set Ellipse Color.
Example 13
Summary: Runs the multivariate analysis of a data table, generating a scatterplot matrix with row-wise estimation and customizable density ellipses.
Code:
Names Default To Here( 1 );
dt = Open("data_table.jmp");
obj = Multivariate( Y( :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ) );
Code Explanation:
- Set default names.
- Open data table.
- Perform multivariate analysis.
Example 14
Summary: Performs a multivariate analysis to visualize the relationship between thigh thickness and mass, utilizing row-wise estimation method, scatterplot matrix with density ellipses, and parallel coordinate plot.
Code:
Open("data_table.jmp");
Multivariate(
Y( :Thigh, :Mass ),
Estimation Method( "Row-wise" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
Parallel Coord Plot
);
Code Explanation:
- Open data table;
- Launch Multivariate analysis platform.
- Set response variables.
- Choose row-wise estimation method.
- Create scatterplot matrix.
- Enable density ellipses.
- Disable shaded ellipses.
- Set ellipse color to blue.
- Generate parallel coordinate plot.
Example 15
Summary: Runs a Multivariate analysis with row-wise estimation method, including Ether as response variable and 1-Octanol to responses, with customization options for report title.
Code:
dt under test = Open("data_table.jmp");
obj = Multivariate(
Y( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride, :Benzene, :Hexane, :Chloroform ),
Estimation Method( "Row-wise" ),
Scatterplot Matrix( 0 ),
Correlations Multivariate( 0 ),
Cluster the Correlations( 1 ),
Ellipsoid 3D Plot( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride ),
SendToReport(
Dispatch( {}, "Multivariate ", OutlineBox, {Set Title( "Color Maps: Cluster the Correlations, Ellipsoid 3D Plot: Default" )} )
)
);
Code Explanation:
- Open data table;
- Launch Multivariate analysis.
- Set Ether as response variable.
- Add 1-Octanol to responses.
- Include Carbon Tetrachloride in analysis.
- Add Benzene to analysis.
- Include Hexane in analysis.
- Add Chloroform to responses.
- Use row-wise estimation method.
- Customize report title.
Example 16
Summary: Runs a Multivariate analysis with row-wise estimation, enabling CI of correlation, partial correlations, pairwise correlations, and Spearman's ρ, while disabling scatterplot matrix and correlations multivariate.
Code:
dt under test = Open("data_table.jmp");
obj = Multivariate(
Y( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride, :Benzene, :Hexane, :Chloroform ),
Estimation Method( "Row-wise" ),
Scatterplot Matrix( 0 ),
Correlations Multivariate( 0 ),
CI of Correlation( 1 ),
Partial Correlations( 1 ),
Pairwise Correlations( 1 ),
Spearman's ρ( 1 ),
SendToReport(
Dispatch( {}, "Multivariate ", OutlineBox,
{Set Title( "CI of Correlation, Partial Correlations, Pairwise Correlations, Nonparametric Correlations: Spearman's p" )}
)
)
);
Code Explanation:
- Open data table;
- Run Multivariate analysis.
- Set response variables.
- Use row-wise estimation.
- Disable scatterplot matrix.
- Disable correlations multivariate.
- Enable CI of correlation.
- Enable partial correlations.
- Enable pairwise correlations.
- Enable Spearman's ρ.
Example 17
Summary: Creates a scatterplot matrix with density ellipses for multivariate analysis, utilizing specified columns and ellipse color settings.
Code:
dt under test = Open("data_table.jmp");
obj = Multivariate(
Columns( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride, :Benzene, :Hexane, :Chloroform ),
Scatterplot Matrix( Density Ellipses( 1 ), Ellipse Color( 3 ) )
);
Code Explanation:
- Open data table;
- Create Multivariate analysis object.
- Select specified columns for analysis.
- Generate Scatterplot Matrix.
- Enable Density Ellipses.
- Set Ellipse Color to 3.
Example 18
Summary: Runs a Multivariate analysis to visualize correlations between Household Income, IQ, Eighth Grade Math, High School Graduates, and College Degrees, with scatterplot matrix and significance circles.
Code:
Open("data_table.jmp");
Multivariate(
Y( :Household Income, :IQ, :Eighth Grade Math, :High School Graduates, :College Degrees ),
Estimation Method( "Pairwise" ),
Scatterplot Matrix( Show Points( 0 ), Significance Circles( 1 ) ),
SendToReport( Dispatch( {}, "Correlations", OutlineBox, {Close( 1 )} ) )
);
Code Explanation:
- Open data table;
- Launch Multivariate analysis.
- Specify response variables.
- Set estimation method.
- Create scatterplot matrix.
- Hide data points.
- Display significance circles.
- Close correlations outline box.
Example 19
Summary: Creates a scatterplot matrix with density ellipses and customized contour fill colors for multivariate analysis, utilizing the Multivariate platform in JMP.
Code:
Open("data_table.jmp");
Multivariate(
Y( :Aperture, :Ranging, :Cadence, :Yield ),
Estimation Method( "Row-wise" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Nonpar Density( 1 ), Ellipse Color( 3 ) ),
SendToReport(
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 2 ), {DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )} ),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 3 ), {DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )} ),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 4 ), {DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )} ),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 5 ), {DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )} ),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 7 ), {DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )} ),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 8 ), {DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )} ),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 9 ), {DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )} ),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 10 ),
{DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )}
),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 12 ),
{DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )}
),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 13 ),
{DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )}
),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 14 ),
{DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )}
),
Dispatch( {"Scatterplot Matrix"}, "Multiv Scatter Plot", FrameBox( 15 ),
{DispatchSeg( Contour Seg( 1 ), {Fill Color( "Gray" )} )}
)
)
);
Code Explanation:
- Open data table;
- Create multivariate analysis.
- Set response variables.
- Choose row-wise estimation.
- Generate scatterplot matrix.
- Enable density ellipses.
- Disable shaded ellipses.
- Enable nonparametric density.
- Set ellipse color.
- Customize contour fill colors.
Example 20
Summary: Performs a multivariate analysis to explore correlations between various solvents, enabling interactive filtering and recalculation of results.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
mult = dt << Multivariate(
Columns( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride, :Benzene, :Hexane, :Chloroform ),
Scatterplot Matrix( Density Ellipses( 1 ), Ellipse Color( 3 ) )
);
mult << Automatic Recalc( 1 );
dt << Select where( :benzene > 0 );
dt << Hide and Exclude( 1 );
sumStats1 = Report( mult )["Correlations"][Matrix Box( 1 )] << get;
certStats1 = [1 0.902074754725272 -0.0866841587420217 0.145448146205675 0.0576099516434211 -0.120181057237778,
0.902074754725272 1 0.0984976933705812 0.354070111340126 0.158352202398996 0.171361328619173,
-0.0866841587420217 0.0984976933705812 1 0.877589725458114 0.835862797204165 0.702624834825921,
0.145448146205675 0.354070111340126 0.877589725458114 1 0.714844682622524 0.77949789728746,
0.0576099516434211 0.158352202398996 0.835862797204165 0.714844682622524 1 0.584447727771582,
-0.120181057237778 0.171361328619173 0.702624834825921 0.77949789728746 0.584447727771582 1];
dt << Clear Row States;
dt << Select Where( :benzene < 0 );
dt << Hide and Exclude( 1 );
sumStats2 = Report( mult )["Correlations"][Matrix Box( 1 )] << get;
Code Explanation:
- Open table.
- Perform multivariate analysis.
- Enable automatic recalculation.
- Select rows where benzene > 0.
- Hide and exclude selected rows.
- Retrieve correlation matrix.
- Define certified statistics.
- Clear row states.
- Select rows where benzene < 0.
- Hide and exclude selected rows.
Example 21
Summary: Performs a multivariate analysis on the data table, selecting rows where Benzene > 0 and retrieving the correlation matrix to define certified statistics.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
mult = dt << Multivariate(
Columns( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride, :Benzene, :Hexane, :Chloroform ),
Scatterplot Matrix( Density Ellipses( 1 ), Ellipse Color( 3 ) )
);
mult << Automatic Recalc( 1 );
dt << Select where( :benzene > 0 );
dt << Hide and Exclude( 1 );
sumStats1 = Report( mult )["Correlations"][Matrix Box( 1 )] << get;
certStats1 = [1 0.902074754725272 -0.0866841587420217 0.145448146205675 0.0576099516434211 -0.120181057237778,
0.902074754725272 1 0.0984976933705812 0.354070111340126 0.158352202398996 0.171361328619173,
-0.0866841587420217 0.0984976933705812 1 0.877589725458114 0.835862797204165 0.702624834825921,
0.145448146205675 0.354070111340126 0.877589725458114 1 0.714844682622524 0.77949789728746,
0.0576099516434211 0.158352202398996 0.835862797204165 0.714844682622524 1 0.584447727771582,
-0.120181057237778 0.171361328619173 0.702624834825921 0.77949789728746 0.584447727771582 1];
dt << Clear Row States;
dt << Select Where( :benzene < 0 );
dt << Hide and Exclude( 1 );
sumStats2 = Report( mult )["Correlations"][Matrix Box( 1 )] << get;
certStats2 = [1 0.851002672208769 0.156488687602535 0.264925936084334 0.204149256495449 0.0991860075226077,
0.851002672208769 1 0.25123879812244 0.362273109818683 0.27676387579104 0.137023626643891,
0.156488687602535 0.25123879812244 1 0.923756458566312 0.95518333562607 0.904093377609318,
0.264925936084334 0.362273109818683 0.923756458566312 1 0.905318226405976 0.916247933052237,
0.204149256495449 0.27676387579104 0.95518333562607 0.905318226405976 1 0.862162625146563,
0.0991860075226077 0.137023626643891 0.904093377609318 0.916247933052237 0.862162625146563 1];
Code Explanation:
- Open data table;
- Perform Multivariate analysis.
- Enable automatic recalculation.
- Select rows where Benzene > 0.
- Hide and exclude selected rows.
- Retrieve correlation matrix from report.
- Define certified statistics for positive Benzene.
- Clear row states in dataset.
- Select rows where Benzene < 0.
- Hide and exclude selected rows.
Example 22
Summary: Performs a multivariate analysis to generate a scatterplot matrix with density ellipses and certified statistics for positive benzene concentrations, while selecting and hiding rows based on the benzene threshold.
Code:
dt = Open("data_table.jmp");
mult = dt << Multivariate(
Columns( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride, :Benzene, :Hexane, :Chloroform ),
Scatterplot Matrix( Density Ellipses( 1 ), Ellipse Color( 3 ) )
);
mult << Automatic Recalc( 1 );
dt << Select where( :benzene > 0 );
dt << Hide and Exclude( 1 );
sumStats1 = Report( mult )["Correlations"][Matrix Box( 1 )] << get;
certStats1 = [1 0.902074754725272 -0.0866841587420217 0.145448146205675 0.0576099516434211 -0.120181057237778,
0.902074754725272 1 0.0984976933705812 0.354070111340126 0.158352202398996 0.171361328619173,
-0.0866841587420217 0.0984976933705812 1 0.877589725458114 0.835862797204165 0.702624834825921,
0.145448146205675 0.354070111340126 0.877589725458114 1 0.714844682622524 0.77949789728746,
0.0576099516434211 0.158352202398996 0.835862797204165 0.714844682622524 1 0.584447727771582,
-0.120181057237778 0.171361328619173 0.702624834825921 0.77949789728746 0.584447727771582 1];
dt << Clear Row States;
dt << Select Where( :benzene < 0 );
dt << Hide and Exclude( 1 );
sumStats2 = Report( mult )["Correlations"][Matrix Box( 1 )] << get;
certStats2 = [1 0.851002672208769 0.156488687602535 0.264925936084334 0.204149256495449 0.0991860075226077,
0.851002672208769 1 0.25123879812244 0.362273109818683 0.27676387579104 0.137023626643891,
0.156488687602535 0.25123879812244 1 0.923756458566312 0.95518333562607 0.904093377609318,
0.264925936084334 0.362273109818683 0.923756458566312 1 0.905318226405976 0.916247933052237,
0.204149256495449 0.27676387579104 0.95518333562607 0.905318226405976 1 0.862162625146563,
0.0991860075226077 0.137023626643891 0.904093377609318 0.916247933052237 0.862162625146563 1];
Code Explanation:
- Open data table.
- Perform multivariate analysis.
- Enable automatic recalculation.
- Select rows where benzene > 0.
- Hide and exclude selected rows.
- Get correlation matrix.
- Define certified statistics for positive benzene.
- Clear row states.
- Select rows where benzene < 0.
- Hide and exclude selected rows.
Example 23
Summary: Performs a multivariate analysis to explore correlations between height, weight, and age by sex, generating a scatterplot matrix with density ellipses and extracting the correlations matrix into a new table.
Code:
dt1 = Open("data_table.jmp");
m = dt1 << Multivariate(
Y( :height, :weight, :age ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
By( :sex )
);
r = Report( m[1] );
dt2 = r["Correlations"][Matrix Box( 1 )] << makeIntoDataTable;
Code Explanation:
- Open data table;
- Launch Multivariate analysis.
- Set response variables: height, weight, age.
- Use row-wise estimation method.
- Display square matrix format.
- Create scatterplot matrix with density ellipses.
- Disable shaded ellipses.
- Set ellipse color to blue.
- Group by sex.
- Extract correlations matrix into new table.
Example 24
Summary: Performs a multivariate analysis to explore the relationships between height, weight, and age, grouped by sex, using row-wise estimation and a scatterplot matrix with density ellipses.
Code:
dt1 = Open("data_table.jmp");
m = dt1 << Multivariate(
Y( :height, :weight, :age ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
By( :sex )
);
r = Report( m[1] );
dt2 = r["Correlations"][Matrix Box( 1 )] << makeCombinedDataTable;
Code Explanation:
- Open data table;
- Perform multivariate analysis.
- Set response variables: height, weight, age.
- Use row-wise estimation method.
- Format matrix as square.
- Create scatterplot matrix.
- Add density ellipses.
- Disable shaded ellipses.
- Set ellipse color to blue.
- Group by sex.
Example 25
Summary: Performs a multivariate analysis to generate correlations between height, weight, and age variables in a data table, utilizing row-wise estimation method and scatterplot matrix.
Code:
dt1 = Open("data_table.jmp");
m = dt1 << Multivariate(
Y( :height, :weight, :age ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) )
);
r = Report( m );
dt2 = r["Correlations"][Matrix Box( 1 )] << makeCombinedDataTable;
Close( dt2, "nosave" );
Close( dt1, "nosave" );
mb = Matrix Box( [1 2 31, 4 3 21] );
mat = [38.2 3 4, 5 6 7, 8 9 10];
Code Explanation:
- Open data table;
- Perform multivariate analysis.
- Specify variables: height, weight, age.
- Use row-wise estimation method.
- Create square matrix format.
- Generate scatterplot matrix.
- Extract correlations report.
- Convert matrix box to data table.
- Close temporary data table without saving.
- Close original data table without saving.
Example 26
Summary: Generates a scatterplot matrix with density ellipses and shaded ellipses for multivariate analysis, extracting correlations matrices and converting them to data tables.
Code:
dt1 = Open("data_table.jmp");
m = dt1 << Multivariate(
Y( :height, :weight, :age ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) )
);
r = Report( m );
dt2 = r["Correlations"][Matrix Box( 1 )] << makeIntoDataTable;
Close( dt2, "nosave" );
Close( dt1, "nosave" );
dt1 = Open("data_table.jmp");
m = dt1 << Multivariate(
Y( :height, :weight, :age ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
By( :sex )
);
r = Report( m[1] );
dt2 = r["Correlations"][Matrix Box( 1 )] << makeIntoDataTable;
Close( dt2, "nosave" );
Close( dt1, "nosave" );
dt1 = Open("data_table.jmp");
m = dt1 << Multivariate(
Y( :height, :weight, :age ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
By( :sex )
);
r = Report( m[1] );
dt2 = r["Correlations"][Matrix Box( 1 )] << makeCombinedDataTable;
Close( dt2, "nosave" );
Close( dt1, "nosave" );
dt1 = Open("data_table.jmp");
m = dt1 << Multivariate(
Y( :height, :weight, :age ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) )
);
r = Report( m );
dt2 = r["Correlations"][Matrix Box( 1 )] << makeCombinedDataTable;
Close( dt2, "nosave" );
Close( dt1, "nosave" );
mb = Matrix Box( [1 2 31, 4 3 21] );
mat = [38.2 3 4, 5 6 7, 8 9 10];
mb = Matrix Box( mat );
Code Explanation:
- Open data_table data
- Perform multivariate analysis.
- Generate scatterplot matrix.
- Extract correlations matrix.
- Convert to data table.
- Close data table without saving.
- Repeat steps 1-6.
- Include "By sex" option.
- Extract correlations matrix.
- Convert to combined data table.
Example 27
Summary: Performs a multivariate analysis to generate a scatterplot matrix with density ellipses, using row-wise estimation and square matrix format.
Code:
dt1 = Open("data_table.jmp");
m = dt1 << Multivariate(
Y( :height, :weight, :age ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) )
);
r = Report( m );
dt2 = r["Correlations"][Matrix Box( 1 )] << makeCombinedDataTable;
Code Explanation:
- Open data table;
- Run Multivariate analysis.
- Set Y variables: height, weight, age.
- Use Row-wise estimation.
- Format matrix as Square.
- Create Scatterplot Matrix.
- Add density ellipses.
- Disable shaded ellipses.
- Set ellipse color to blue.
- Extract correlation matrix data.
Example 28
Summary: Creates a multivariate analysis object with pairwise estimation, parallel coordinate plot, and univariate simple statistics for data exploration.
Code:
dt = Open("data_table.jmp");
obj = Multivariate(
Y(
:Household Income, :IQ, :Eighth Grade Math, :High School Graduates, :Gross State Product, :Vegetable Consumption, :Smokers,
:Physical Activity, :Obese, :College Degrees, :Alcohol Consumption
),
Estimation Method( "Pairwise" ),
Scatterplot Matrix( 0 ),
Correlations Multivariate( 0 ),
Univariate Simple Statistics( 1 ),
Parallel Coord Plot
);
:Household Income << Set Property( "Missing Value Codes", 99999 );
:Household Income << Set Values( [99999] );
obj2 = obj << Redo Analysis;
rpt = obj2 << Report;
actN = (rpt[Number Col Box( 1 )] << Get( 1 ));
Code Explanation:
- Open data table;
- Create multivariate analysis object.
- Set estimation method to pairwise.
- Disable scatterplot matrix.
- Disable correlations multivariate.
- Enable univariate simple statistics.
- Enable parallel coordinate plot.
- Set missing value code for Household Income.
- Replace Household Income values with missing code.
- Redo analysis with updated data.
Example 29
Summary: Creates a multivariate object with REML estimation method and scatterplot matrix, including density ellipses and ellipse color customization.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate(
Y( :height ),
Estimation Method( "REML" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) )
);
dt << delete columns( "height" );
Code Explanation:
- Open data table.
- Create multivariate object.
- Set response variable.
- Choose REML estimation method.
- Generate scatterplot matrix.
- Add density ellipses.
- Disable shaded ellipses.
- Set ellipse color to red.
- Delete height column from table.
Example 30
Summary: Analyze OZONE, CO, SO2, NO, and PM10 variables using multivariate techniques, including principal components and score plots with imputation.
Code:
dt = Open("data_table.jmp");
obj3 = Multivariate( Y( :OZONE, :CO, :SO2, :NO, :PM10 ), Correlations Multivariate( 0 ) );
obj3 << Principal Components( on Correlations, Score Plot with Imputation( 3 ), Score Plot( 3 ) );
obj2 = Multivariate( Y( :OZONE, :CO, :SO2, :NO, :PM10 ), Correlations Multivariate( 0 ) );
obj2 << Principal Components( on Correlations, Score Plot with Imputation( 2 ), Score Plot( 2 ) );
jrn2 = Report( obj2 )[Outline Box( "Principal Components / Factor Analysis" )] << get journal;
jrn3 = Report( obj3 )[Outline Box( "Principal Components / Factor Analysis" )] << get journal;
Code Explanation:
- Open data table;
- Create multivariate analysis for OZONE, CO, SO2, NO, PM10.
- Enable principal components on correlations.
- Generate score plot with imputation for 3 components.
- Generate regular score plot for 3 components.
- Repeat steps 2-5 for 2 components.
- Extract report for 2-component analysis.
- Extract report for 3-component analysis.
Example 31
Summary: Creates a scatterplot matrix with nonparametric density plots for height and weight variables, utilizing Multivariate analysis in JMP.
Code:
dt = Open("data_table.jmp");
mv = dt << Multivariate( Y( :height, :weight ) );
so = Report( mv )["Scatterplot Matrix"] << Get Scriptable Object;
so << Nonpar Density( 1 );
so << Nonpar Density( 0 );
mv << close window;
mv2 = dt << Multivariate( Y( :height, :weight ), Scatterplot Matrix( Nonpar Density( 1 ) ) );
Code Explanation:
- Open data table;
- Create multivariate analysis on height and weight.
- Extract scatterplot matrix object.
- Add nonparametric density plot for first variable.
- Add nonparametric density plot for second variable.
- Close the multivariate window.
- Create new multivariate analysis.
- Include scatterplot matrix with nonparametric density for first variable.
Example 32
Summary: Process of performing multivariate analysis on a data table, extracting covariance matrices and imputed data tables, and calculating mean values.
Code:
dt1 = Open("data_table.jmp");
dt1 = Current Data Table();
dt1:Sepal length[1] = .;
Xmiss = (dt1 << get as matrix)[0, 1 :: 4];
mv = Multivariate(
Y( 1 :: 4 ),
Scatterplot Matrix( 0 ),
Estimation Method( "Pairwise" ),
Covariance Matrix( 1 ),
Univariate Simple Statistics( 1 ),
Impute Missing Data( 1 )
);
r = Report( mv );
covar = r["Covariance Matrix"][Matrix Box( 1 )] << get;
dtimp = Data Table( "Imputed Data Table of " || (dt1 << Get Name) );
newDat = dtimp << get as matrix;
mu = r["Univariate Simple Statistics"][Number Col Box( "Mean" )] << get as matrix;
idx = 2 :: 4;
invCov = G Inverse( Covar[idx, idx] );
evec = (mu[1] + covar[1, idx] * invCov * (Xmiss[1, idx]` - mu[idx]))[1];
avec = newDat[1, 1];
Code Explanation:
- Open data table;
- Set current data table.
- Replace first sepal length value with missing.
- Extract X variables as matrix.
- Perform multivariate analysis.
- Retrieve report from multivariate analysis.
- Extract covariance matrix from report.
- Retrieve imputed data table.
- Convert imputed data table to matrix.
- Extract mean values from report.
Example 33
Summary: Generates two scatterplot matrices with correlation probability analysis for row-wise and pairwise multivariate data, utilizing the Multivariate platform in JMP.
Code:
dt = Open("data_table.jmp");
objrow = dt << Multivariate(
Y( :Percent body fat, :Name( "Height (inches)" ) ),
Estimation Method( "Row-wise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
Correlation Probability( 1 )
);
rptrow = objrow << report;
probrow = rptrow["Correlation Probability"][Matrix Box( 1 )] << get;
objpair = dt << Multivariate(
Y( :Percent body fat, :Name( "Height (inches)" ) ),
Estimation Method( "Pairwise" ),
Matrix Format( "Square" ),
Scatterplot Matrix( Density Ellipses( 1 ), Shaded Ellipses( 0 ), Ellipse Color( 3 ) ),
Correlation Probability( 1 )
);
rptpair = objpair << report;
probpair = rptpair["Correlation Probability"][Matrix Box( 1 )] << get;
Code Explanation:
- Open data table;
- Perform multivariate analysis row-wise.
- Configure scatterplot matrix options.
- Enable correlation probability.
- Retrieve report object.
- Extract correlation probability matrix row-wise.
- Perform multivariate analysis pairwise.
- Configure scatterplot matrix options.
- Enable correlation probability.
- Retrieve report object.
- Extract correlation probability matrix pairwise.
Example 34
Summary: Performs a multivariate analysis to estimate robust principal components on unscaled data, using CO, SO2, and NO as response variables, Lead as the frequency variable, and PM10 as the weight variable.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate(
Y( :CO, :SO2, :NO ),
Freq( :Lead ),
Weight( :PM10 ),
Estimation Method( "Robust" ),
Matrix Format( "Square" ),
Principal Components( "on Unscaled", )
);
obj << Principal Components( Save Principal Components with Imputation( 2 ) );
Code Explanation:
- Open data table;
- Launch Multivariate analysis.
- Set response variables: CO, SO2, NO.
- Use Lead as frequency variable.
- Apply PM10 as weight variable.
- Choose Robust estimation method.
- Select Square matrix format.
- Enable Principal Components on unscaled data.
- Save first two principal components with imputation.
Example 35
Summary: Performs a multivariate analysis on the provided data table, enabling principal components on correlations and generating a 3D score plot, while disabling automatic recalculation and randomly selecting 10% of rows for reporting.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( :OZONE, :CO, :SO2, :NO, :PM10 ) );
obj << Principal Components( "on Correlations", Name( "3D Score Plot" ) );
obj << Automatic Recalc( 0 );
Random Reset( 123456789 );
dt << Select Randomly( 0.1 ) << Hide and Exclude( 1 );
rpt = obj << Report();
Code Explanation:
- Open data table;
- Perform multivariate analysis.
- Enable principal components on correlations.
- Generate 3D score plot.
- Disable automatic recalculation.
- Set random seed.
- Randomly select 10% of rows.
- Hide and exclude selected rows.
- Create report from analysis.
Example 36
Summary: Creates a multivariate analysis report with scatterplot matrix and row-wise variance estimation for age, height, and weight variables in a data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( :age, :height, :weight ), Variance Estimation( "Row-wise" ), Scatterplot Matrix( Fit Line ) );
rpt = obj << report;
Code Explanation:
- Open data table;
- Create multivariate analysis object.
- Set response variables: age, height, weight.
- Use row-wise variance estimation.
- Generate scatterplot matrix.
- Add fit lines to plots.
- Retrieve analysis report.
Example 37
Summary: Creates a multivariate object from a data table, selecting specific rows and excluding others, while enabling automatic recalculation.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( :Sepal length, :Sepal width ) );
obj << Automatic Recalc( 1 );
dt << Select rows( [2 3 4 7 8 9 10] ) << Exclude( 1 );
Code Explanation:
- Open data table;
- Create Multivariate object.
- Set automatic recalculation.
- Select specified rows.
- Exclude selected rows.
Example 38
Summary: Creates a multivariate analysis object, enabling principal components analysis and generating a 3D score plot from the data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( :OZONE, :CO, :SO2, :NO, :PM10 ) );
obj << Principal Components( "on Correlations", "3D Score Plot"n );
rpt = obj << report;
jrn = rpt["Scatterplot 3D"] << Get Journal;
jrn_act = Regex( jrn, "(points\(.*?)\!",", "\1" );
Code Explanation:
- Open data table.
- Create multivariate analysis object.
- Enable principal components analysis.
- Generate 3D score plot.
- Retrieve analysis report.
- Extract 3D scatterplot journal.
- Use regex to extract points.
Example 39
Summary: Creates a multivariate analysis object with row-wise variance estimation and scatterplot matrix, including density ellipses and significance circles.
Code:
dt1 = Open("data_table.jmp");
obj = dt1 << Multivariate(
Y( :v1, :v25 ),
Variance Estimation( "Row-wise" ),
Scatterplot Matrix( Density Ellipses( 1 ), Significance Circles( 1 ) )
);
obj << Save Script to Report;
rpt = obj << report;
script_act = Try( rpt[Text Box( 1 )] << Get Text );
script_exp =
"Multivariate(
Y( :v1, :v25 ),
Variance Estimation( \!"Row-wise\!" ),
Scatterplot Matrix( Density Ellipses( 1 ), Significance Circles( 1 ) )
)";
Code Explanation:
- Open data table;
- Create multivariate analysis object.
- Set response variables v1, v25.
- Use row-wise variance estimation.
- Generate scatterplot matrix.
- Add density ellipses to plots.
- Add significance circles to plots.
- Save script to report.
- Extract script from report.
- Compare extracted script to expected script.
Example 40
Summary: Creates a custom display window with four analyses placed horizontally, featuring a multivariate analysis object and 3D ellipsoid plot.
Code:
dt = Open("data_table.jmp");
obj = Multivariate(
Y( :Mass, :Fore, :Bicep, :Chest, :Neck, :Shoulder, :Waist, :Height, :Calf, :Thigh, :Head ),
Estimation Method( "Pairwise" ),
Scatterplot Matrix( 0 ),
);
myMass = Column( "Mass" );
myFore = Column( "Fore" );
myHeight = Column( "Height" );
lc = Log Capture( obj << Ellipsoid 3D Plot( myMass, myFore, myHeight ) );
Code Explanation:
- Open data table.
- Create multivariate analysis object.
- Set estimation method to pairwise.
- Disable scatterplot matrix.
- Assign Mass column to variable.
- Assign Fore column to variable.
- Assign Height column to variable.
- Generate 3D ellipsoid plot.
- Capture log output.
- Store result in lc variable.
Example 41
Summary: Performs a multivariate analysis to visualize relationships between variables, generating a scatterplot matrix and attempting to create a 3D ellipsoid plot for selected variables.
Code:
dt = Open("data_table.jmp");
obj = Multivariate(
Y( :Mass, :Fore, :Bicep, :Chest, :Neck, :Shoulder, :Waist, :Height, :Calf, :Thigh, :Head ),
Estimation Method( "Pairwise" ),
Scatterplot Matrix( 1 ),
SendToReport( Dispatch( {}, "Multivariate ", OutlineBox, {Close( 1 )} ) )
);
Try( obj << Ellipsoid 3D Plot( Mass, Fore, Bicep ) );
Code Explanation:
- Open data table.
- Run multivariate analysis.
- Set estimation method.
- Generate scatterplot matrix.
- Close outline box.
- Attempt to create 3D ellipsoid plot.
- Use Mass, Fore, Bicep variables.
Example 42
Summary: Performs a multivariate analysis with REML estimation method, scatterplot matrix, and 3D plot creation for specified variables.
Code:
dt = Open("data_table.jmp");
obj = Multivariate(
Y( :Mass, :Fore, :Bicep, :Chest, :Neck, :Shoulder, :Waist, :Height, :Calf, :Thigh, :Head ),
Estimation Method( "REML" ),
Scatterplot Matrix( 1 ),
SendToReport( Dispatch( {}, "Multivariate ", OutlineBox, {Close( 1 )} ) )
);
Try( obj << Ellipsoid 3D Plot( Mass, Fore, Bicep ) );
Code Explanation:
- Open table.
- Define multivariate analysis.
- Set estimation method.
- Create scatterplot matrix.
- Close outline box.
- Attempt to create 3D plot.
- Use specified variables.
- Handle potential errors.
Example 43
Summary: Performs a multivariate analysis to visualize the relationships between various physical measurements, utilizing maximum likelihood estimation and scatterplot matrix features.
Code:
dt = Open("data_table.jmp");
obj = Multivariate(
Y( :Mass, :Fore, :Bicep, :Chest, :Neck, :Shoulder, :Waist, :Height, :Calf, :Thigh, :Head ),
Estimation Method( "ML" ),
Scatterplot Matrix( 1 ),
SendToReport( Dispatch( {}, "Multivariate ", OutlineBox, {Close( 1 )} ) )
);
Try( obj << Ellipsoid 3D Plot( Mass, Fore, Bicep ) );
Code Explanation:
- Open data table.
- Define multivariate analysis object.
- Set response variables.
- Use maximum likelihood estimation.
- Create scatterplot matrix.
- Close multivariate outline box.
- Attempt to create 3D ellipsoid plot.
- Specify plot variables.
Example 44
Summary: Creates a custom display window with four analyses placed horizontally, using the Multivariate platform to visualize relationships between response variables.
Code:
dt = Open("data_table.jmp");
obj = Multivariate(
Y( :Mass, :Fore, :Bicep, :Chest, :Neck, :Shoulder, :Waist, :Height, :Calf, :Thigh, :Head ),
Estimation Method( "Robust" ),
Scatterplot Matrix( 1 ),
SendToReport( Dispatch( {}, "Multivariate ", OutlineBox, {Close( 1 )} ) )
);
Try( obj << Ellipsoid 3D Plot( Mass, Fore, Bicep ) );
Code Explanation:
- Open data table.
- Launch Multivariate platform.
- Set response variables.
- Choose robust estimation method.
- Enable scatterplot matrix.
- Close multivariate outline box.
- Attempt to create 3D ellipsoid plot.
- Use Mass, Fore, Bicep for plot.
Example 45
Summary: Creates a multivariate analysis object with specified response variables, estimation method, and scatterplot matrix, and attempts to generate a 3D ellipsoid plot.
Code:
dt = Open("data_table.jmp");
obj = Multivariate(
Y( :Mass, :Fore, :Bicep, :Chest, :Neck, :Shoulder, :Waist, :Height, :Calf, :Thigh, :Head ),
Estimation Method( "Row-wise" ),
Scatterplot Matrix( 1 ),
SendToReport( Dispatch( {}, "Multivariate ", OutlineBox, {Close( 1 )} ) )
);
Try( obj << Ellipsoid 3D Plot( Mass, Fore, Bicep ) );
Code Explanation:
- Open data table.
- Create multivariate analysis object.
- Specify response variables.
- Set estimation method.
- Generate scatterplot matrix.
- Close multivariate outline box.
- Attempt to create 3D ellipsoid plot.
- Use specified variables for plot.
Example 46
Summary: Performs a multivariate analysis with pairwise estimation method, disabling scatterplot matrix and correlations, and creating a 3D ellipsoid plot for selected variables.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate(
Y(
:Household Income, :IQ, :Eighth Grade Math, :High School Graduates, :Gross State Product, :Vegetable Consumption, :Smokers,
:Physical Activity, :Obese, :College Degrees, :Alcohol Consumption
),
Estimation Method( "Pairwise" ),
Scatterplot Matrix( 0 ),
Correlations Multivariate( 0 ),
Ellipsoid 3D Plot( :Household Income, :IQ, :Eighth Grade Math )
);
obj << Automatic Recalc( 1 );
dt << Delete Columns( "IQ" );
Log Capture( dt:Household Income[1] = 40000 );
Get Window( "US Demographics - Multivariate" ) << Close Window;
Close( dt, NoSave );
ut extract3DScaleBox = Function( {str},
{tmp, newstr, idx, k = 0, i = 0, stack = {"("}, ex = Empty()},
idx = J(
4,
1,
k = Contains( str, "ScaleBox", i + 1 );
i = If( k, k, i );
k;
);
If( All( idx ),
newstr = Substr( str, 1, idx[4] + 8 );
For( i = idx[4] + 9, i <= Length( str ) & N Items( stack ), i++,
tmp = Substr( str, i, 1 );
If( Contains( {"(", ")"}, tmp ),
If( tmp == "(",
Insert Into( stack, tmp ),
Remove From( stack, N Items( stack ) )
)
);
);
newstr ||= Substr( str, i - 1, -1 );
ex = Parse( newstr );
);
Name Expr( ex );
);
Code Explanation:
- Open data table;
- Perform multivariate analysis.
- Select multiple variables for analysis.
- Use pairwise estimation method.
- Disable scatterplot matrix.
- Disable correlations multivariate.
- Create 3D ellipsoid plot.
- Enable automatic recalculation.
- Delete IQ column.
- Log capture household income value.
- Close multivariate window.
- Close dataset without saving.
- Define function to extract 3D scale box.
Example 47
Summary: Performs a multivariate analysis to explore relationships between various demographic and economic factors, utilizing the Pairwise estimation method and disabling scatterplot matrix and correlations.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate(
Y(
:Household Income, :IQ, :Eighth Grade Math, :High School Graduates, :Gross State Product, :Vegetable Consumption, :Smokers,
:Physical Activity, :Obese, :College Degrees, :Alcohol Consumption
),
Estimation Method( "Pairwise" ),
Scatterplot Matrix( 0 ),
Correlations Multivariate( 0 ),
Ellipsoid 3D Plot( :Household Income, :IQ, :Eighth Grade Math )
);
obj << Automatic Recalc( 1 );
dt << Delete Columns( "IQ" );
Log Capture( dt:Household Income[1] = 40000 );
Get Window( "US Demographics - Multivariate" ) << Close Window;
Code Explanation:
- Open data table;
- Run Multivariate analysis.
- Select specified columns for analysis.
- Use Pairwise estimation method.
- Disable Scatterplot Matrix.
- Disable Correlations Multivariate.
- Create Ellipsoid 3D Plot.
- Enable automatic recalculation.
- Delete IQ column.
- Log Household Income value.
- Close Multivariate window.
Example 48
Summary: Performs a multivariate analysis on a data table, excluding scatterplot matrix and using pairwise estimation method, with imputation of missing data.
Code:
dt1 = Open("data_table.jmp");
dt1:v1[1] = .;
mv = dt1 << Multivariate(
Y( 5 :: 31 ),
Scatterplot Matrix( 0 ),
Estimation Method( "Pairwise" ),
Covariance Matrix( 1 ),
Multivariate Simple Statistics( 1 ),
);
mv << Impute Missing Data( 1 );
Close( dt1, No Save );
dt2 = Current Data Table();
v1One = Column( dt2, 1 )[1];
Code Explanation:
- Open data table;
- Set first value of v1 to missing.
- Perform multivariate analysis.
- Exclude scatterplot matrix.
- Use pairwise estimation method.
- Include covariance matrix.
- Include simple statistics.
- Impute missing data.
- Close original dataset without saving.
- Retrieve first value of first column.
Example 49
Summary: Performs a multivariate analysis on a selected range of variables, enabling covariance matrix and simple statistics calculation, with missing data imputation.
Code:
dt1 = Open("data_table.jmp");
dt1:v1[1] = .;
mv = dt1 << Multivariate(
Y( 5 :: 31 ),
Scatterplot Matrix( 0 ),
Estimation Method( "Pairwise" ),
Covariance Matrix( 1 ),
Multivariate Simple Statistics( 1 ),
);
mv << Impute Missing Data( 1 );
Code Explanation:
- Open data table;
- Set v1[1] to missing.
- Launch Multivariate analysis.
- Select variables 5 to 31.
- Disable scatterplot matrix.
- Use pairwise estimation method.
- Enable covariance matrix.
- Enable simple statistics.
- Impute missing data.
Example 50
Summary: Runs the extraction and visualization of principal components from a multivariate analysis, utilizing correlations for score plotting and matrix saving.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( 2 :: 16 ), Principal Components( on Correlations, Score Plot( 2 ), Save Principal Components( 2 ) ) );
principal1 = dt << get as matrix( 17 );
principal2 = dt << get as matrix( 18 );
Code Explanation:
- Open data table;
- Perform multivariate analysis.
- Specify columns 2 to 16 for analysis.
- Enable principal components analysis.
- Use correlations for analysis.
- Generate score plot for first two components.
- Save first two principal components.
- Extract first principal component matrix.
- Extract second principal component matrix.
Example 51
Summary: Performs a multivariate analysis on the selected columns of a data table, generating a report with pairwise estimation method and multivariate simple statistics.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( 1 :: 4 ), Estimation Method( "Pairwise" ), Multivariate Simple Statistics( 1 ) );
rpt = obj << report;
Code Explanation:
- Open data table;
- Run Multivariate analysis.
- Select all four columns.
- Use Pairwise estimation method.
- Enable Multivariate Simple Statistics.
- Generate report object.
Example 52
Summary: Analyze a multivariate data table by fitting Y by X Group using REML estimation method and generating a report with simple statistics.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( 1 :: 4 ), Estimation Method( "REML" ), Multivariate Simple Statistics( 1 ) );
rpt = obj << report;
Code Explanation:
- Open data table;
- Create multivariate object.
- Set response variables 1-4.
- Use REML estimation method.
- Enable simple statistics.
- Generate multivariate report.
Example 53
Summary: Executes a multivariate analysis on a data table, generating a report with simple statistics and estimation method set to 'ML'.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( 1 :: 4 ), Estimation Method( "ML" ), Multivariate Simple Statistics( 1 ) );
rpt = obj << report;
Code Explanation:
- Open data table;
- Launch Multivariate analysis.
- Set response variables.
- Choose ML estimation method.
- Enable simple statistics.
- Generate report object.
- Extract report.
Example 54
Summary: Performs a multivariate analysis on columns 1 to 4 of the data table, generating simple statistics and a report using row-wise estimation method.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( 1 :: 4 ), Estimation Method( "Row-wise" ), Multivariate Simple Statistics( 1 ) );
rpt = obj << report;
Code Explanation:
- Open data table;
- Perform multivariate analysis.
- Specify columns 1 to 4.
- Use row-wise estimation method.
- Generate simple statistics.
- Retrieve analysis report.
Example 55
Summary: Generates a multivariate analysis report with robust estimation method and simple statistics for columns 1 to 4 in a data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( 1 :: 4 ), Estimation Method( "Robust" ), Multivariate Simple Statistics( 1 ) );
rpt = obj << report;
Code Explanation:
- Open data table;
- Create multivariate object.
- Specify columns 1 to 4.
- Use robust estimation method.
- Enable simple statistics.
- Generate report object.
Example 56
Summary: Performs a multivariate analysis to extract correlations and eigenvalues from a data table, utilizing the Multivariate platform in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Multivariate(
Y( :Al, :Mn, :Na, :Br, :Ce, :Co, :Cr, :Cs, :Eu, :Fe, :Hf, :La, :Sc, :Sm, :U ),
Correlations Multivariate( 1 ),
Principal Components( on Correlations )
);
rep = Report( obj );
Corr = rep[Matrix Box( 1 )] << get;
Eigen = rep[Number Col Box( "Eigenvalue" )] << get as matrix;
Code Explanation:
- Open data table;
- Launch Multivariate analysis.
- Specify variables for analysis.
- Enable correlations matrix.
- Use correlation matrix for PCA.
- Retrieve report object.
- Extract correlations matrix.
- Extract eigenvalues matrix.
Example 57
Summary: Performs a multivariate analysis report for the '1-Octanol' dataset, utilizing the Multivariate platform to visualize relationships between variables.
Code:
dt = Open("data_table.jmp");
rpt = Multivariate( Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ) );
Code Explanation:
- Open data table;
- Create multivariate analysis report.
Multivariate using Surface Plot
Summary: Creates a surface plot to visualize the relationship between Pred Formula ABRASION and multiple variables, utilizing various customization options for color themes, axis settings, and 3D plotting.
Code:
Open("data_table.jmp");
Surface Plot(
Columns( :Pred Formula ABRASION ),
Lock Z Scale( 1 ),
Scale response axes independently( 1 ),
Z Grid Position( 130 ),
Surface Color Theme( "Green to Black to Red" ),
Surface Color Theme2( "Green to White to Red" ),
Surface Color Theme3( "White to Black" ),
Surface Color Theme4( "Blue to Gray to Red" ),
Response Column Color Theme( "Blue to Green to Red" ),
Response Column Color Theme2( "Spectral" ),
Response Column Color Theme3( "Jet" ),
Response Column Color Theme4( "White to Blue" ),
Formula( "Pred Formula ABRASION" ),
Equation( "", "", "", "" ),
Surface Color Method( "Solid", "Solid", "Solid", "Solid" ),
SetVariableAxis( :SILICA, Axis Data( {Format( "Custom", Formula( Round( Ln( value ), 2 ) ), 8 )} ) ),
SetVariableAxis( :SILANE, Axis Data( {Format( "Custom", Formula( Round( Log( value, 2 ), 2 ) ), 8 )} ) ),
SetZAxis( Pred Formula ABRASION, Current Value( 130 ), Axis Data( {Format( "Custom", Formula( Round( Log10( value ), 2 ) ), 8 )} ) ),
SetZAxis( z#2, Axis Data( {} ) ),
SetZAxis( z#3, Axis Data( {} ) ),
SetZAxis( z#4, Axis Data( {} ) ),
SetXVariable( :SILICA ),
SetYVariable( :SILANE ),
Iso Value( 0, 139.119238722664 ),
Frame3D( Set Rotation( -54, 0, 38 ) )
);
Open("data_table.jmp");
Multivariate(
Y(
:Household Income, :IQ, :Eighth Grade Math, :High School Graduates, :Gross State Product, :Vegetable Consumption, :Smokers,
:Physical Activity, :Obese, :College Degrees, :Alcohol Consumption
),
Estimation Method( "Pairwise" ),
Pairwise Correlations( 0 ),
Scatterplot Matrix( 0 ),
Ellipsoid 3D Plot( :Household Income, :IQ, :Eighth Grade Math ),
SendToReport( Dispatch( {}, "Correlations", OutlineBox, {Close( 1 )} ), )
);
Code Explanation:
- Open data_table data
- Create surface plot.
- Set prediction formula.
- Lock Z scale.
- Scale response axes independently.
- Set Z grid position.
- Define surface color themes.
- Set response column color themes.
- Customize variable axes.
- Customize Z axis.
- Set X and Y variables.
- Add iso value.
- Rotate 3D frame.
- Open data_table data
- Perform multivariate analysis.
- Select variables for analysis.
- Use pairwise estimation method.
- Disable pairwise correlations.
- Disable scatterplot matrix.
- Create 3D ellipsoid plot.
- Close correlations outline box.
Multivariate using For Each
Summary: Creates multivariate analysis objects for a set of samples, applying presets and setting report titles.
Code:
plat_samples = ["Multivariate" => {"Outlier Analysis", "Item Reliability Analysis", "All Correlations",
"Scatterplot Matrix Significance Circles", "Scatterplot Matrix Significance Heatmap"}, => {}];
dt = Open("data_table.jmp");
For Each( {sample}, plat_samples["Multivariate"],
obj = dt << Multivariate( Y( :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ) );
Eval( Eval Expr( obj << Apply Preset( "Sample Presets", Expr( sample ) ) ) );
obj << Set Report Title( sample );
);
Code Explanation:
- Define multivariate presets.
- Open data table.
- Iterate over multivariate samples.
- Create multivariate analysis object.
- Apply preset to analysis.
- Set report title.
- Repeat for each sample.
Multivariate using Go To Row
Summary: Selects and labels specific rows in a data table, followed by the generation of a multivariate analysis with scatterplot matrix, correlations, and jackknife distances.
Code:
dt = Open("data_table.jmp");
r = dt << Go To Row( 2 );
r << Label;
r = dt << Go To Row( 5 );
r << Label;
r = dt << Go To Row( 69 );
r << Label;
r = dt << Go To Row( 76 );
r << Label;
r << clear select;
Multivariate(
Y( :Calories, :Protein, :Fat, :Sodium, :Fiber, :Complex Carbos, :Tot Carbo, :Sugars, :Calories fr Fat, :Potassium ),
Estimation Method( "Row-wise" ),
Scatterplot Matrix( 0 ),
Correlations Multivariate( 0 ),
Jackknife Distances( 1 ),
SendToReport(
Dispatch( {"Outlier Analysis", "Jackknife Distances"}, "Multiv Outlier", FrameBox, {Frame Size( 446, 279 )} ),
Dispatch( {"Outlier Analysis", "Jackknife Distances"}, "Multiv Outlier", FrameBox( 2 ), {Frame Size( 57, 279 )} )
)
);
Code Explanation:
- Open data table;
- Go to row 2.
- Label row 2.
- Go to row 5.
- Label row 5.
- Go to row 69.
- Label row 69.
- Go to row 76.
- Label row 76.
- Clear selection.
Multivariate using New Column
Example 1
Summary: Creates and configures multivariate scatterplot matrices with density ellipses for exploratory data analysis, utilizing JMP's Multivariate platform.
Code:
dt = Open("data_table.jmp");
dt << New Column( "By", Formula( Random Integer( 1, 4 ) ) );
mul1 = dt << Multivariate(
Columns( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride, :Benzene, :Hexane, :Chloroform ),
By( :By ),
Scatterplot Matrix( Density Ellipses( 1 ), Ellipse Color( 3 ) ),
Title( "Multivariate Test By Title" )
);
mul2 = dt << Multivariate(
Columns( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride, :Benzene, :Hexane, :Chloroform ),
By( :By ),
Scatterplot Matrix( Density Ellipses( 1 ), Ellipse Color( 3 ) )
);
mul3 = dt << Multivariate(
Columns( :Ether, :Name( "1-Octanol" ), :Carbon Tetrachloride, :Benzene, :Hexane, :Chloroform ),
Scatterplot Matrix( Density Ellipses( 1 ), Ellipse Color( 3 ) ),
Title( "Multivariate Test By Title" )
);
rpt1 = mul1 << Report;
rpt2 = mul2 << Report;
rpt3 = mul3 << Report;
Code Explanation:
- Open data table;
- Add new "By" column.
- Run first Multivariate analysis.
- Configure scatterplot matrix.
- Set density ellipses and color.
- Assign title to first multivariate.
- Run second Multivariate analysis.
- Configure scatterplot matrix.
- Set density ellipses and color.
- Extract reports from all multivariates.
Example 2
Summary: Fits a multivariate model with Mahalanobis, Jackknife, and T² distances to a dataset, generating a profiler plot for analysis.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Constant Column", Set Each Value( 5 ) );
obj = dt << Multivariate(
Y( :Sepal length, :Sepal width, :Petal length, :Petal width, :Constant Column ),
Mahalanobis Distances( 1 ),
Jackknife Distances( 1 ),
T²( 1 )
);
Code Explanation:
- Open data table;
- Add constant column.
- Set each value to 5.
- Launch Multivariate analysis.
- Select all variables.
- Enable Mahalanobis distances.
- Enable Jackknife distances.
- Enable T² distances.
Example 3
Summary: Calculates and visualizes multivariate statistics, including Mahalanobis distances, Jackknife distances, and T² statistics for a given data table.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Constant Column", Set Each Value( 5 ) );
obj = dt << Multivariate(
Y( :Sepal length, :Sepal width, :Petal length, :Petal width, :Constant Column ),
Mahalanobis Distances( 1 ),
Jackknife Distances( 1 ),
T²( 1 )
);
rpt = obj << report;
mahReport = rpt[Outline Box( "Mahalanobis Distances" )] << get scriptable object;
mahReport << Save Outlier Distances;
jackReport = rpt[Outline Box( "Jackknife Distances" )] << get scriptable object;
jackReport << Save Jackknife Distances;
t2Report = rpt[Outline Box( "T²" )] << get scriptable object;
t2Report << Save T²;
obj1 = dt << Multivariate(
Y( :Sepal length, :Sepal width, :Petal length, :Petal width ),
Mahalanobis Distances( 1 ),
Jackknife Distances( 1 ),
T²( 1 )
);
rpt1 = obj1 << report;
mahReport1 = rpt1[Outline Box( "Mahalanobis Distances" )] << get scriptable object;
mahReport1 << Save Outlier Distances;
jackReport1 = rpt1[Outline Box( "Jackknife Distances" )] << get scriptable object;
jackReport1 << Save Jackknife Distances;
t2Report1 = rpt1[Outline Box( "T²" )] << get scriptable object;
t2Report1 << Save T²;
_mat = dt << get as matrix( {7 :: 12} );
Code Explanation:
- Open data table;
- Add constant column.
- Perform multivariate analysis.
- Retrieve report object.
- Extract Mahalanobis distances.
- Save outlier distances.
- Extract Jackknife distances.
- Save Jackknife distances.
- Extract T² statistics.
- Save T² statistics.
Multivariate using Profiler
Summary: Creates a custom profiler object in JMP, configuring response variables, desirability functions, term values, and simulator settings to analyze data table relationships.
Code:
dt = Open("data_table.jmp");
obj_cust = dt << Profiler(
Y( :Pred Formula ABRASION, :Pred Formula MODULUS, :Pred Formula ELONG, :Pred Formula HARDNESS ),
Profiler(
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 ) ) ),
Simulator(
1,
Factors( :SILICA << Fixed( 1.041 ), :SILANE << Multivariate( 50, 6.532 ), :SULFUR << Random( Normal( 1.789, 0.3266 ) ) ),
Responses(
:Pred Formula ABRASION << Add Random Noise( 5.61124693112815 ), :Pred Formula MODULUS << No Noise,
:Pred Formula ELONG << Add Random Weighted Noise( 20.5491717951077 ),
:Pred Formula HARDNESS << Add Multivariate Noise( 1.26735561611683 )
),
X Correlations( 1, {:SILICA, :SILANE, :SULFUR}, [1 0.5 0.25, 0.5 1 -0.5, 0.25 -0.5 1] ),
Y Correlations(
1,
{:Pred Formula ABRASION, :Pred Formula MODULUS, :Pred Formula ELONG, :Pred Formula HARDNESS},
[1 0.75 0.5 -0.125, 0.75 1 -0.06 0.3, 0.5 -0.06 1 -0.45, -0.125 0.3 -0.45 1]
),
Resimulate
)
)
);
obj = dt << Profiler( Y( :Pred Formula ABRASION, :Pred Formula MODULUS, :Pred Formula ELONG, :Pred Formula HARDNESS ) );
preset = obj_cust << New Preset;
obj << Apply Preset( Preset );
Code Explanation:
- Open data table;
- Create profiler object.
- Set response variables.
- Configure desirability functions.
- Define term values.
- Initialize simulator.
- Set factor types.
- Add noise to responses.
- Define X correlations.
- Define Y correlations.
- Resimulate data.
- Save custom preset.
- Apply preset to original profiler.
Multivariate using Select Rows
Summary: Runs multivariate analysis with different estimation methods, retrieving Mahalanobis distances reports and visualizing results in JMP.
Code:
dt = Open("data_table.jmp");
dt << Select Rows( 4 :: 40 );
dt << Exclude;
dt << Clear Select;
get line value = Expr(
mv = Multivariate( Y( :height ), Estimation Method( Expr( _method_ ) ), Mahalanobis Distances( 1 ) );
rp = Report( mv );
jrn = rp["Mahalanobis Distances"] << get journal;
mv << close window;
);
Eval( Substitute( Name Expr( getlinevalue ), Expr( _method_ ), "REML" ) );
Eval( Substitute( Name Expr( getlinevalue ), Expr( _method_ ), "ML" ) );
Eval( Substitute( Name Expr( getlinevalue ), Expr( _method_ ), "Row-wise" ) );
Eval( Substitute( Name Expr( getlinevalue ), Expr( _method_ ), "Pairwise" ) );
Eval( Substitute( Name Expr( getlinevalue ), Expr( _method_ ), "Robust" ) );
Code Explanation:
- Open data table;
- Select rows 4 to 40.
- Exclude selected rows.
- Clear row selection.
- Define
getlinevalueexpression. - Perform multivariate analysis with REML method.
- Retrieve Mahalanobis distances report.
- Close multivariate window.
- Repeat for ML method.
- Repeat for Row-wise method.
Multivariate using Delete Rows
Summary: Analyzes and creates reports for a multivariate model, specifying columns 2 to last as Y, using the Pairwise estimation method, and generating score plots with imputation.
Code:
dt = Open("data_table.jmp");
dt << Delete Rows( 10 :: N Row( dt ) );
dt[6, 3 :: 6] = .;
dt[8, 5 :: 9] = .;
obj = dt << Multivariate(
Y( 2 :: N Col( dt ) ),
Estimation Method( "Pairwise" ),
Scatterplot Matrix( 0 ),
Principal Components( "on Correlations", Score Plot( 2 ), Score Plot with Imputation( 2 ) )
);
rpt = obj << Report;
Code Explanation:
- Open data table;
- Delete rows 10 to last.
- Set cells [6,3:6] to missing.
- Set cells [8,5:9] to missing.
- Run Multivariate analysis.
- Specify columns 2 to last as Y.
- Use Pairwise estimation method.
- Disable Scatterplot Matrix.
- Enable Principal Components on correlations.
- Generate Score Plot with 2 components.
- Generate Score Plot with Imputation for 2 components.
- Retrieve report from analysis.
Multivariate using For
Example 1
Summary: Process of setting every second value in each column to missing, and then performs multivariate analysis on columns 2-16 with imputation of missing data.
Code:
dt = Open("data_table.jmp");
For( i = 2, i <= N Cols( dt ), i++,
Column( dt, i )[2 * i :: 2 * (i + 1)] = .
);
obj = dt << Multivariate( Y( 2 :: 16 ) );
obj << Impute Missing Data;
Code Explanation:
- Open data table;
- Loop through columns starting from 2.
- Set every second value in each column to missing.
- Perform multivariate analysis on columns 2-16.
- Impute missing data in the analysis.
Example 2
Summary: Process of preparing a data table for multivariate analysis by setting every second value to missing, performing imputation, and extracting relevant columns as matrices.
Code:
dt = Open("data_table.jmp");
For( i = N Cols( dt ), i >= 2, i--,
Column( dt, i )[2 * (i - 1) :: 2 * i] = .
);
obj = dt << Multivariate( Y( 2 :: 16 ) );
obj << Save Imputed Formula;
_mat = (dt << get as matrix( {17 :: N Cols( dt )} ));
obj << Impute Missing Data;
dt1 = Current Data Table();
_mat1 = (dt1 << get as matrix( {1 :: N Cols( dt1 )} ));
Code Explanation:
- Open data table;
- Loop through columns 2 to end.
- Set every second value to missing.
- Perform multivariate analysis.
- Save imputation formula.
- Extract columns 17 to end as matrix.
- Impute missing data.
- Get current data table.
- Extract all columns as matrix.
Example 3
Summary: Process of setting every second row to missing, running multivariate analysis on columns 2-16, imputing missing data, and saving the imputation formula in a JMP data table.
Code:
dt = Open("data_table.jmp");
For( i = 2, i <= N Cols( dt ), i++,
Column( dt, i )[2 * i :: 2 * (i + 1)] = .
);
obj = dt << Multivariate( Y( 2 :: 16 ) );
obj << Impute Missing Data;
dt = Open("data_table.jmp");
For( i = N Cols( dt ), i >= 2, i--,
Column( dt, i )[2 * (i - 1) :: 2 * i] = .
);
obj = dt << Multivariate( Y( 2 :: 16 ) );
obj << Save Imputed Formula;
_mat = (dt << get as matrix( {17 :: N Cols( dt )} ));
obj << Impute Missing Data;
dt1 = Current Data Table();
_mat1 = (dt1 << get as matrix( {1 :: N Cols( dt1 )} ));
Code Explanation:
- Open data table;
- Loop through columns 2 to end.
- Set every second row to missing.
- Run Multivariate analysis on columns 2-16.
- Impute missing data.
- Reopen data_table dataset
- Loop through columns end to 2.
- Set every second row to missing.
- Run Multivariate analysis on columns 2-16.
- Save imputation formula.
Multivariate using Random Integer
Summary: Runs multivariate analysis with different estimation methods and extracts principal components from a data table.
Code:
n = 3;
m = 10;
X = J( m, n, Random Integer( 4 ) );
X[1, 1] = .;
dt = As Table( X );
launch = Function( {meth},
multi = Expr(
dt << Multivariate( Y( 1 :: n ), Estimation Method( estMeth ) )
);
obj = Substitute( Name Expr( multi ), Expr( estMeth ), Eval Expr( meth ) );
bet = Eval( Name Expr( obj ) );
rmult = bet << report;
Method = Arg( Parse( rmult[Text Box( 2 )] << get journal ) );
);
meth = "ML";
launch( meth );
meth = "REML";
launch( meth );
meth = "Robust";
launch( meth );
meth = "Pairwise";
launch( meth );
meth = "Row-wise";
launch( meth );
Close( dt, No Save );
dt = Open("data_table.jmp");
obj = dt << Multivariate( Y( 2 :: 16 ), Principal Components( on Correlations, Score Plot( 2 ), Save Principal Components( 2 ) ) );
principal1 = dt << get as matrix( 17 );
principal2 = dt << get as matrix( 18 );
Code Explanation:
- Initialize variables n and m.
- Create matrix X with random integers.
- Set first element of X to missing.
- Convert X to data table dt.
- Define function launch for multivariate analysis.
- Set estimation method based on input.
- Launch multivariate analysis with ML method.
- Launch multivariate analysis with REML method.
- Launch multivariate analysis with Robust method.
- Launch multivariate analysis with Pairwise method.
- Launch multivariate analysis with Row-wise method.
- Close data table dt without saving.
- Open data table;
- Perform multivariate analysis on columns 2 to 16.
- Extract principal components into matrices.
Multivariate using N Col
Example 1
Summary: Performs a multivariate analysis workflow, including principal component extraction and reporting, using JMP's scripting language.
Code:
dt = Open("data_table.jmp");
nc = N Col( dt );
obj = dt << Multivariate(
Y(
: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
)
);
obj << Principal Components( "on Correlations", Save Principal Components( 27 ) );
ncPC1 = N Col( dt ) - nc;
nc = N Col( dt );
obj2 = dt << Principal Components(
Y(
: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
),
Estimation Method( "Default" ),
"on Correlations"
);
obj2 << Save Principal Components( 27 );
ncPC2 = N Col( dt ) - nc;
Close( dt, nosave );
Random Reset( 444 );
mat = J( 24, 31, Random Normal() );
dt = As Table( mat );
obj = dt << Principal Components( Y( 1 :: 31 ), Estimation Method( "Wide" ), Eigenvalues( 1 ) );
rpt = obj << Report();
Code Explanation:
- Open data table;
- Count initial columns.
- Run Multivariate analysis.
- Enable Principal Components on correlations.
- Save 27 principal components.
- Count new columns after PCA.
- Run another Multivariate analysis.
- Set estimation method to default.
- Enable Principal Components on correlations.
- Save 27 principal components.
- Count new columns after PCA.
- Close dataset without saving.
- Reset random seed.
- Create random normal matrix.
- Convert matrix to table.
- Run Principal Components analysis.
- Extract report.
Example 2
Summary: Process of performing two multivariate analyses on a data table, enabling principal components on correlations and saving 27 principal components in each analysis.
Code:
dt = Open("data_table.jmp");
nc = N Col( dt );
obj = dt << Multivariate(
Y(
: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
)
);
obj << Principal Components( "on Correlations", Save Principal Components( 27 ) );
ncPC1 = N Col( dt ) - nc;
nc = N Col( dt );
obj2 = dt << Principal Components(
Y(
: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
),
Estimation Method( "Default" ),
"on Correlations"
);
obj2 << Save Principal Components( 27 );
ncPC2 = N Col( dt ) - nc;
Code Explanation:
- Open data table;
- Count initial columns.
- Run Multivariate analysis.
- Enable Principal Components on Correlations.
- Save 27 principal components.
- Count new columns after PCA.
- Run another Multivariate analysis.
- Enable Principal Components on Correlations.
- Save 27 principal components again.
- Count new columns after second PCA.