[Rd] loadings function (PR#13886)

Steven McKinney smckinney at bccrc.ca
Tue Aug 11 21:56:57 CEST 2009


Hi Mike,

Please don't file bug reports without first posing such
questions on R-help or R-devel first, asking if such behaviour
really is a bug.  (This generates extra work for the volunteers
who maintain R).

In this case, it's your misunderstanding of the information
about three different functions on the "loadings" help
page.  The loadings() function is shown with one argument
"x" only.  The other parameters described are for the
print methods also discussed on the loadings() help page.

Looking at the factanal example:

> # A little demonstration, v2 is just v1 with noise,
> # and same for v4 vs. v3 and v6 vs. v5
> # Last four cases are there to add noise
> # and introduce a positive manifold (g factor)
> v1 <- c(1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,4,5,6)
> v2 <- c(1,2,1,1,1,1,2,1,2,1,3,4,3,3,3,4,6,5)
> v3 <- c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6)
> v4 <- c(3,3,4,3,3,1,1,2,1,1,1,1,2,1,1,5,6,4)
> v5 <- c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5)
> v6 <- c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4)
> m1 <- cbind(v1,v2,v3,v4,v5,v6)
> 
> 
> fa <- factanal(m1, factors=3) # varimax is the default
> fa

Call:
factanal(x = m1, factors = 3)

Uniquenesses:
   v1    v2    v3    v4    v5    v6 
0.005 0.101 0.005 0.224 0.084 0.005 

Loadings:
   Factor1 Factor2 Factor3
v1 0.944   0.182   0.267  
v2 0.905   0.235   0.159  
v3 0.236   0.210   0.946  
v4 0.180   0.242   0.828  
v5 0.242   0.881   0.286  
v6 0.193   0.959   0.196  

               Factor1 Factor2 Factor3
SS loadings      1.893   1.886   1.797
Proportion Var   0.316   0.314   0.300
Cumulative Var   0.316   0.630   0.929

The degrees of freedom for the model is 0 and the fit was 0.4755 

### Now extract just the loadings
> loadings(fa)

Loadings:
   Factor1 Factor2 Factor3
v1 0.944   0.182   0.267  
v2 0.905   0.235   0.159  
v3 0.236   0.210   0.946  
v4 0.180   0.242   0.828  
v5 0.242   0.881   0.286  
v6 0.193   0.959   0.196  

               Factor1 Factor2 Factor3
SS loadings      1.893   1.886   1.797
Proportion Var   0.316   0.314   0.300
Cumulative Var   0.316   0.630   0.929

### Now attempt
> loadings(fa, digits = 5)
Error in loadings(fa, digits = 5) : unused argument(s) (digits = 5)

### loadings() takes only one argument.

### The digits and other arguments are for the print methods, e.g.

> print(fa, digits = 5)

Call:
factanal(x = m1, factors = 3)

Uniquenesses:
     v1      v2      v3      v4      v5      v6 
0.00500 0.10090 0.00500 0.22405 0.08429 0.00500 

Loadings:
   Factor1 Factor2 Factor3
v1 0.94384 0.18193 0.26661
v2 0.90472 0.23484 0.15948
v3 0.23564 0.20960 0.94634
v4 0.17998 0.24225 0.82757
v5 0.24211 0.88064 0.28560
v6 0.19277 0.95884 0.19621

               Factor1 Factor2 Factor3
SS loadings    1.89304 1.88576 1.79702
Proportion Var 0.31551 0.31429 0.29950
Cumulative Var 0.31551 0.62980 0.92930

The degrees of freedom for the model is 0 and the fit was 0.4755 

> print(loadings(fa), digits = 5)

Loadings:
   Factor1 Factor2 Factor3
v1 0.94384 0.18193 0.26661
v2 0.90472 0.23484 0.15948
v3 0.23564 0.20960 0.94634
v4 0.17998 0.24225 0.82757
v5 0.24211 0.88064 0.28560
v6 0.19277 0.95884 0.19621

               Factor1 Factor2 Factor3
SS loadings    1.89304 1.88576 1.79702
Proportion Var 0.31551 0.31429 0.29950
Cumulative Var 0.31551 0.62980 0.92930
> 

Best

Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

email: smckinney +at+ bccrc +dot+ ca

tel: 604-675-8000 x7561

BCCRC
Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C.
V5Z 1L3
Canada

________________________________________
From: r-devel-bounces at r-project.org [r-devel-bounces at r-project.org] On Behalf Of mikedulrich at gmail.com [mikedulrich at gmail.com]
Sent: August 11, 2009 9:15 AM
To: r-devel at stat.math.ethz.ch
Cc: R-bugs at r-project.org
Subject: [Rd] loadings function (PR#13886)

Full_Name: Mike Ulrich
Version: 2.9
OS: Mac OSX
Submission from: (NULL) (69.169.178.34)


The help documentation for loadings() lists more then one parameter. The
function call only expects one parameter. The digits, cutoff, and sort
parameters are not used in the function.

## S3 method for class 'loadings':
print(x, digits = 3, cutoff = 0.1, sort = FALSE, ...)

## S3 method for class 'factanal':
print(x, digits = 3, ...)


> loadings
function (x)
x$loadings
<environment: namespace:stats>

______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list