---
title: "PrincipalComponents"
language: "en"
type: "Symbol"
summary: "As of Version 8, PrincipalComponents is part of the built-in Wolfram Language kernel."
keywords: 
- principal components
- principal component analysis
- pca
canonical_url: "https://reference.wolfram.com/language/MultivariateStatistics/ref/PrincipalComponents.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Multivariate Statistics Package"
    link: "https://reference.wolfram.com/language/MultivariateStatistics/guide/MultivariateStatisticsPackage.en.md"
related_functions: 
  - 
    title: "Eigenvectors"
    link: "https://reference.wolfram.com/language/ref/Eigenvectors.en.md"
related_tutorials: 
  - 
    title: "Multivariate Statistics Package"
    link: "https://reference.wolfram.com/language/MultivariateStatistics/tutorial/MultivariateStatistics.en.md"
---
## MultivariateStatistics\`

# PrincipalComponents

⚠ As of Version 8, ``PrincipalComponents`` is part of the built-in Wolfram Language kernel.

PrincipalComponents[matrix] transforms elements of matrix into principal components.

## Details and Options

* To use ``PrincipalComponents``, you first need to load the [Multivariate Statistics Package](https://reference.wolfram.com/language/MultivariateStatistics/guide/MultivariateStatisticsPackage.en.md) using ``Needs["MultivariateStatistics`"]``.

* ``PrincipalComponents`` gives the principal component transform of ``matrix``.

* The principal components of ``matrix`` are linear transformations of the original columns into uncorrelated columns arranged in order of decreasing variance.

* The dimensions of ``PrincipalComponents[matrix]`` are the same as the dimensions of ``matrix``.

* The following options can be given:

|                   |                  |                                             |
| ----------------- | ---------------- | ------------------------------------------- |
| Method            | Covariance       | scaling method for decomposition            |
| WorkingPrecision  | MachinePrecision | the precision used in internal computations |

* Possible values of ``Method`` are ``Covariance`` and ``Correlation``.

---

## Examples (3)

### Basic Examples (1)

```wl
In[1]:= Needs["MultivariateStatistics`"]
```

Principal components for bivariate data:

```wl
In[2]:= PrincipalComponents[{{1, 2}, {2, 3}, {4, 10}}]

Out[2]= {{-3.27053, -0.285293}, {-1.99969, 0.335165}, {5.27023, -0.0498715}}
```

### Options (2)

#### Method (1)

```wl
In[1]:= Needs["MultivariateStatistics`"]
```

Principal components using correlation scaling:

```wl
In[2]:= PrincipalComponents[{{1, 2}, {2, 3}, {4, 10}}, Method -> Correlation]

Out[2]= {{-1.10388, 0.130549}, {-0.478746, -0.170139}, {1.58262, 0.0395904}}
```

#### WorkingPrecision (1)

```wl
In[1]:= Needs["MultivariateStatistics`"]
```

Precision-20 principal components:

```wl
In[2]:= PrincipalComponents[{{1, 2}, {2, 3}, {4, 10}}, WorkingPrecision -> 20]

Out[2]= {{-3.270532911019544549, -0.285293280179890804}, {-1.999693897338473669, 0.335164777472778367}, {5.270226808358018218, -0.049871497292887563}}
```

## See Also

* [`Eigenvectors`](https://reference.wolfram.com/language/ref/Eigenvectors.en.md)

## Tech Notes

* [Multivariate Statistics Package](https://reference.wolfram.com/language/MultivariateStatistics/tutorial/MultivariateStatistics.en.md)

## Related Guides

* [Multivariate Statistics Package](https://reference.wolfram.com/language/MultivariateStatistics/guide/MultivariateStatisticsPackage.en.md)