[R] Dimensionality reduction with proDenICA
Neverstop .
neverstop at hotmail.it
Tue Jan 17 23:17:05 CET 2017
Hello,
I have a dataset with many variables and I'd like to do dimensionality
reduction with Independent Component Analysis. There are many
statistical methods to estimate the latent variables of the ICA model.
I'm trying the R package "proDenICA" that implements the penalized
maximum likelihood method proposed by Hastie, Tibshirani and Friedman in
Section 14.7.4 of the book "Elements of Statistical Learning". The
documentation of the proDenICA function says that the argument "k" is
the "Number of components required, less than or equal to the number of
columns of x". If I choose a value of k less than the number of colomns
of x, I get an error message. It seems to me that I'm not using the
function proDenICA() as it is meant to be used. Am I missing something?
I've reproduced the problem with a smaller dataset here:
> library(MASS)
> data(crabs)
> str(crabs)
'data.frame': 200 obs. of 8 variables:
$ sp : Factor w/ 2 levels "B","O": 1 1 1 1 1 1 1 1 1 1 ...
$ sex : Factor w/ 2 levels "F","M": 2 2 2 2 2 2 2 2 2 2 ...
$ index: int 1 2 3 4 5 6 7 8 9 10 ...
$ FL : num 8.1 8.8 9.2 9.6 9.8 10.8 11.1 11.6 11.8 11.8 ...
$ RW : num 6.7 7.7 7.8 7.9 8 9 9.9 9.1 9.6 10.5 ...
$ CL : num 16.1 18.1 19 20.1 20.3 23 23.8 24.5 24.2 25.2 ...
$ CW : num 19 20.8 22.4 23.1 23 26.5 27.1 28.4 27.8 29.3 ...
$ BD : num 7 7.4 7.7 8.2 8.2 9.8 9.8 10.4 9.7 10.3 ...
> X=crabs[,4:8]
> X=as.matrix(X)
> library(ProDenICA)
> out.proDen = ProDenICA(X, k = 2, whiten = TRUE, maxit = 20, trace=T)
Error in solve.default(V, W) : 'a' (5 x 2) must be square
I get the error with k = 1,2,3,4. The function works with k=5.
Thank you.
More information about the R-help
mailing list