welcome to this Excel stat short video on principal component analysis or PCA principal component analysis is a descriptive or exploratory method it has three objectives the first one is to reduce the original variables into a lower number of orthogonal non-correlated variables or factors we also call them ion vectors then we can look into the variable relationship and look at the correlation among the original variables and also between the variables and the factors then we can look at the grouping of samples and visual proximities among statistical units but PCA is only a change of variable space
and we change the space to look at the data differently and the way we look at it counts so here if I ask you if this person is sad or happy you may say Sad But if you look at it in a different way you may say happy so here we have a data Matrix X with n samples and P variables if we look at the samples we can visualize them in a space of P variables and end points we can do the same but looking at the variables and visualize them in a space of
and samples so let's go back to geometry and look into the projection of a point on an axis so here we have a 3D space and we have a cloud of points and if we want to select a new Vector for for example that one the vector U and you have the coordinate of the vector U and we can get the normalized vector so then we can project any point on this Vector so here we have P high and we project it here on the axis so it's octogonal here so when we do this projection
P High add uh three coordinates here three two and five for each variable and then we can get the coordinate of Pi on the vector its projection so here we will get 5.65 so from a dimension of three coordinates we only get one coordinate when we do the projection so we have reduced the dimension it's exactly what we do in PC so we look for the axis to use to project the samples but we don't take any of them we just take the one that minimizes the loss of information or variability for the cloud of
points so doing that mean that we are trying to get this distance the point to its projection as small as possible so that's this equation we can also do it and say that we try to maximize Dimension from the origin to the projection so if you maximize that in the same way we are trying to get the most of the variability with our Vector but PCA is an iterative process so we just don't need one factor we may need more so when we have one factor we are going to look for another one that will
explain the variability that is remaining there is one constraint uh we need to have factors that are orthogonal so here we have a factor one and we can project all the sample on that factor and then we can rotate the axis so we rotate and we will find plan that is orthogonal and what we see in that plan is the remaining variability that was not explained so if we take the purple Vector it will also reach the maximum of variability and that is our Factor two then we can project the sample on that vector and
then there will be still some remaining variabilities that we can try to explain now if we go back to geometry and try to explain the projection of variables so here we have two variable X and Y and we have three samples if we look at the two variable X and Y in the space of the samples uh there are two things that are important to Define them there is the vector length and the vector lengths represents the variability of the variable if you are using centered variables we can call it the deviance also the angle
between the two Vector X and Y expresses the correlation between the variable so for standardized variable it is the coefficient r so if we go back to PCA we have the Matrix X and then we change the variable space into factors so then we can look at the samples in a new variable space that is defined by the factor so here we have Factor one and Factor two which is the first principal plane and then we can look at the correlation between the variable and the factors so the principal components of factors they are orthogonal
and corelated and they also a linear combination of the standardized variable X so the original variable here we can take an example so we are going to take the example of cars from 1989 and we have 24 samples or 24 different cars and we have six descriptive variables such as engine displacement power speed weight length weight the first thing to do is to get the PCA menu which is in analyzing data menu so you click on the principal component analysis PCA option and then you will have to select the variable so we'll take all the
samples and all the variables and we have to say which data format we are using so here uh we are using the observations so we will need to make a Waiting by default we have the P which is the correlation and that the one that is interesting us so we will leave the default option here then we can keep the sheet for having the result display in a new sheet and then we have to say if we have the variable levels so here the variable labels are here and we are using them so we leave
that ticked and then for the observation labels we can select this column with the car there are no weights so we don't need to do anything here and we can go to the next tab here we have some options um here I will ask to compute for the maximum number of factor and I will not select any rotation because I don't need that right now uh there are no additional data so we don't need to add them we don't have any missing data so here we can leave it to do not accept missing data and
then we have the outputs so we will ask for almost all the test and the output that we can get same thing for the charts we can leave the default option and we'll get a lot of results so then I click on okay it's going to compute the result here continue here I can select which um scores I want to see so I'm going to select Factor one and Factor two and maybe as well Factor two and factor three so I select here even though Factor two and three might not bring much information but just
to see so I click on done and they are going to be displayed here I get a menu if I want to go directly to one of the result I can just navigate here and go directly to it but I will just get them one after the other so the first one is summary statistics so it just give you uh for each variable some statistics the number ofation the number of missing value minimum maximum mean and standard deviation then we have the correlation Matrix so already here we can see that a lot of the variable
are correlated uh you can see that the power and the unine displacement are quite correlated with a correlation of 0.86 same for the speed and power they are very correlated weight and engine displacement are quite correlated too so as you see we are going to deal with the data set with a lot of correlation then we have the Aon values so we get the igon value and the variability and then the cumulative uh variability so Factor one has an ion value of 4.6 here the sum of the IG value is supposed to be the number
of variable that we have in the data set so here I can just show you if I do the sum of this line I should get six because that's a number of variable so here when we have such a big ion value it mean that factor one is explaining a lot of variability and as you see it's 77% of variability that is explained in Factor one and Factor 2 is 15% and then factor three decrease to only 4% so we can look at it in the scrip blot where we have both the igon value where
you can see o o drop and you can see that uh we have here a big drop and then another drop and then it's quite flat and same thing for the cumulative variability we quite reach uh 100% of viability very fast so here we might just need two component to explain this data set then we have the vector so that's all are um computed so that the coefficient for engine displacement for Factor one so as you see here all of the variables have a positive contribution to factor one then on Factor two there is some
differences so we have the three first one that are positive and then the three last one that have negative contribution so we can see that this the size which is most of those variable is negative on Factor one and here it's positive for the power I will say for the technicity of the car it's positive contribution factor to then we can have the correlation between the variable and factors so same thing it's the same interpretation so uh you can see here we have uh speed power and engine displacement on this side and E right weight
and length well in the end we don't need a factor two and factor three so we don't need to analyze that we can continue or here we have uh the scores but it's easier to see it on the score plot so is the plot that is interesting us so I'm just going to copy it and put it bigger here so so we can see all the samples are positioned uh differently so if you remember on that side we had the size of the car that was quite big so here all those car are quite big
but those one are quite small then we had the power of the car that was on Factor 2 positive so all those cars here are quite powerful but those one well they are not so you can see different type of car and they are grouped with their characteristics so if I go back to the PC sheet uh we can also have a By plot where you can have both the variable and the samples together then you have the contribution of the observations Square coins of the observations and that's all we have