[R] Error in principal component loadings calculation

Marcelo Kittlein kittlein at mdp.edu.ar
Mon Sep 14 15:46:29 CEST 2015


Hi all

I have been using "princomp" to obtain the principal components of some 
data and find that the loadings returned by the function appear to have 
some error.

in a simple example if a calculate de pc for a random matrix I get that 
all loadings for the different components have the same proportion of 
variance

data <- matrix(runif(100), 20, 5)
pc <- princomp(data, cor=TRUE)
loadings(pc)

Loadings:
      Comp.1 Comp.2 Comp.3 Comp.4 Comp.5
[1,] -0.280  0.510  0.674 -0.217 -0.400
[2,]  0.529 -0.353        -0.694 -0.330
[3,] -0.111  0.563 -0.713 -0.336 -0.222
[4,] -0.530 -0.502 -0.178  0.140 -0.645
[5,] -0.590 -0.215        -0.582  0.516

                Comp.1 Comp.2 Comp.3 Comp.4 Comp.5
SS loadings       1.0    1.0    1.0    1.0    1.0
Proportion Var    0.2    0.2    0.2    0.2    0.2
Cumulative Var    0.2    0.4    0.6    0.8    1.0

This keep returning the same proportion of variance for each component 
regardless of the data used.

my R version is

 > R.Version()
$platform
[1] "x86_64-unknown-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "3"

$minor
[1] "2.1"

$year
[1] "2015"

$month
[1] "06"

$day
[1] "18"

$`svn rev`
[1] "68531"

$language
[1] "R"

$version.string
[1] "R version 3.2.1 (2015-06-18)"

$nickname
[1] "World-Famous Astronaut"

some hint would be much appreciated.

Best regards

Marcelo Kittlein

	[[alternative HTML version deleted]]



More information about the R-help mailing list