Filtering observations and variables in principal component analysis charts

Dataset for running a Principal Component Analysis

An Excel sheet containing both the data and the results for use in this tutorial can be downloaded by clicking here.

The data are from the US Census Bureau and describe the changes in the population of 51 states between 2000 and 2001. The initial dataset has been transformed to rates per 1000 inhabitants, with the data for 2001 serving as the focus for the analysis.

Goal of this tutorial

Our goal is to analyze the correlations between the variables and to find out if the changes in population in some states are very different from the ones in other states. A general tutorial on how to run a principal component analysis with XLSTAT is available here.

We focus on the charts displayed in a PCA. XLSTAT offers an option to filter the displayed observations and variables with respect to the squared cosines (cos²). This measure is a measure of the quality of the representation of the observation in the obtained maps.

Setting up a Principal Component Analysis

Once XLSTAT-Pro is activated, select the XLSTAT / Analyzing data / Principal components analysis command, or click on the corresponding button of the Analyzing Data toolbar (see below).

Principal Component AnalysisPrincipal Component Analysis software

The Principal Component Analysis dialog box will appear.

Select the data on the Excel sheet. The Data format chosen is Observations/variables because of the format of the input data.

The PCA type that will be used during the computations is the Pearson's correlation matrix, which corresponds to the classical correlation coefficient.

dialog box general pca

In the Charts tab, we wish to filter observations and variables with a squared cosines sum greater than 0.5. To do so, activate the filter option and select >cos² and enter the value 0.5.

dialog box charts pca

dialog box charts pca

dialog box biplots pca

The computations begin once you have clicked on OK. You are asked to confirm the number of rows and columns.

Then you should confirm the axes for which you want to display plots. In this example, the percentage of variability represented by the first two factors is not very high (67.72%); to avoid a misinterpretation of the results, we have decided to complement the results with a second chart on axes 1 and 3.

Principal Component Analysis menu PC1 and PC2’’’’Principal Component Analysis

Filtered charts for Principal Component Analysis

All the classical results are displayed. For a detailed tutorial on the interpretation of these results, see here.

We are interested in the squared cosines tables and the PCA charts.

Regarding the variables, we can see that two variables have squared cosines smaller than 0.5 for the 2 first factors (Federal/Civilian mode... / Net Int Migration). These variables are badly represented by the PCA. They will not appear in the PCA correlation chart.

 squared cosines table

The obtained PCA correlation plot is as follows.

squared cosines chart

 Regarding the observations, we can see that some states are badly represented.

squared cosines table

For example, District of Columbia and Hawaii will not appear in the observation chart since they have a squared cosine smaller than 0.5 for the two first factors.

squared cosines plot

This simple tool allows you to filter observations on the PCA charts to have more readable charts.

Click here for other tutorials.

About KCS

Kovach Computing Services (KCS) was founded in 1993 by Dr. Warren Kovach. The company specializes in the development and marketing of inexpensive and easy-to-use statistical software for scientists, as well as in data analysis consulting.

Mailing list Join our mailing list

Home | Order | MVSP | Oriana | XLStat
QDA Miner | Accent Composer | Stats Books
Stats Links | Anglesey


Like us on Facebook Facebook

Get in Touch

  • Email:
  • Address:
    85 Nant y Felin
    Pentraeth, Isle of Anglesey
    LL75 8UY
    United Kingdom
  • Phone:
    (UK): 01248-450414
    (Intl.): +44-1248-450414