Skip to contents

Extract the rotation matrix from dimRedResult objects derived from PCA and FastICA

Usage

getRotationMatrix(x)

Arguments

x

of type dimRedResult

Value

a matrix

Details

The data has to be pre-processed the same way as the method does, e.g. centering and/or scaling.

Examples

dat <- loadDataSet("Iris")

pca <- embed(dat, "PCA")
rot_pca <- getRotationMatrix(pca)
scale(getData(dat), TRUE, FALSE) %*% rot_pca - getData(getDimRedData(pca))
#>        PC1 PC2
#>   [1,]   0   0
#>   [2,]   0   0
#>   [3,]   0   0
#>   [4,]   0   0
#>   [5,]   0   0
#>   [6,]   0   0
#>   [7,]   0   0
#>   [8,]   0   0
#>   [9,]   0   0
#>  [10,]   0   0
#>  [11,]   0   0
#>  [12,]   0   0
#>  [13,]   0   0
#>  [14,]   0   0
#>  [15,]   0   0
#>  [16,]   0   0
#>  [17,]   0   0
#>  [18,]   0   0
#>  [19,]   0   0
#>  [20,]   0   0
#>  [21,]   0   0
#>  [22,]   0   0
#>  [23,]   0   0
#>  [24,]   0   0
#>  [25,]   0   0
#>  [26,]   0   0
#>  [27,]   0   0
#>  [28,]   0   0
#>  [29,]   0   0
#>  [30,]   0   0
#>  [31,]   0   0
#>  [32,]   0   0
#>  [33,]   0   0
#>  [34,]   0   0
#>  [35,]   0   0
#>  [36,]   0   0
#>  [37,]   0   0
#>  [38,]   0   0
#>  [39,]   0   0
#>  [40,]   0   0
#>  [41,]   0   0
#>  [42,]   0   0
#>  [43,]   0   0
#>  [44,]   0   0
#>  [45,]   0   0
#>  [46,]   0   0
#>  [47,]   0   0
#>  [48,]   0   0
#>  [49,]   0   0
#>  [50,]   0   0
#>  [51,]   0   0
#>  [52,]   0   0
#>  [53,]   0   0
#>  [54,]   0   0
#>  [55,]   0   0
#>  [56,]   0   0
#>  [57,]   0   0
#>  [58,]   0   0
#>  [59,]   0   0
#>  [60,]   0   0
#>  [61,]   0   0
#>  [62,]   0   0
#>  [63,]   0   0
#>  [64,]   0   0
#>  [65,]   0   0
#>  [66,]   0   0
#>  [67,]   0   0
#>  [68,]   0   0
#>  [69,]   0   0
#>  [70,]   0   0
#>  [71,]   0   0
#>  [72,]   0   0
#>  [73,]   0   0
#>  [74,]   0   0
#>  [75,]   0   0
#>  [76,]   0   0
#>  [77,]   0   0
#>  [78,]   0   0
#>  [79,]   0   0
#>  [80,]   0   0
#>  [81,]   0   0
#>  [82,]   0   0
#>  [83,]   0   0
#>  [84,]   0   0
#>  [85,]   0   0
#>  [86,]   0   0
#>  [87,]   0   0
#>  [88,]   0   0
#>  [89,]   0   0
#>  [90,]   0   0
#>  [91,]   0   0
#>  [92,]   0   0
#>  [93,]   0   0
#>  [94,]   0   0
#>  [95,]   0   0
#>  [96,]   0   0
#>  [97,]   0   0
#>  [98,]   0   0
#>  [99,]   0   0
#> [100,]   0   0
#> [101,]   0   0
#> [102,]   0   0
#> [103,]   0   0
#> [104,]   0   0
#> [105,]   0   0
#> [106,]   0   0
#> [107,]   0   0
#> [108,]   0   0
#> [109,]   0   0
#> [110,]   0   0
#> [111,]   0   0
#> [112,]   0   0
#> [113,]   0   0
#> [114,]   0   0
#> [115,]   0   0
#> [116,]   0   0
#> [117,]   0   0
#> [118,]   0   0
#> [119,]   0   0
#> [120,]   0   0
#> [121,]   0   0
#> [122,]   0   0
#> [123,]   0   0
#> [124,]   0   0
#> [125,]   0   0
#> [126,]   0   0
#> [127,]   0   0
#> [128,]   0   0
#> [129,]   0   0
#> [130,]   0   0
#> [131,]   0   0
#> [132,]   0   0
#> [133,]   0   0
#> [134,]   0   0
#> [135,]   0   0
#> [136,]   0   0
#> [137,]   0   0
#> [138,]   0   0
#> [139,]   0   0
#> [140,]   0   0
#> [141,]   0   0
#> [142,]   0   0
#> [143,]   0   0
#> [144,]   0   0
#> [145,]   0   0
#> [146,]   0   0
#> [147,]   0   0
#> [148,]   0   0
#> [149,]   0   0
#> [150,]   0   0


if(requireNamespace("fastICA", quietly = TRUE)) {
  ica <- embed(dat, "FastICA")
  rot_ica <- getRotationMatrix(ica)
  scale(getData(dat), TRUE, FALSE) %*% rot_ica - getData(getDimRedData(ica))
}
#>                 ICA1          ICA2
#>   [1,]  1.110223e-16 -4.440892e-16
#>   [2,]  1.110223e-16 -6.661338e-16
#>   [3,] -5.551115e-17 -8.881784e-16
#>   [4,]  2.220446e-16 -4.440892e-16
#>   [5,]  2.220446e-16 -6.661338e-16
#>   [6,]  4.440892e-16 -4.440892e-16
#>   [7,]  1.665335e-16 -4.440892e-16
#>   [8,]  2.498002e-16 -4.440892e-16
#>   [9,]  0.000000e+00 -4.440892e-16
#>  [10,]  2.220446e-16 -6.661338e-16
#>  [11,]  2.220446e-16 -4.440892e-16
#>  [12,]  2.220446e-16 -4.440892e-16
#>  [13,]  1.110223e-16 -8.881784e-16
#>  [14,]  2.220446e-16 -6.661338e-16
#>  [15,]  4.440892e-16 -2.220446e-16
#>  [16,]  0.000000e+00 -8.881784e-16
#>  [17,]  2.220446e-16 -8.881784e-16
#>  [18,]  1.665335e-16 -4.440892e-16
#>  [19,]  4.440892e-16 -2.220446e-16
#>  [20,]  1.110223e-16 -4.440892e-16
#>  [21,]  4.440892e-16 -2.220446e-16
#>  [22,]  1.110223e-16 -6.661338e-16
#>  [23,]  1.249001e-16 -6.661338e-16
#>  [24,]  2.636780e-16 -4.440892e-16
#>  [25,]  1.942890e-16 -4.440892e-16
#>  [26,]  5.551115e-17 -4.440892e-16
#>  [27,]  2.498002e-16 -6.661338e-16
#>  [28,]  2.220446e-16 -6.661338e-16
#>  [29,]  2.220446e-16 -4.440892e-16
#>  [30,]  1.110223e-16 -4.440892e-16
#>  [31,]  1.110223e-16 -6.661338e-16
#>  [32,]  2.220446e-16 -8.881784e-16
#>  [33,]  2.220446e-16 -6.661338e-16
#>  [34,]  4.440892e-16 -6.661338e-16
#>  [35,]  1.665335e-16 -4.440892e-16
#>  [36,]  2.567391e-16 -2.220446e-16
#>  [37,]  0.000000e+00 -6.661338e-16
#>  [38,]  1.665335e-16 -8.881784e-16
#>  [39,]  0.000000e+00 -6.661338e-16
#>  [40,]  1.665335e-16 -4.440892e-16
#>  [41,]  5.551115e-17 -6.661338e-16
#>  [42,]  0.000000e+00 -6.661338e-16
#>  [43,]  0.000000e+00 -8.881784e-16
#>  [44,]  1.110223e-16 -4.440892e-16
#>  [45,]  1.110223e-16 -8.881784e-16
#>  [46,]  0.000000e+00 -6.661338e-16
#>  [47,]  1.110223e-16 -4.440892e-16
#>  [48,]  1.110223e-16 -4.440892e-16
#>  [49,]  2.220446e-16 -4.440892e-16
#>  [50,]  1.249001e-16 -4.440892e-16
#>  [51,]  2.220446e-16 -6.106227e-16
#>  [52,]  1.110223e-16 -6.106227e-16
#>  [53,]  0.000000e+00 -5.551115e-16
#>  [54,]  2.220446e-16 -6.106227e-16
#>  [55,]  1.387779e-16 -5.551115e-16
#>  [56,]  1.110223e-16 -6.106227e-16
#>  [57,]  3.330669e-16 -6.106227e-16
#>  [58,]  0.000000e+00 -6.106227e-16
#>  [59,]  3.330669e-16 -6.106227e-16
#>  [60,]  4.440892e-16 -5.828671e-16
#>  [61,]  0.000000e+00 -5.967449e-16
#>  [62,]  2.498002e-16 -6.106227e-16
#>  [63,]  2.220446e-16 -6.106227e-16
#>  [64,]  2.498002e-16 -5.551115e-16
#>  [65,]  3.330669e-16 -5.967449e-16
#>  [66,]  1.110223e-16 -6.106227e-16
#>  [67,]  1.110223e-16 -6.106227e-16
#>  [68,]  2.220446e-16 -6.106227e-16
#>  [69,]  2.220446e-16 -5.551115e-16
#>  [70,]  4.440892e-16 -6.106227e-16
#>  [71,]  2.359224e-16 -5.551115e-16
#>  [72,]  2.359224e-16 -6.106227e-16
#>  [73,]  1.110223e-16 -6.661338e-16
#>  [74,]  2.220446e-16 -5.551115e-16
#>  [75,]  3.885781e-16 -6.106227e-16
#>  [76,]  2.220446e-16 -6.106227e-16
#>  [77,]  1.110223e-16 -6.661338e-16
#>  [78,]  1.110223e-16 -6.661338e-16
#>  [79,]  2.220446e-16 -6.106227e-16
#>  [80,]  3.330669e-16 -5.828671e-16
#>  [81,]  4.440892e-16 -5.967449e-16
#>  [82,]  4.440892e-16 -5.967449e-16
#>  [83,]  2.220446e-16 -5.828671e-16
#>  [84,]  1.110223e-16 -5.551115e-16
#>  [85,]  1.110223e-16 -6.106227e-16
#>  [86,]  1.665335e-16 -6.106227e-16
#>  [87,]  1.110223e-16 -6.661338e-16
#>  [88,]  3.330669e-16 -6.106227e-16
#>  [89,]  2.220446e-16 -6.106227e-16
#>  [90,]  0.000000e+00 -6.106227e-16
#>  [91,]  0.000000e+00 -5.551115e-16
#>  [92,]  2.359224e-16 -6.106227e-16
#>  [93,]  2.220446e-16 -5.828671e-16
#>  [94,]  0.000000e+00 -5.967449e-16
#>  [95,]  2.220446e-16 -6.106227e-16
#>  [96,]  1.665335e-16 -5.828671e-16
#>  [97,]  2.220446e-16 -6.106227e-16
#>  [98,]  1.804112e-16 -6.106227e-16
#>  [99,]  2.220446e-16 -5.551115e-16
#> [100,]  1.110223e-16 -6.106227e-16
#> [101,]  2.636780e-16 -6.661338e-16
#> [102,]  2.220446e-16 -4.440892e-16
#> [103,]  1.110223e-16 -6.661338e-16
#> [104,]  2.775558e-16 -5.551115e-16
#> [105,]  1.179612e-16 -6.661338e-16
#> [106,] -4.440892e-16 -4.440892e-16
#> [107,]  4.440892e-16 -6.661338e-16
#> [108,]  2.220446e-16 -4.440892e-16
#> [109,]  1.110223e-16 -6.661338e-16
#> [110,]  0.000000e+00 -6.661338e-16
#> [111,]  1.110223e-16 -6.661338e-16
#> [112,]  2.775558e-16 -5.551115e-16
#> [113,]  2.220446e-16 -6.661338e-16
#> [114,]  0.000000e+00 -6.661338e-16
#> [115,]  2.220446e-16 -5.551115e-16
#> [116,]  2.220446e-16 -5.551115e-16
#> [117,]  1.110223e-16 -6.661338e-16
#> [118,]  0.000000e+00 -4.440892e-16
#> [119,]  3.330669e-16 -6.661338e-16
#> [120,]  2.220446e-16 -5.551115e-16
#> [121,]  1.110223e-16 -6.661338e-16
#> [122,]  2.220446e-16 -5.551115e-16
#> [123,]  0.000000e+00 -6.661338e-16
#> [124,]  2.220446e-16 -6.661338e-16
#> [125,]  1.110223e-16 -4.440892e-16
#> [126,]  0.000000e+00 -4.440892e-16
#> [127,]  1.665335e-16 -6.661338e-16
#> [128,]  2.220446e-16 -5.551115e-16
#> [129,]  2.220446e-16 -4.440892e-16
#> [130,]  2.220446e-16 -6.661338e-16
#> [131,]  3.330669e-16 -4.440892e-16
#> [132,] -4.440892e-16 -6.661338e-16
#> [133,]  2.220446e-16 -4.440892e-16
#> [134,]  2.775558e-16 -5.551115e-16
#> [135,]  3.330669e-16 -5.551115e-16
#> [136,]  0.000000e+00 -4.440892e-16
#> [137,]  1.110223e-16 -6.661338e-16
#> [138,]  2.220446e-16 -6.661338e-16
#> [139,]  2.220446e-16 -5.551115e-16
#> [140,]  1.110223e-16 -6.661338e-16
#> [141,]  1.110223e-16 -6.661338e-16
#> [142,]  1.110223e-16 -5.551115e-16
#> [143,]  2.220446e-16 -4.440892e-16
#> [144,]  1.110223e-16 -6.661338e-16
#> [145,]  1.110223e-16 -4.440892e-16
#> [146,]  1.665335e-16 -5.551115e-16
#> [147,]  3.330669e-16 -5.551115e-16
#> [148,]  1.110223e-16 -5.551115e-16
#> [149,]  1.665335e-16 -6.661338e-16
#> [150,]  2.220446e-16 -6.661338e-16