Datascientist
Datascientist

Reputation: 13

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

Upvotes: 0

Views: 1396

Answers (2)

drmariod
drmariod

Reputation: 11762

have a look at ?biplot.princomp...

Use biplot(prin_comp, scale = 0, choices=c(3,4)) to plot the 3rd and 4th component.

Upvotes: 1

Jil Jung Juk
Jil Jung Juk

Reputation: 700

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

Upvotes: 2

Related Questions