Factor Analysis
Example 1
Summary: Runs factor analysis on a data table, specifying variables for analysis and customizing the Scree Plot scale with two formats.
Code:
dt = Open("data_table.jmp");
Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Estimation Method( "Row-wise" ),
Variance Scaling( "Correlations" ),
Fit( "ML", "SMC", 1, "Varimax" ),
SendToReport(
Dispatch( {"Scree Plot"}, "1", ScaleBox, {Format( "Custom", Formula( "Sqrt(" || Char( value ^ 2 ) || ")" ), 12 )} ),
Dispatch( {"Scree Plot"}, "2", ScaleBox, {Format( "Custom", Formula( Char( Round( Root( value, 2 ), 2 ) ) || "^2" ), 12 )} )
)
);
Code Explanation:
- Open data table;
- Perform factor analysis.
- Specify variables for analysis.
- Set estimation method to row-wise.
- Use correlations for variance scaling.
- Fit model using ML, SMC, and Varimax.
- Customize Scree Plot scale.
- Apply custom format to first scale.
- Apply custom format to second scale.
- Display customized reports.
Example 2
Summary: Runs the factor analysis process to extract underlying structure from a dataset, utilizing row-wise estimation and variance scaling by covariances.
Code:
dt under test = Open("data_table.jmp");
obj = Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Estimation Method( "Row-wise" ),
Variance Scaling( Covariances ),
Eigenvalues( 0 ),
Scree Plot( 0 ),
Fit(
ML,
SMC,
2,
Varimax,
Prior Communality( 0 ),
Eigenvalues( 0 ),
Rotation Matrix( 0 ),
Final Communality Estimates( 0 ),
Standard Score Coefficients( 0 ),
Variance Explained by Each Factor( 0 ),
Significance Test( 0 ),
Factor Loading Plot( 0 )
)
);
Code Explanation:
- Open data table.
- Perform factor analysis.
- Set response variables.
- Use row-wise estimation method.
- Scale variances by covariances.
- Disable eigenvalue output.
- Disable scree plot.
- Fit model using ML method.
- Use SMC for initial communality estimates.
- Specify 2 factors for rotation.
Example 3
Summary: Runs a factor analysis on covariances with 2 factors using Maximum Likelihood and Varimax rotation, then sends the results to a dispatch report with a customized frame size.
Code:
dt = Open("data_table.jmp");
obj = Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Estimation Method( "Row-wise" ),
Variance Scaling( Covariances ),
Fit( ML, SMC, 2, Varimax ),
SendToReport(
Dispatch( {"Factor Analysis on Covariances with 2 Factors: Maximum Likelihood / Varimax", "Factor Loading Plot"},
"Principal Components Loading Plot", FrameBox,
{Frame Size( 56, 39 )}
)
)
);
Code Explanation:
- Open table.
- Define factor analysis object.
- Set response variables.
- Specify estimation method.
- Choose variance scaling.
- Fit model with ML, SMC, 2 factors.
- Apply Varimax rotation.
- Send report to dispatch.
- Adjust frame size.
- Display factor loading plot.
Example 4
Summary: Runs factor analysis on selected variables, enabling automatic recalculation and local data filtering for Benzene range, while excluding rows with Ether values less than 0.
Code:
dt = Open("data_table.jmp");
obj = Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Automatic Recalc( 1 ),
Estimation Method( "Row-wise" ),
Variance Scaling( "Correlations" ),
Fit( "ML", "SMC", 1, "Varimax" ),
);
obj << Local Data Filter(
Location( {1087, 151} ),
Add Filter( columns( :Benzene ), Where( :Benzene >= -1.3687 & :Benzene <= 2.225 ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
obj << Automatic Recalc( 0 );
dt << Select Where( :Ether < 0 );
dt << Exclude();
rpt = obj << Report;
vallist = (rpt[Number Col Box( 2 )]);
Code Explanation:
- Open data table;
- Perform Factor Analysis on selected variables.
- Enable automatic recalculation.
- Use row-wise estimation method.
- Scale variance using correlations.
- Fit model with ML, SMC, Varimax.
- Disable automatic recalculation.
- Create local data filter for Benzene.
- Set filter criteria for Benzene range.
- Exclude rows where Ether is less than 0.
Example 5
Summary: Runs factor analysis on selected variables, adds local data filter for Benzene, and generates a report with values from the second number column box.
Code:
dt = Open("data_table.jmp");
obj = Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Automatic Recalc( 1 ),
Estimation Method( "Row-wise" ),
Variance Scaling( "Correlations" ),
Fit( "ML", "SMC", 1, "Varimax" ),
);
obj << Local Data Filter(
Location( {1087, 151} ),
Add Filter( columns( :Benzene ), Where( :Benzene >= -1.3687 & :Benzene <= 2.225 ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
dt << Select Where( :Ether < 0 );
dt << Exclude();
rpt = obj << Report;
vallist = (rpt[Number Col Box( 2 )]);
Close( dt, NoSave );
dt = Open("data_table.jmp");
obj = Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Automatic Recalc( 1 ),
Estimation Method( "Row-wise" ),
Variance Scaling( "Correlations" ),
Fit( "ML", "SMC", 1, "Varimax" ),
);
obj << Local Data Filter(
Location( {1087, 151} ),
Add Filter( columns( :Benzene ), Where( :Benzene >= -1.3687 & :Benzene <= 2.225 ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
obj << Automatic Recalc( 0 );
dt << Select Where( :Ether < 0 );
dt << Exclude();
rpt = obj << Report;
vallist = (rpt[Number Col Box( 2 )]);
Code Explanation:
- Open data table;
- Perform factor analysis on selected variables.
- Add local data filter for Benzene.
- Select rows where Ether is less than 0.
- Exclude selected rows.
- Generate factor analysis report.
- Retrieve values from second number column box.
- Close dataset without saving.
- Reopen data_table dataset
- Repeat factor analysis with same settings.
Example 6
Summary: Runs a factor analysis on the 'Name' variable, utilizing row-wise estimation and variance scaling to generate a report with customized frame settings.
Code:
dt under test = Open("data_table.jmp");
obj = Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Estimation Method( "Row-wise" ),
Variance Scaling( Covariances ),
Fit( ML, SMC, 2, Varimax ),
SendToReport( Dispatch( FrameBox, {Frame Size( 56, 39 )} ) )
);
Code Explanation:
- Open data table.
- Define analysis variables.
- Set estimation method.
- Choose variance scaling.
- Specify fit parameters.
- Send report settings.
Example 7
Summary: Runs a Factor Analysis on selected columns, generating reports with customized font and style, and redoing analysis with new settings to compare report equality.
Code:
dt = Open("data_table.jmp");
:Benzene << set values( {1, 1, 1} );
obj = Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Estimation Method( "Row-wise" ),
Variance Scaling( "Correlations" ),
Fit( "ML", "SMC", 1, "Varimax" ),
SendToReport( Dispatch( {}, "Model Launch", OutlineBox, {Set Font( "Segoe UI" ), Set Font Size( 11 ), Set Font Style( "Bold" )} ) )
);
rpt1 = obj << Report;
:Benzene << Set Property( "Missing Value Codes", 1 );
obj2 = obj << Redo Analysis;
rpt = obj2 << Report;
a = rpt << get text;
b = rpt1 << get text;
ans = Equal( a, b );
Code Explanation:
- Open data table;
- Set "Benzene" values to {1, 1, 1}.
- Perform Factor Analysis on selected columns.
- Configure analysis method and scaling.
- Fit model using ML, SMC, Varimax.
- Customize report font and style.
- Generate initial report.
- Set "Benzene" missing value code to 1.
- Redo analysis with new settings.
- Compare reports for equality.
Example 8
Summary: Runs factor analysis on a data table to extract eigenvalues, prior communality estimates, and rotation matrices using JMP's Factor Analysis platform.
Code:
dt = Open("data_table.jmp");
obj = dt << Factor Analysis(
Y( :Total Population, :Median School Years, :Total Employment, :Professional Services, :Median House Value ),
Estimation Method( "ML" ),
Variance Scaling( Correlations ),
Fit( ML, SMC, 2, Varimax ),
);
rpt = obj << report;
orig eigen = rpt["Eigenvalues"][Table Box( 1 )] << get as matrix;
smc = (rpt[Outline Box( "Prior Communality Estimates:SMC" )][Matrix Box( 1 )] << get);
eigenvalue = Matrix( rpt[Number Col Box( "Eigenvalue" )] << get );
unrotated = Matrix( rpt[Outline Box( "Unrotated Factor Loading" )][Matrix Box( 1 )] << get );
rotated = (rpt[Outline Box( "Rotation Matrix" )][Matrix Box( 1 )] << get);
finalCommunalityEstimates = (rpt[Outline Box( "Final Communality Estimates" )][Matrix Box( 1 )] << get);
stdScoreCoefs = (rpt[Outline Box( "Standard Score Coefficients" )][Matrix Box( 1 )] << get);
varFactor = Matrix( rpt[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Variance" )] << get );
varPercent = Matrix( rpt[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Percent" )] << get );
varCum = Matrix( rpt[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Cum Percent" )] << get );
significanceTest1 = (rpt[Outline Box( "Significance Test" )][Table Box( 1 )][Number Col Box( "DF" )] << get) |/ (rpt[
Outline Box( "Significance Test" )][Table Box( 1 )][Number Col Box( "ChiSquare" )] << get) |/ (rpt[Outline Box( "Significance Test" )][
Table Box( 1 )][Number Col Box( "Prob>ChiSq" )] << get);
significanceTest2 = (rpt[Outline Box( "Significance Test" )][Table Box( 2 )][Number Col Box( "DF" )] << get) |/ (rpt[
Outline Box( "Significance Test" )][Table Box( 2 )][Number Col Box( "ChiSquare" )] << get) |/ (rpt[Outline Box( "Significance Test" )][
Table Box( 2 )][Number Col Box( "Prob>ChiSq" )] << get);
rotatedFactorLoading = Matrix( rpt[Outline Box( "Rotated Factor Loading" )][Matrix Box( 1 )] << get );
Code Explanation:
- Open data_table data
- Perform factor analysis.
- Set estimation method to ML.
- Use correlations for variance scaling.
- Fit model with ML, SMC, 2 factors.
- Extract eigenvalues report.
- Retrieve prior communality estimates.
- Get eigenvalue data.
- Fetch unrotated factor loadings.
- Obtain rotation matrix.
Example 9
Summary: Runs a factor analysis process to extract eigenvalues, SMC estimates, and final communality estimates from the data table, utilizing JMP's Factor Analysis platform.
Code:
dt = Open("data_table.jmp");
obj = dt << Factor Analysis(
Y( :Total Population, :Median School Years, :Total Employment, :Professional Services, :Median House Value ),
Estimation Method( "ML" ),
Variance Scaling( Correlations ),
Fit( ML, SMC, 3, Varimax ),
);
rpt = obj << report;
orig eigen = rpt["Eigenvalues"][Table Box( 1 )] << get as matrix;
smc = (rpt[Outline Box( "Prior Communality Estimates:SMC" )][Matrix Box( 1 )] << get);
eigenvalue = Matrix( rpt[Number Col Box( "Eigenvalue" )] << get );
unrotated = Matrix( rpt[Outline Box( "Unrotated Factor Loading" )][Matrix Box( 1 )] << get );
rotated = (rpt[Outline Box( "Rotation Matrix" )][Matrix Box( 1 )] << get);
finalCommunalityEstimates = (rpt[Outline Box( "Final Communality Estimates" )][Matrix Box( 1 )] << get);
stdScoreCoefs = (rpt[Outline Box( "Standard Score Coefficients" )][Matrix Box( 1 )] << get);
varFactor = Matrix( rpt[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Variance" )] << get );
varPercent = Matrix( rpt[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Percent" )] << get );
varCum = Matrix( rpt[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Cum Percent" )] << get );
significanceTest1 = (rpt[Outline Box( "Significance Test" )][Table Box( 1 )][Number Col Box( "DF" )] << get) |/ (rpt[
Outline Box( "Significance Test" )][Table Box( 1 )][Number Col Box( "ChiSquare" )] << get) |/ (rpt[Outline Box( "Significance Test" )][
Table Box( 1 )][Number Col Box( "Prob>ChiSq" )] << get);
significanceTest2 = (rpt[Outline Box( "Significance Test" )][Table Box( 2 )][Number Col Box( "DF" )] << get) |/ (rpt[
Outline Box( "Significance Test" )][Table Box( 2 )][Number Col Box( "ChiSquare" )] << get) |/ (rpt[Outline Box( "Significance Test" )][
Table Box( 2 )][Number Col Box( "Prob>ChiSq" )] << get);
rotatedFactorLoading = Matrix( rpt[Outline Box( "Rotated Factor Loading" )][Matrix Box( 1 )] << get );
Code Explanation:
- Open data_table data
- Perform factor analysis.
- Extract eigenvalues.
- Get SMC estimates.
- Retrieve eigenvalue matrix.
- Fetch unrotated loadings.
- Obtain rotation matrix.
- Extract final communality estimates.
- Get standard score coefficients.
- Calculate variance explained.
Example 10
Summary: Runs factor analysis on a data table, specifying Y variables, variance estimation, and scaling, while suppressing loadings below 0.4022 and fitting the model using ML, SMC, and Varimax.
Code:
dt = Open("data_table.jmp");
obj = dt << Factor Analysis(
Y( :Support_L, :Goal_L, :Work_L, :Interact_L, :Person_C, :Intra_C, :Inter_C ),
Variance Estimation( "Row-wise" ),
Variance Scaling( "Correlations" ),
Suppress Absolute Loading Value Less Than( 0.4022 ),
Fit( "ML", "SMC", 2, "Varimax" ),
SendToReport( Dispatch( {}, "Model Launch", OutlineBox, {Close( 0 )} ) )
);
rpt = obj << Report();
scrObj = rpt[Outline Box( "?/ Varimax" )] << Get Scriptable Object();
scrObj << Copy Model Specification for SEM();
Code Explanation:
- Open data table;
- Perform factor analysis.
- Set Y variables.
- Use row-wise variance estimation.
- Scale variances by correlations.
- Suppress loadings less than 0.4022.
- Fit model using ML, SMC, 2 factors, Varimax.
- Close model launch outline.
- Retrieve report object.
- Copy Varimax model specification for SEM.
Multiple Factor Analysis
Example 1
Summary: Runs Multiple Factor Analysis (MFA) on a data table, defining product IDs and Z variables, creating MFA blocks, and customizing report settings.
Code:
dt = Open("data_table.jmp");
dt << Multiple Factor Analysis(
Product ID( :Vineyard ),
Z( :Region ),
MFA Blocks(
{"Susan Fruity etc.", :Susan Fruity, :Susan Flowery, :Susan Spicy, :Susan Crispness},
{"Florence Flowery etc.", :Florence Flowery, :Florence Crispness, :Florence Tannin, :Florence Savory, :Florence Lightness},
{"Xavier Fruity etc.", :Xavier Fruity, :Xavier Spicy, :Xavier Crispness, :Xavier Alcohol, :Xavier Savory, :Xavier Lightness},
{"Robert Fruity etc.", :Robert Fruity, :Robert Flowery, :Robert Spicy, :Robert Crispness, :Robert Tannin, :Robert Alcohol,
:Robert Savory, :Robert Lightness},
{"Paula Fruity etc.", :Paula Fruity, :Paula Flowery, :Paula Spicy, :Paula Crispness, :Paula Tannin, :Paula Savory},
{"Monica Fruity etc.", :Monica Fruity, :Monica Flowery, :Monica Spicy, :Monica Tannin, :Monica Alcohol, :Monica Savory,
:Monica Lightness},
{"Frank Fruity etc.", :Frank Fruity, :Frank Flowery, :Frank Spicy, :Frank Crispness, :Frank Tannin, :Frank Alcohol, :Frank Savory,
:Frank Lightness}
),
Summary Plots( 0 ),
Consensus Map( 0 ),
Block Partial Inertias( 1 ),
Block Partial Contributions( 1 ),
SendToReport(
Dispatch( {"Block Partial Contributions"}, "MFA Options", FrameBox, {Marker Size( 1 ), Marker Drawing Mode( "Normal" )} )
)
);
Code Explanation:
- Open data table.
- Launch Multiple Factor Analysis.
- Set Product ID variable.
- Define Z variable.
- Create MFA blocks.
- Disable summary plots.
- Disable consensus map.
- Enable block partial inertias.
- Enable block partial contributions.
- Customize report settings.
Example 2
Summary: Performs a Multiple Factor Analysis (MFA) to identify patterns and relationships between variables in the data table, generating a partial axis plot and biplot for visualization.
Code:
dt = Open("data_table.jmp");
Multiple Factor Analysis(
Product ID( :Vineyard ),
Z( :Region ),
MFA Blocks(
{"Carolyn Peppery etc.", :Carolyn Peppery, :Carolyn Tannic, :Carolyn Aromatic, :Carolyn Berry Notes},
{"Susan Fruity etc.", :Susan Fruity, :Susan Flowery, :Susan Spicy, :Susan Crispness},
{"Florence Flowery etc.", :Florence Flowery, :Florence Crispness, :Florence Tannin, :Florence Savory, :Florence Lightness},
{"Xavier Fruity etc.", :Xavier Fruity, :Xavier Spicy, :Xavier Crispness, :Xavier Alcohol, :Xavier Savory, :Xavier Lightness},
{"Robert Fruity etc.", :Robert Fruity, :Robert Flowery, :Robert Spicy, :Robert Crispness, :Robert Tannin, :Robert Alcohol,
:Robert Savory, :Robert Lightness},
{"Paula Fruity etc.", :Paula Fruity, :Paula Flowery, :Paula Spicy, :Paula Crispness, :Paula Tannin, :Paula Savory}
),
Partial Axis Plot( 1 ),
Biplot( 1 )
);
Code Explanation:
- Open data table.
- Run Multiple Factor Analysis.
- Set Product ID variable.
- Set Z variable.
- Define MFA Blocks.
- Create Partial Axis Plot.
- Create Biplot.
Example 3
Summary: Runs multiple factor analysis on a data table, defining blocks and selecting consensus map components to highlight products with small inertia.
Code:
dt = Open("data_table.jmp");
dt << Multiple Factor Analysis(
MFA Blocks(
{"Carolyn Peppery etc.", :Carolyn Peppery, :Carolyn Tannic, :Carolyn Aromatic, :Carolyn Berry Notes},
{"Susan Fruity etc.", :Susan Fruity, :Susan Flowery, :Susan Spicy, :Susan Crispness},
{"Florence Flowery etc.", :Florence Flowery, :Florence Crispness, :Florence Tannin, :Florence Savory, :Florence Lightness}
),
Consensus Map Select Component( 1, 2 ),
Highlight Product( "Small Inertia", 0.0690263210638801 )
);
Code Explanation:
- Open data table;
- Perform multiple factor analysis.
- Define blocks for analysis.
- Select consensus map components.
- Highlight products with small inertia.
Example 4
Summary: Runs multiple factor analysis (MFA) on a data table, defining MFA blocks with specified variables and saving block partial scores.
Code:
dt = Open("data_table.jmp");
obj = dt << Multiple Factor Analysis(
MFA Blocks(
{"Carolyn Peppery etc.", :Carolyn Peppery, :Carolyn Tannic, :Carolyn Aromatic, :Carolyn Berry Notes},
{"Susan Fruity etc.", :Susan Fruity, :Susan Flowery, :Susan Spicy, :Susan Crispness}
)
);
mytab = obj << Save Block Partial Scores();
Code Explanation:
- Open data table.
- Perform multiple factor analysis.
- Define MFA blocks.
- Specify block names and variables.
- Save block partial scores.
Example 5
Summary: Runs multiple factor analysis on a data table, defining blocks and specifying variables for each block, and saves partial axes coordinates.
Code:
dt = Open("data_table.jmp");
obj = dt << Multiple Factor Analysis(
MFA Blocks(
{"Carolyn Peppery etc.", :Carolyn Peppery, :Carolyn Tannic, :Carolyn Aromatic, :Carolyn Berry Notes},
{"Susan Fruity etc.", :Susan Fruity, :Susan Flowery, :Susan Spicy, :Susan Crispness}
)
);
mytab = obj << Save Partial Axes Coordinates();
Code Explanation:
- Open data table.
- Perform multiple factor analysis.
- Define blocks for analysis.
- Specify variables for first block.
- Specify variables for second block.
- Save partial axes coordinates.
- Store result in variable.
Example 6
Summary: Runs the creation and visualization of a Multiple Factor Analysis (MFA) object with partial axes plot and biplot, selecting specific components for each.
Code:
Open("data_table.jmp");
obj = Multiple Factor Analysis(
MFA Blocks(
{"Carolyn Peppery etc.", :Carolyn Peppery, :Carolyn Tannic, :Carolyn Aromatic, :Carolyn Berry Notes},
{"Susan Fruity etc.", :Susan Fruity, :Susan Flowery, :Susan Spicy, :Susan Crispness}
)
);
obj << Partial Axes Plot Select Component( 1, 3 );
obj << Biplot Select Component( 1, 3 );
Code Explanation:
- Open data table;
- Create Multiple Factor Analysis object.
- Define MFA blocks with variables.
- Generate Partial Axes Plot.
- Select specific components for plot.
- Generate Biplot.
- Select specific components for biplot.
Example 7
Summary: Performs the Multiple Factor Analysis (MFA) process to identify relationships between variables, and generates a partial axes plot and biplot for visual exploration.
Code:
dt = Open("data_table.jmp");
obj = Multiple Factor Analysis(
MFA Blocks(
{"Carolyn Peppery etc.", :Carolyn Peppery, :Carolyn Tannic, :Carolyn Aromatic, :Carolyn Berry Notes},
{"Susan Fruity etc.", :Susan Fruity, :Susan Flowery, :Susan Spicy, :Susan Crispness}
)
);
obj << Partial Axes Plot Select Component( 1, 3 );
obj << Biplot Select Component( 1, 3 );
Code Explanation:
- Open table.
- Perform MFA analysis.
- Define MFA blocks.
- Select components for plot.
- Generate partial axes plot.
- Select components for biplot.
- Generate biplot.
Example 8
Summary: Process of performing multiple factor analysis on a data table, generating a report, and enabling/disabling block squared cosines to extract journal information.
Code:
dt = Open("data_table.jmp");
obj = dt << Multiple Factor Analysis( MFA Blocks( {:Al, :Mn, :Na, :Br}, {:Ce, :Co, :Cr, :Cs}, {:Eu, :Fe, :Hf, :La} ) );
rpt = obj << Report();
obj << Block Squared Cosines( 1 );
blkJournal = rpt[Outline Box( "Block Squared Cosines" )] << Get Journal();
obj << Block Squared Cosines( 0 );
Try( blkJournal = rpt[Outline Box( "Block Squared Cosines" )] << Get Journal() );
Code Explanation:
- Open data table.
- Perform multiple factor analysis.
- Retrieve analysis report.
- Enable block squared cosines.
- Extract block journal.
- Disable block squared cosines.
- Attempt to extract block journal again.
Example 9
Summary: Performs a Multiple Factor Analysis (MFA) workflow, generating reports and extracting journals from the analysis results.
Code:
dt = Open("data_table.jmp");
obj = Multiple Factor Analysis(
MFA Blocks(
{"Carolyn Peppery etc.", :Carolyn Peppery, :Carolyn Tannic, :Carolyn Aromatic, :Carolyn Berry Notes},
{"Susan Fruity etc.", :Susan Fruity, :Susan Flowery, :Susan Spicy, :Susan Crispness}
)
);
rpt1 = obj << Report();
jrn1 = rpt1[Outline Box( "Multiple Factor Analysis" )] << Get Journal();
obj << Partial Axis Plot Select component( 1, 3 );
rpt2 = obj << Report();
jrn2 = rpt2[Outline Box( "Multiple Factor Analysis" )] << Get Journal();
obj << Partial Axes Plot Select component( 1, 3 );
rpt3 = obj << Report();
jrn3 = rpt3[Outline Box( "Multiple Factor Analysis" )] << Get Journal();
Code Explanation:
- Open data table;
- Run Multiple Factor Analysis.
- Retrieve initial report.
- Extract journal from first report.
- Select component 1, axis 3.
- Generate second report.
- Extract journal from second report.
- Select component 1, axis 3 again.
- Generate third report.
- Extract journal from third report.
Example 10
Summary: Runs Multiple Factor Analysis (MFA) to identify patterns and relationships between variables, generating a partial axes plot with selected components.
Code:
dt = Open("data_table.jmp");
obj = Multiple Factor Analysis(
MFA Blocks(
{"Carolyn Peppery etc.", :Carolyn Peppery, :Carolyn Tannic, :Carolyn Aromatic, :Carolyn Berry Notes},
{"Susan Fruity etc.", :Susan Fruity, :Susan Flowery, :Susan Spicy, :Susan Crispness}
)
);
obj << Partial Axes Plot Select component( 1, 3 );
Code Explanation:
- Open data table.
- Perform Multiple Factor Analysis.
- Define MFA blocks.
- Specify Carolyn block variables.
- Specify Susan block variables.
- Generate partial axes plot.
- Select component 1.
- Select component 3.
Example 11
Summary: Performs the Multiple Factor Analysis (MFA) process on a data table, defining factor blocks and relaunching the analysis.
Code:
dt = Open("data_table.jmp");
obj = dt << Multiple Factor Analysis( MFABlocks( {:Al, :Mn, :Na}, {:Br, :Ce, :Co} ) );
obj << Relaunch Analysis();
Code Explanation:
- Open data table.
- Perform Multiple Factor Analysis.
- Define factor blocks.
- Relaunch analysis.
Example 12
Summary: Performs the Multiple Factor Analysis (MFA) process, defining blocks and relaunching the analysis to retrieve journal information.
Code:
dt = Open("data_table.jmp");
obj = dt << Multiple Factor Analysis( MFA Blocks( {"MyBlock1", :Sepal length, :Sepal width}, {"MyBlock2", :Petal length, :Petal width} ) );
obj << Relaunch Analysis();
launchWin = Get Window( "Multiple Factor Analysis Model Dialog" );
actJrn = launchWin << Get Journal();
actAddBlock1 = Regex( actJrn, "MyBlock1" );
actAddBlock2 = Regex( actJrn, "MyBlock2" );
Code Explanation:
- Open data table;
- Launch Multiple Factor Analysis.
- Define MFA blocks.
- Relaunch the analysis.
- Get MFA dialog window.
- Retrieve journal from window.
- Search for "MyBlock1" in journal.
- Search for "MyBlock2" in journal.
Factor Analysis using Tick Seconds
Example 1
Summary: Perform a Multiple Factor Analysis (MFA) on a data table, defining blocks and enabling RV correlations and LG coefficients.
Code:
dt = Open("data_table.jmp");
start = Tick Seconds();
obj = dt << Multiple Factor Analysis(
MFA Blocks( {"Block 1", :NPN1, :PNP1}, {"Block 2", :PNP2, :NPN2}, {"Block 3", :PNP3, :IVP1} ),
RV Correlations( 1 ),
Lg Coefficients( 1 )
);
end = Tick Seconds();
elapsed = end - start;
Code Explanation:
- Open table.
- Start timer.
- Perform MFA analysis.
- Define blocks.
- Enable RV correlations.
- Enable LG coefficients.
- End timer.
- Calculate elapsed time.
Example 2
Summary: Performs principal component analysis (PCA) on a data table, specifying row-wise estimation method and factor analysis with ML method, Varimax rotation, and correlation inclusion.
Code:
dt = Open("data_table.jmp");
t1 = Tick Seconds();
obj = dt << Principal Components(
Y( :Sepal length, :Sepal width, :Petal length, :Petal width ),
Estimation Method( "Row-wise" ),
on Correlations,
Factor Analysis( ML, SMC, 3, Varimax )
);
t2 = Tick Seconds();
rpt = obj << Report();
rpt = rpt["Factor Loading Plot"];
Code Explanation:
- Open data table;
- Start timer.
- Perform principal component analysis.
- Specify variables for analysis.
- Use row-wise estimation method.
- Include correlations.
- Apply factor analysis with ML method.
- Set SMC value to 3.
- Use Varimax rotation.
- Stop timer.
Factor Analysis using Log Capture
Example 1
Summary: Runs factor analysis and score plot generation for a specified data table, capturing log output and retrieving resulting data tables.
Code:
dt = Open("data_table.jmp");
log = Log Capture(
obj = dt << Factor Analysis(
Y( :Total Population, :Median School Years, :Total Employment, :Professional Services, :Median House Value ),
Variance Scaling( "Correlations" ),
Fit( "ML", "SMC", 2, "Varimax" )
)
);
_dts = obj << Get Data Table;
_dts = If( Is List( _dts ),
_dts,
Eval List( {_dts} )
);
For( _i = 1, _i <= N Items( _dts ), _i++,
_dts[_i] << Select Rows( Index( 1, N Row( _dts[_i] ) ) )
);
_dts << Delete Rows;
obj << (Fit[1] << Score Plot( 1 ));
obj << (Fit[1] << Score Plot( 1 ));
Code Explanation:
- Open data table.
- Perform factor analysis.
- Capture log output.
- Retrieve resulting data tables.
- Ensure data tables are in list form.
- Loop through each data table.
- Select all rows in each table.
- Delete selected rows from each table.
- Generate score plot for first fit.
- Repeat score plot generation.
Example 2
Summary: Runs the factor analysis process for a data table, utilizing row-wise variance estimation and correlation-based scaling.
Code:
dt = Open("data_table.jmp");
log = Log Capture(
fa = dt << Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform, :Benzene, :Carbon Tetrachloride, :Hexane ),
Variance Estimation( "Row-wise" ),
Variance Scaling( "Correlations" ),
Fit( "ML", "SMC", 2, "Varimax" )
)
);
Code Explanation:
- Open data table;
- Start log capture.
- Perform factor analysis.
- Set response variables.
- Use row-wise variance estimation.
- Scale variances by correlations.
- Fit using ML method.
- Fit using SMC method.
- Specify 2 factors.
- Apply Varimax rotation.
Example 3
Summary: Runs factor analysis on a data table, capturing the maximum likelihood and Varimax rotation results, and calculates the difference from baseline values.
Code:
dt = Open("data_table.jmp");
log = Log Capture(
Factor Analysis(
Y( :Total Population, :Median School Years, :Total Employment, :Professional Services, :Median House Value ),
Variance Estimation( "Row-wise" ),
Variance Scaling( "Correlations" ),
Fit( "ML", "ONE", 3, "Varimax" )
)
);
rpt = Current Report();
results_mx = (rpt[Outline Box( "?Maximum Likelihood / Varimax" )][Number Col Box( 7 )]) << get as matrix();
results_bm_mx = -2;
comp = Round( results_mx, 3 ) - Round( results_bm_mx, 3 );
Code Explanation:
- Open data table.
- Start logging output.
- Perform factor analysis.
- Set variance estimation method.
- Set variance scaling method.
- Fit model using ML and Varimax.
- Capture current report.
- Extract specific report element.
- Convert extracted data to matrix.
- Calculate difference from baseline value.
Example 4
Summary: Runs factor analysis and visualization for a data table, generating score plots and factor loading plots, while defining final communality values, rotation matrix values, and variance values.
Code:
dt = Open("data_table.jmp");
x = Log Capture( obj = dt << Factor Analysis( Y( 1 :: 4 ), Fit( ML, SMC, 1, Varimax ) ) );
obj << Score Plot;
obj << Factor Loading Plot;
Close( dt, No Save );
finalCommunality_sas = [0.17406442, 0.25183876, 0.19821788, 0.09235689, 0.46386227, 0.51549842, 0.50779990, 0.51361059, 0.24254463,
0.31094842, 0.16923939, 0.22822810, 0.53062310, 0.55584860, 0.59939623, 0.24762886];
rotationMatrix_sas = [0.97847 0.20641, -0.20641 0.97847];
variance_sas = [2.99155331, 2.61015315];
Code Explanation:
- Open data table;
- Perform factor analysis.
- Create score plot.
- Create factor loading plot.
- Close dataset without saving.
- Define final communality values.
- Define rotation matrix values.
- Define variance values.
Example 5
Summary: Process of performing factor analysis on a data table, setting analysis options, and retrieving the report, including accessing a combo box method.
Code:
dt = Open("data_table.jmp");
x = Log Capture( obj = dt << Factor Analysis( Y( 1 :: 5 ), Fit( ML, SMC, 1, Varimax ) ) );
rpt = obj << report;
method = rpt[Combo Box( 1 )] << get;
Code Explanation:
- Open data_table data
- Perform factor analysis.
- Set analysis options.
- Retrieve factor analysis report.
- Access combo box method.
Example 6
Summary: Executes two factor analyses on a data table, capturing reports and extracting variance explained by each factor, percentage variance explained, and cumulative percentage variance explained.
Code:
dt = Open("data_table.jmp");
x = Log Capture( obj1 = dt << Factor Analysis( Y( 2 :: 7 ), Variance Scaling( Correlations ), Fit( ML, SMC, 2, Varimax ), ) );
rpt1 = obj1 << report;
var1 = rpt1[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Variance" )] << get as matrix;
percent1 = rpt1[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Percent" )] << get as matrix;
cum1 = rpt1[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Cum Percent" )] << get as matrix;
x = Log Capture( obj2 = dt << Factor Analysis( Y( 2 :: 7 ), Variance Scaling( Covariances ), Fit( ML, SMC, 2, Varimax ), ) );
rpt2 = obj2 << report;
var2 = rpt2[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Variance" )] << get as matrix;
percent2 = rpt2[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Percent" )] << get as matrix;
cum2 = rpt2[Outline Box( "Variance Explained by Each Factor" )][Number Col Box( "Cum Percent" )] << get as matrix;
Code Explanation:
- Open data table;
- Perform factor analysis on columns 2-7.
- Use correlations for variance scaling.
- Fit model using ML, SMC, 2 factors, Varimax rotation.
- Capture factor analysis report.
- Extract variance explained by each factor.
- Extract percentage variance explained.
- Extract cumulative percentage variance explained.
- Repeat factor analysis with covariances.
- Extract similar metrics from second report.
Example 7
Summary: Process of performing factor analysis on a data table, generating reports, and checking box selections in the Factor Loading Plot.
Code:
dt = Open("data_table.jmp");
x = Log Capture( obj = dt << Factor Analysis( Y( 1 :: 4 ), Variance Scaling( Covariances ), Fit( PC, ONE, 5, Promax ) ) );
Close( dt, No Save );
dt = As Table( J( 240, 33, Random Normal() ) );
x = Log Capture( obj = dt << Factor Analysis( Y( 1 :: N Cols( dt ) ), Fit( ML, SMC, 10, Varimax ) ) );
rpt = obj << report;
labelCheck = rpt[Outline Box( "Factor Loading Plot" )][CheckBoxBox( 1 )] << get;
Code Explanation:
- Open data table;
- Perform factor analysis.
- Close dataset without saving.
- Create new random table.
- Perform factor analysis on new data.
- Retrieve analysis report.
- Check box in factor loading plot.
Example 8
Summary: Runs the factor analysis process on a data table, utilizing maximum likelihood estimation and varimax rotation to extract underlying factors.
Code:
dt = Open("data_table.jmp");
x = Log Capture( obj = dt << Factor Analysis( Y( 1 :: N Cols( dt ) ), Fit( ML, SMC, 2, Varimax ) ) );
Code Explanation:
- Open data_table data
- Perform factor analysis.
- Use maximum likelihood method.
- Apply small sample correction.
- Set initial factors to 2.
- Rotate using varimax method.
- Store results in variable x.
Example 9
Summary: Process of performing factor analysis, creating score plots with imputation, and setting missing values in specific columns, while also retrieving a report object.
Code:
dt = Open("data_table.jmp");
x = Log Capture( obj = dt << Factor Analysis( Y( 1 :: 5 ), Variance Scaling( "Correlations" ), Fit( "ML", "SMC", 2, "Varimax" ) ) );
obj << (Fit[1] << Score Plot with Imputation( 1 ));
Column( dt, "Total Population" )[12] = .;
Column( dt, "Median School Years" )[3] = .;
Column( dt, "Total Employment" )[12] = .;
Column( dt, "Professional Services" )[8] = .;
Column( dt, "Median House Value" )[7] = .;
x = Log Capture(
a = Try( obj = dt << Factor Analysis( Y( 1 :: 5 ), Variance Scaling( "Correlations" ), Fit( "ML", "SMC", 2, "Varimax" ) ) )
);
obj << (Fit[1] << Score Plot with Imputation( 1 ));
Log Capture(
obj = dt << Factor Analysis(
Y( 1 :: 5 ),
Variance Scaling( "Correlations" ),
Estimation Method( "Pairwise" ),
Fit( "ML", "SMC", 2, "Varimax" )
);
obj << (Fit[1] << Score Plot with Imputation( 1 ));
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Perform factor analysis.
- Create score plot with imputation.
- Set missing values in specific columns.
- Repeat factor analysis with missing values.
- Create score plot with imputation again.
- Perform factor analysis with pairwise estimation.
- Create score plot with imputation.
- Retrieve the report object.
Example 10
Summary: Runs factor analysis on a data table, capturing the log and setting selected item in listbox.
Code:
dt = Open("data_table.jmp");
x = Log Capture(
obj = dt << Factor Analysis(
Y( :Name( "1-Octanol" ), :Ether, :Chloroform ),
Estimation Method( "Row-wise" ),
Variance Scaling( "Correlations" ),
Fit( "ML", "SMC", 1, "Varimax" ),
Column Switcher( :Ether, {:Benzene, :Carbon Tetrachloride, :Hexane} )
)
);
Window( "data_table - Factor Analysis" )[listboxbox( 1 )] << Set Selected( 1, 1 );
Code Explanation:
- Open data table;
- Perform factor analysis.
- Set Y variables: 1-Octanol, Ether, Chloroform.
- Use row-wise estimation method.
- Scale variance by correlations.
- Fit models: ML, SMC, Varimax.
- Switch column Ether to Benzene, Carbon Tetrachloride, Hexane.
- Capture log of factor analysis.
- Create window "Solubility - Factor Analysis".
- Select first item in listbox.
Example 11
Summary: Process of performing factor analysis on a data table, capturing the report and extracting eigenvalues and number of factors.
Code:
dt = Open("data_table.jmp");
x = Log Capture( obj = dt << Factor Analysis( Y( 2 :: 16 ) ) );
rpt = obj << report;
eigenvalues = Matrix( rpt[Number Col Box( "Eigenvalue" )] << get );
numberFactors = rpt[Number Edit Box( 1 )] << get;
Code Explanation:
- Open data table;
- Perform factor analysis.
- Capture factor analysis object.
- Retrieve report from analysis.
- Extract eigenvalues from report.
- Get number of factors from report.
Example 12
Summary: Runs factor analysis and generates score and loading plots from a data table, utilizing the Log Capture feature to capture analysis results.
Code:
dt = Open("data_table.jmp");
x = Log Capture( obj = dt << Factor Analysis( Y( 1 :: 4 ), Fit( ML, SMC, 1, Varimax ) ) );
obj << Score Plot;
obj << Factor Loading Plot;
Code Explanation:
- Open data table;
- Perform factor analysis.
- Log capture analysis results.
- Generate score plot.
- Generate factor loading plot.
Example 13
Summary: Process of performing factor analysis on a data table, utilizing variance scaling with covariances and fitting principal components with Promax rotation.
Code:
dt = Open("data_table.jmp");
x = Log Capture( obj = dt << Factor Analysis( Y( 1 :: 4 ), Variance Scaling( Covariances ), Fit( PC, ONE, 5, Promax ) ) );
Code Explanation:
- Open data table;
- Perform factor analysis.
- Set analysis variables.
- Use covariances scaling.
- Fit principal components.
- Set number of components to 5.
- Apply Promax rotation.
Factor Analysis using Principal Components
Example 1
Summary: Performs Principal Component Analysis (PCA) to extract underlying factors from a dataset, utilizing row-wise estimation and Varimax rotation.
Code:
dt = Open("data_table.jmp");
obj = dt << Principal Components(
Y( :Sepal length, :Sepal width, :Petal length, :Petal width ),
Estimation Method( "Row-wise" ),
on Correlations,
Factor Analysis( ML, SMC, 3, Varimax )
);
rp = Report( obj );
Code Explanation:
- Open data table;
- Perform PCA analysis.
- Specify variables for analysis.
- Use row-wise estimation method.
- Analyze correlations.
- Apply factor analysis.
- Set method to Maximum Likelihood.
- Use Squared Multiple Correlation.
- Set number of factors to 3.
- Apply Varimax rotation.
Example 2
Summary: Performs a life distribution analysis using principal components and factor analysis to extract insights from appliance data, generating reports and interactive plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Principal Components( Y( 2 :: 16 ) );
obj << Factor Analysis( 6 );
obj << Factor Analysis( 7 );
obj << Factor Analysis( 0 );
rpt = obj << report;
Close( dt, No Save );
dt = As Table( J( 240, 33, Random Normal() ) );
obj = dt << Principal Components( Y( 1 :: N Cols( dt ) ) );
rpt = obj << report;
labelCheck = rpt[Outline Box( "Summary Plots" )][CheckBoxBox( 1 )] << get;
Code Explanation:
- Open data table;
- Perform principal components analysis.
- Conduct factor analysis for 6 factors.
- Conduct factor analysis for 7 factors.
- Conduct factor analysis for all factors.
- Generate report from analysis.
- Close data table without saving.
- Create new random data table.
- Perform principal components analysis on new data.
- Extract label check status from summary plots.
Example 3
Summary: Performs a life distribution analysis using Principal Components and Factor Analysis to extract insights from appliance data, generating a report with summary plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Principal Components( Y( 2 :: 16 ) );
obj << Factor Analysis( 6 );
obj << Factor Analysis( 7 );
obj << Factor Analysis( 0 );
rpt = obj << report;
Code Explanation:
- Open data table.
- Run Principal Components analysis.
- Perform Factor Analysis for 6 factors.
- Perform Factor Analysis for 7 factors.
- Perform Factor Analysis for 0 factors.
- Generate analysis report.