Questions tagged [princomp]
26 questions
30
votes
1 answer
Principal Components Analysis - how to get the contribution (%) of each parameter to a Prin.Comp.?
I want to know to what degree a measurement/parameter contributes to one of the calculated principal components.
A real-world description:
i've got five climatic parameters to the geographic distribution of a species
i performed a PCA with these…

Chrugel
- 883
- 2
- 11
- 19
19
votes
2 answers
How to get "proportion of variance" vector from princomp in R
This should be very basic and I hope someone can help me. I ran a principal component analysis with the following call:
pca <- princomp(....)
summary(pca)
Summary pca returns this description:
PC1 PC2 PC3
Standard…

Neeraj Bhatnagar
- 341
- 1
- 2
- 6
10
votes
1 answer
How to use princomp () function in R when covariance matrix has zero's?
While using princomp() function in R, the following error is encountered : "covariance matrix is not non-negative definite".
I think, this is due to some values being zero (actually close to zero, but becomes zero during rounding) in the covariance…

384X21
- 6,553
- 3
- 17
- 17
7
votes
1 answer
Matlab: how to find which variables from dataset could be discarded using PCA in matlab?
I am using PCA to find out which variables in my dataset are redundand due to being highly correlated with other variables. I am using princomp matlab function on the data previously normalized using zscore:
[coeff, PC, eigenvalues] =…

agnieszka
- 14,897
- 30
- 95
- 113
6
votes
1 answer
Constructing scores from princomp loadings in R
I would like to be able to construct the scores of a principal component analysis using its loadings, but I cannot figure out what the princomp function is actually doing when it computes the scores of a dataset. A toy example:
cc <-…

Escotch
- 131
- 1
- 7
5
votes
1 answer
How to conduct PCA on each group for a dataset with multiple groups?
I have a dataset of individuals from four populations, four treatments and three replicates. Each individual is in only one population, treatment and replicate combination. I have taken four measurements from each individual. I would like to conduct…

Keith W. Larson
- 1,543
- 2
- 19
- 34
5
votes
1 answer
Principal component analysis
I have to write a classificator (gaussian mixture model) that I use for human action recognition.
I have 4 dataset of video. I choose 3 of them as training set and 1 of them as testing set.
Before I apply the gm model on the training set I run the…

Mario Lepore
- 307
- 2
- 8
- 18
4
votes
1 answer
Princomp error in R : covariance matrix is not non-negative definite
I have this script which does a simple PCA analysis on number of variables and at the end attaches two coordinates and two other columns(presence, NZ_Field) to the output file. I have done this many times before but now its giving me this error:
I…

Hank
- 51
- 1
- 4
3
votes
1 answer
ggbiplot - change the colour of labels
By default, the ggbiplot function gives a graph with loadings as red arrows and unit labels in black:
library(ggbiplot)
data("USArrests")
us <- princomp(USArrests)
ggbiplot(us, labels = rownames(us$scores))
is the result of that code
How can I…

KermittDuss
- 45
- 7
3
votes
3 answers
Omit NA and data imputation before doing PCA analysis using R
I am trying to do PCA analysis using princomp function in R.
The following is the example code:
mydf <- data.frame (
A = c("NA", rnorm(10, 4, 5)),
B = c("NA", rnorm(9, 4, 5), "NA"),
C = c("NA", "NA", rnorm(8, 4, 5), "NA")
)
out <-…

jon
- 11,186
- 19
- 80
- 132
3
votes
3 answers
R - Limit output of summary.princomp
I'm running a principal component analysis on a dataset with more than 1000 variables. I'm using R Studio and when I run the summary to see the cumulative variance of the components, I can only see the last few hundred components. How do I limit…

user1209675
- 296
- 7
- 18
2
votes
1 answer
PCA in R long form
I would like to do PCA on a dataframe that is in long form:
time1 id1 data11
time1 id2 data12
time2 id1 data21
etc.
Is there an easy way to do this or is the standard way to reshape it and then do princomp. My dataset is pretty large with roughly…

Alex
- 19,533
- 37
- 126
- 195
2
votes
1 answer
Plotting princomp loadings with ggplot
I'm trying to carry out a PCA Analysis on my dataset, and I can plot the loadings out on the basic plot function. But I want to do them on ggplot, but I keep getting this error, "ggplot2 doesn't know how to deal with data of class loadings".
I'm…

Ar1229
- 131
- 2
- 9
2
votes
1 answer
how to use princomp() or prcomp() functions in R with large datasets, without trasposing the data?
I have just started knowing PCA and i wish to use it for a huge microarray dataset with more than 4,00,000 rows. I have my columns in the form of samples, and rows in the form of genes/locus. I did go through some tutorials on using PCA and came…

Letin
- 1,255
- 5
- 20
- 36
1
vote
1 answer
Unexpected na error in R
(Happy Easter)
I have been trying to work out a PDDP algorithm in R, and I keep running into a single, small error while using the princomp function. Here is the error statement:
Error in cov.wt(z) : 'x' must contain finite values only
From some…

Nathan
- 194
- 1
- 17