[R] Question about package "principal"

David Winsemius dwinsemius at comcast.net
Sun Jan 11 20:59:24 CET 2015


On Jan 11, 2015, at 3:55 AM, 오건희 wrote:

> Hi,
> 
> I tried to run "principal" function in the 'psych' package, but it failed
> to do..
> 
> here is both my code and error message.
> 
> I searched on the web, but couldn't find the exact answer I wanted.
> 
>> data<-read.csv("
> https://raw.githubusercontent.com/mylesmharrison/delta_PCA_kmeans/master/delta.csv
> ",row.names=1)
> 
>> airpca<-principal(data,nfactors=33,rotate="none")
> Error in solve.default(model, r) :
>  system is computationally singular: reciprocal condition number =
> 7.05776e-17
> In addition: Warning messages:
> 1: In cor.smooth(model) :
>  Matrix was not positive definite, smoothing was done
> 2: In cor.smooth(r) : Matrix was not positive definite, smoothing was done

Looks like your data is highly correlated in some of those columns:

> dat[[1]]
 [1]  0.0 19.4  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
[25]  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
> dat[[29]]
 [1] 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> dat[[2]]
 [1]  0 44  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
[42]  0  0  0
> dat[[3]]
 [1]  0 12  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
[42]  0  0  0

I'd retry after removing the problem columns.

> 
> Thank you for your help.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list