2.13.3.1 pca(Pro)

Menu Information

Statistics: Multivariate Analysis: Principal Component Analysis

Brief Information

Perform principal component analysis.

Additional Information

This feature is for OriginPro only.

Minimum Origin Version Required:Origin 8.6

The label variable is available since Origin 2015.

Command Line Usage

1. pca -r 1 mtype:=cov std:=1 screeplot:=0 splot:=1;

2. pca std:=1 lplot:=0 biplot:=0;

3. pca std:=1 eigenvec:=0 xcomp:=2 ycomp:=1 splot:=1;

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Variables irng

Input

Range

<active>
Specify the input variables. At least two input datasets are required. Note that beginning with Origin 2020b, there is a shortened syntax that follows the form [Book]Sheet!(N1:N2), N1 = the beginning column index and N2 being the ending column index in a contiguous range of columns. More complex strings from non-contiguous data of the form [Book]Sheet!([Book]Sheet!N1:N2,[Book]Sheet!N3:N4) are also possible.
Observation Labels label

Input

Range

<optional>
Specify the dataset for observation label. It can be used for the scores plot.
Analyze mtype

Input

int

0
Select the matrix type to analyze.

Option list:

  • corr:Correlation Matrix
    Use correlation matrix to analyze.
  • cov:Covariance Matrix
    Use covariance matrix to analyze.
Number of Components to Extract npc

Input

int

2
Specify the number of principal components to extract. This value should be between 1 and the number of variables.
Standardize Scores std

Input

int

0
Determine whether to standardize scores.

For excluding missing values in listwise fashion, scores will be standardized as unit variance. For the pairwise, scores will be scaled by the square root of the eigenvalue. The scores data in Score Plot and Biplot will be standardized if std is 1.

Exclude Missing Values missing

Input

int

0
Specify the mode for excluding missing values from analysis.

Option list:

  • Listwise
    An observation containing one or more missing values will be excluded in the analysis.
  • Pairwise
    An observation is excluded only in the calculation of covariance or correlation between two variables if missing values exist in either of the two variables for the observation.
Simple Descriptive Statistics stat

Input

int

1
Specify whether to perform simple statistics on input data including the mean, standard deviation and number of observations in the analysis for each variable.
Correlation Matrix corr

Input

int

1
Specify whether to calculate correlation matrix. Note that the method to calculate the correlation matrix depends on the mode of missing.
Eigenvalues eigenval

Input

int

1
Specify whether to output eigenvalues including the proportion and the cumulative proportion. Bartlett's Test result is shown when mtype is cov.
Eigenvectors eigenvec

Input

int

1
Specify whether to output eigenvectors for principal components specified by npc.
Scores scores

Input

int

1
Specify whether to output scores for principal components specified by npc.
Scree Plot screeplot

Input

int

1
Specify whether to show the Scree Plot for eigenvalues.
Principal Component for X Axis xcomp

Input

int

1
Specify the principal component for the X axis in component plots.
Principal Component for Y Axis ycomp

Input

int

2
Specify the principal component for the Y axis in component plots.
Loading Plot lplot

Input

int

1
Specify whether to show the Loading Plot for eigenvectors.
Score Plot splot

Input

int

0
Specify whether to show the Score Plot for scores.
Biplot biplot

Input

int

1
Specify whether to show the Biplot for eigenvectors and scores.
PCA Report rt

Output

ReportTree

<new>
Specify the sheet for the Principal Component Analysis report.
Score Data rd

Output

ReportData

<new>
Specify the sheet for scores.
Plot Data rdplot

Output

ReportData

<new>
Specify the sheet for plot data. This variable is hidden in the dialog.

Description

For more information, please refer to our User Guide.

Examples

  1. Import the data file \Samples\Graphing\US Mean Temperature.dat.
  2. Run the script.
pca irng:=4:15 mtype:=cov -r 2;

Related X-Functions

kmeans, hcluster, discrim