My goal is to do a non-negative PCA using nsprcopm()
(version 0.5.1.2 ) on my data and extract the values of PCs. I do it as follows in R version 3.5.0:
nnpca <- nsprcomp(mydata[,10:16], center = T, scale. = T, nneg = T)
The key is that I need to enforce non-negativity (because in the next step I will be using glm(..., family = Gamma())
, and glm
does not accept negative values with Gamma)
The problem is that nsprcopm()
produces negative values for PCs. Here is a snapshot of the nnpca$x
:
Any idea??! Is this is a bug for nsprcomp()
or what? Am I missing something?!