PCA results (fviz_pca_ind) diagram upside down, after imputation.

I have a problem with my pca. Before I perform pca I have to impute a dataset with 10 columns and 743 rows. After imputation I have to perform a clr transformation and finally pca. My imputation may be a bit tricky because from row 515 until row 562 I have NA values across all 10 columns. Now I believe that my imputation worked but in a slightly wrong way and I don't understand why. As you will see below the arrows from my analysis and the arrows from what i need to do are literaly upside down and my PC1 is slightly missing (0.1%). Below i will also provide my code. Thanks in advance.

So this is my plot.
my Plot

And this is the plot I need to create.

Also this is my code:
setwd("C:/Users/30693/Desktop/Μεταπτυχιακό 2019-2021/Διπλωματική 2019-2021/Διπλωματική 2019-2021 Λουσοί/XRF Datasets")

PHE=read_excel("C:/Users/30693/Desktop/Μεταπτυχιακό 2019-2021/Διπλωματική 2019-2021/Διπλωματική 2019-2021 Λουσοί/XRF Datasets/Seguin-etal_2020_PHE1/datasets/PHE1_XRF.xlsx")

P=imputePCA(PHE2, ncp = 2, scale = TRUE, method = c("Regularized"),
row.w = NULL, ind.sup=NULL,quanti.sup=NULL,quali.sup=NULL,
coeff.ridge = 1, threshold = 1e-06, seed = NULL, nb.init = 1,
maxiter = 1000)


PHE_pca=prcomp(PHE3,center = TRUE, scale = TRUE)

fviz_pca_ind(PHE_pca,geom = "point",
col.ind = "cos2", # Color by the quality of representation
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE # Avoid text overlapping
xlim(-4, 4) + ylim (-4, 4)

axes = c(1,2),
geom = c("arrow", "text"),
geom.var = c("arrow", "text"),
repel = TRUE,
col.var = "black",
fill.var = "white",
alpha.var = 1,
col.quanti.sup = "blue",
col.circle = "grey70",
select.var = list(name = NULL, cos2 = NULL, contrib = NULL))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.