Search code examples
rplotpca

Limiting the PCA variables for Plotting


I am doing a PCA analysis for a dataset. I am getting 92 times the PCA on variables. I wanted to Plot it with just first two PCA coponents. PCA1 and PCA2.

Can anyone help me on this ?

Is the biplot shows only Two ? or I am little confused with the interpretations. If so, it is only for 2 component, Then how can I plot for PCA3 and PCA4.

Please find my code below.

  prin_comp <- prcomp(data_wide.pwy_idx, scale. = T)
  names(prin_comp)
  prin_comp$center
  prin_comp$scale
  prin_comp$rotation[1:5,1:92]
  biplot(prin_comp, scale = 0)

Attaching PCA components, variables and Biplot. PCA Components PCA Plot


Solution

  • Yes you are seeing only the first two Principal components notice them on the x-labels and y-labels. Suppose say you want to plot any other principal component pair you have to use the choices argument.

    biplot(prin_comp, choices = 3:4,scale = 0)  
    # to plot the third and fourth components