14

I am using fastICA package in r. In this package, I am using fastICA function, which have some parameters. If I set n.comp to 2, that works fine, but if I set this parameter to 3 or more in this function:

 ica<-fastICA(datalist,n.comp=3)

datalist is here a matrix with 20 rows and 4 columns:

     [,1]    [,2]     [,3]   [,4]
 [1,] 567.00 324.225 281.0889 538.25
 [2,] 557.75 317.500 269.5556 529.15
 [3,] 543.75 309.900 264.5778 515.95
 [4,] 557.00 316.225 265.0889 528.25
 [5,] 538.25 307.750 266.6667 510.95
 [6,] 531.25 301.025 250.0222 503.70
 [7,] 545.00 311.800 270.9333 517.40
 [8,] 550.00 316.925 284.3778 522.65
 [9,] 514.75 290.300 235.6000 487.75
[10,] 518.00 293.800 245.1556 491.20
[11,] 553.75 318.125 281.6667 526.00
[12,] 563.50 325.925 297.2667 535.75
[13,] 540.00 303.300 241.1556 511.40
[14,] 546.00 310.350 261.6444 517.90
[15,] 567.25 324.425 281.4889 538.50
[16,] 577.75 330.125 285.2222 548.40
[17,] 560.75 317.425 262.3778 531.60
[18,] 570.00 323.925 272.8222 540.65
[19,] 569.00 324.700 278.8444 540.00
[20,] 565.50 324.150 284.1333 537.00

I am getting this error:

Error in solve.default(w %*% t(w)) : 
  system is computationally singular: reciprocal condition number = 1.16873e-16

could you please say me why I am getting this error and how can I solve it?

Kaja
  • 2,962
  • 18
  • 63
  • 99
  • 1
    Probably there aren't 3 independent components in your data. May I recommend studying http://www.ee.columbia.edu/~dpwe/e6820/papers/HyvO00-icatut.pdf and http://sccn.ucsd.edu/~arno/indexica.html ? – Carl Witthoft Jan 30 '14 at 12:30
  • 3
    system is computationally singular -> It means your design matrix is not invertible –  Oct 31 '14 at 11:58

1 Answers1

17

In solve(), use a smaller tolerance, like solve(..., tol = 1e-17). This should be fine since you get reciprocal condition number = 1.16873e-16. More info in the help file and this related question.

Community
  • 1
  • 1
Konstantinos
  • 4,096
  • 3
  • 19
  • 28
  • 2
    .@pidosaurus - What if the `reciprocal condition number` keeps changing based on the large input data set? I face this issue while using `mahalanobis()` in `R`, as it also calls `solve()` for calculating distance. I have asked as comment in the question you referenced. Just thought, you may have different take on this. – Chetan Arvind Patil Jul 25 '17 at 22:00
  • @ChetanArvindPatil it had never really been a problem for me. There might be the case of linearly dependent columns or columns changing drastically order of magnitude (from day 200 to 0.002). Perhaps you could try to delve into computational inversion like 'svd()'. If the matrix is singular, it can't be inverted. – Konstantinos Aug 02 '17 at 23:19