> For the complete documentation index, see [llms.txt](https://hwasumok.gitbook.io/r-flow/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hwasumok.gitbook.io/r-flow/r/machine-learning/demension-reduction.md).

# Dimension Reduction

Linear Discriminant Analysis, Principal Component Analysis

## Linear Discriminant Analysis

### Input Data

| Variables       | Inputs                                                                                                                     |
| --------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **Target Data** | Data input                                                                                                                 |
| **Model Name**  | Name of the model (fill it out at your discretion)                                                                         |
| **Merge Data**  | Analysis output will be merged to the selected data                                                                        |
| **Output Name** | Name of the analysis output (fill it out at your discretion)                                                               |
| **X**           | <p>User-selected columns to be X</p><ul><li>two or more columns should be selected</li></ul>                               |
| **Y(group)**    | <p>User-selected columns to be Y</p><ul><li><strong>Only</strong> <strong>one</strong> column should be selected</li></ul> |

![\[Task Information of Linear Discriminant Analysis\]](https://3929524962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGaxNdSdRN_L_WNiX4I%2F-MKzn-4zu0g19EbnhDBy%2F-ML1Y6JtWSEDBHOseZmT%2Fimage.png?alt=media\&token=3a6115aa-7204-42f2-9369-093a7e874cc3)

## Principal Component Analysis

### Input Data

| Variables       | Inputs                                                                                                                |
| --------------- | --------------------------------------------------------------------------------------------------------------------- |
| **Target Data** | Data input                                                                                                            |
| **Model Name**  | Name of the model (fill it out at your discretion)                                                                    |
| **Merge Data**  | Analysis output will be merged to the selected data                                                                   |
| **Output Name** | Name of the analysis output (fill it out at your discretion)                                                          |
| **X**           | <p>User-selected <strong>numeric</strong> columns to be X</p><ul><li>at least one column should be selected</li></ul> |

![\[Task Information of Principal Component Analysis\]](https://3929524962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGaxNdSdRN_L_WNiX4I%2F-MKzn-4zu0g19EbnhDBy%2F-ML1_fdP8xH1e854fhLr%2Fimage.png?alt=media\&token=8834236e-8d47-4b95-92ca-aa5489134e0e)

## Workflow Example

[R-Flow Task Example Video: Linear Discriminant Analysis](https://www.youtube.com/watch?v=ZhAHAIeQHDY)

![\[Workflow Example of Linear Discriminant Analysis\] ](https://3929524962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGaxNdSdRN_L_WNiX4I%2F-MLWW_4m8BTb3en3jtSt%2F-MLWYQyFp5c4iBgVknH6%2Fimage.png?alt=media\&token=16b18f92-9a2e-4878-975d-e14ef3936369)

## R Package

**LinearDiscriminantAnalysis:** [**https://www.rdocumentation.org/packages/MASS/versions/7.3-53/topics/lda**](https://www.rdocumentation.org/packages/MASS/versions/7.3-53/topics/lda)

**Principal Component Analysis:** [**https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/prcomp**](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/prcomp)
