princomp

Princomp error in R : covariance matrix is not non-negative definite

久未见 提交于 2021-02-19 02:36:18
问题 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 understand that it means there are negative eigenvalues. I looked at similar posts which suggest to use na.omit but it didn't work. I have uploaded the "biodata.Rdata" file here: covariance matrix is not non-negative definite https://www.dropbox.com

How to use princomp () function in R when covariance matrix has zero's?

放肆的年华 提交于 2020-01-01 04:36:07
问题 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 matrix. Is there a work around to proceed with PCA when covariance matrix contains zeros ? [FYI : obtaining the covariance matrix is an intermediate step within the princomp() call. Data file to reproduce this error can be downloaded from here -

Omit NA and data imputation before doing PCA analysis using R

陌路散爱 提交于 2019-12-09 20:14:36
问题 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 <- princomp(mydf, cor = TRUE, na.action=na.exclude) Error in cov.wt(z) : 'x' must contain finite values only I tried to remove the NA from the dataset, but it does not work. ndnew <- mydf[complete.cases(mydf),] A B C 1 NA NA NA 2 1.67558617743171 1.28714736288378 NA 3

Omit NA and data imputation before doing PCA analysis using R

北城余情 提交于 2019-12-04 15:57:53
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 <- princomp(mydf, cor = TRUE, na.action=na.exclude) Error in cov.wt(z) : 'x' must contain finite values only I tried to remove the NA from the dataset, but it does not work. ndnew <- mydf[complete.cases(mydf),] A B C 1 NA NA NA 2 1.67558617743171 1.28714736288378 NA 3 -1.03388645096478 9.8370942023751 10.9522215389562 4 7.10494481721949 14.7686678743866 4.06560213642725

How to use princomp () function in R when covariance matrix has zero's?

南笙酒味 提交于 2019-12-03 13:00:25
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 matrix. Is there a work around to proceed with PCA when covariance matrix contains zeros ? [FYI : obtaining the covariance matrix is an intermediate step within the princomp() call. Data file to reproduce this error can be downloaded from here - http://tinyurl.com/6rtxrc3] The first strategy might be to decrease the tolerance argument. Looks to me

Matlab: how to find which variables from dataset could be discarded using PCA in matlab?

蓝咒 提交于 2019-12-01 04:23:03
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] = princomp(zscore(x)) I know that eigenvalues tell me how much variation of the dataset covers every principal component, and that coeff tells me how much of i-th original variable is in the j-th principal component (where i - rows, j - columns). So I assumed that to find out which variables out of the original dataset are the most important and which are the least

Matlab: how to find which variables from dataset could be discarded using PCA in matlab?

寵の児 提交于 2019-12-01 01:43:06
问题 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] = princomp(zscore(x)) I know that eigenvalues tell me how much variation of the dataset covers every principal component, and that coeff tells me how much of i-th original variable is in the j-th principal component (where i - rows, j - columns). So I assumed that

Principal Components Analysis - how to get the contribution (%) of each parameter to a Prin.Comp.?

耗尽温柔 提交于 2019-11-28 03:12:41
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 five parameters the plot of the PC1 vs. PC2 shows an interesting pattern Question: How do I get the percentage of contribution (of each parameter) to each PC? What I expect: PC1 is composed to 30% of parameter1, to 50% of parameter2, to 20% of parameter3, 0% of parameter4 and 0% of parameter5. PC2 is composed... An example with 5 dummy-parameters: a <-

Principal Components Analysis - how to get the contribution (%) of each parameter to a Prin.Comp.?

为君一笑 提交于 2019-11-27 05:05:31
问题 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 five parameters the plot of the PC1 vs. PC2 shows an interesting pattern Question: How do I get the percentage of contribution (of each parameter) to each PC? What I expect: PC1 is composed to 30% of parameter1, to 50% of parameter2, to 20% of