On 18/01/17 11:17, Neverstop . wrote:
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.
I have no idea how to help you --- sorry!!! --- but I would like to
compliment you on the clarity of your extremely well structured
question, complete with reproducible example.
My gut feeling is that there must be something wrong with the
ProDenICA() function, but such is my ignorance that this gut feeling is
not worth the paper it's written on! :-)
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
______________________________________________
R-help@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.