Skip to contents

Create a projection matrix using projection pursuit optimization (PPO).

Usage

RotMatPPO(
  X,
  y,
  model = "PPR",
  split = "entropy",
  weights = NULL,
  dimProj = min(ceiling(length(y)^0.4), ceiling(ncol(X) * 2/3)),
  numProj = ifelse(dimProj == "Rand", sample(floor(ncol(X)/3), 1),
    ceiling(ncol(X)/dimProj)),
  catLabel = NULL,
  ...
)

Arguments

X

An n by d numeric matrix (preferable) or data frame.

y

A response vector of length n.

model

Model for projection pursuit (for details see PPO).

split

One of three criteria, 'gini': gini impurity index (classification), 'entropy': information gain (classification, default) or 'mse': mean square error (regression).

weights

A vector of length same as data that are positive weights. (default NULL)

dimProj

Number of variables to be projected, dimProj=min(ceiling(n^0.4),ceiling(ncol(X)*2/3)) (default) or dimProj="Rand": random from 1 to ncol(X).

numProj

The number of projection directions, when dimProj="Rand" default numProj = sample(ceiling(ncol(X)/3),1) otherwise default numProj=ceiling(ncol(X)/dimProj).

catLabel

A category labels of class list in predictors. (default NULL, for details see Examples of ODT)

...

Used to handle superfluous arguments passed in using paramList.

Value

A random matrix to use in running ODT.

  • Variable: Variables to be projected.

  • Number: Number of projections.

  • Coefficient: Coefficients of the projection matrix.

Examples

set.seed(220828)
X <- matrix(rnorm(1000), 100, 10)
y <- (rnorm(100) > 0) + 0
(RotMat <- RotMatPPO(X, y))
#>       Variable Number Coefficient
#>  [1,]        7      1  1.00000000
#>  [2,]        3      2  1.00000000
#>  [3,]        2      3  1.00000000
#>  [4,]       10      4  1.00000000
#>  [5,]        8      5 -0.63747080
#>  [6,]        7      5 -0.33498954
#>  [7,]        6      5  0.40102900
#>  [8,]        4      5  0.44271368
#>  [9,]       10      5 -0.35297779
#> [10,]        2      6 -0.22464801
#> [11,]        1      6  0.70400011
#> [12,]        5      6  0.16604464
#> [13,]        3      6 -0.04357413
#> [14,]        9      6  0.65149643
#> [15,]        1      7  0.62001403
#> [16,]        9      7  0.26056728
#> [17,]        8      7 -0.12300744
#> [18,]        4      7  0.40539513
#> [19,]        6      7  0.60680413
(RotMat <- RotMatPPO(X, y, dimProj = "Rand"))
#>       Variable Number Coefficient
#>  [1,]        9      1  1.00000000
#>  [2,]        3      2  1.00000000
#>  [3,]        8      3  1.00000000
#>  [4,]        1      4  1.00000000
#>  [5,]        1      1  0.41034620
#>  [6,]        2      1 -0.05702688
#>  [7,]        3      1 -0.20189258
#>  [8,]        4      1  0.24738638
#>  [9,]        5      1  0.18941654
#> [10,]        6      1  0.33597211
#> [11,]        7      1 -0.19232749
#> [12,]        8      1 -0.11345253
#> [13,]        9      1  0.36297960
#> [14,]       10      1 -0.62931064
(RotMat <- RotMatPPO(X, y, dimProj = 6, numProj = 4))
#>       Variable Number Coefficient
#>  [1,]        8      1   1.0000000
#>  [2,]        1      2   1.0000000
#>  [3,]        2      3   1.0000000
#>  [4,]        6      4   1.0000000
#>  [5,]        5      5   0.7524546
#>  [6,]        2      5  -0.2513190
#>  [7,]        4      5   0.6088110
#>  [8,]        1      6   0.8235489
#>  [9,]        8      6  -0.5672452
#> [10,]        6      7   0.8527041
#> [11,]        3      7  -0.5223943
#> [12,]       10      8  -0.8067687
#> [13,]        9      8   0.4836435
#> [14,]        7      8  -0.3394308
#> [15,]        6      9   0.5429000
#> [16,]        1      9   0.3816742
#> [17,]       10      9  -0.6710470
#> [18,]        5      9   0.3305759

# classification
data(seeds)
(PP <- RotMatPPO(seeds[, 1:7], seeds[, 8], model = "Log", split = "entropy"))
#>       Variable Number Coefficient
#>  [1,]        7      1  1.00000000
#>  [2,]        6      2  1.00000000
#>  [3,]        5      3  1.00000000
#>  [4,]        7      4  0.80070860
#>  [5,]        2      4 -0.57197028
#>  [6,]        6      4  0.09180371
#>  [7,]        5      4 -0.15260345
#>  [8,]        3      5 -0.99266473
#>  [9,]        1      5 -0.01373195
#> [10,]        4      5 -0.12011731
#> [11,]        3      6 -0.92259750
#> [12,]        7      6  0.22777345
#> [13,]        2      6 -0.23433424
#> [14,]        5      6  0.20498921
(PP <- RotMatPPO(seeds[, 1:7], seeds[, 8], model = "PPR", split = "entropy"))
#>       Variable Number  Coefficient
#>  [1,]        3      1  1.000000000
#>  [2,]        1      2  1.000000000
#>  [3,]        2      3  1.000000000
#>  [4,]        3      4 -0.988281570
#>  [5,]        6      4  0.008187774
#>  [6,]        1      4  0.048662943
#>  [7,]        2      4 -0.144445205
#>  [8,]        5      5 -0.291498857
#>  [9,]        7      5  0.548547148
#> [10,]        4      5 -0.783660924
#> [11,]        3      6 -0.848820653
#> [12,]        4      6 -0.442538941
#> [13,]        7      6  0.282088117
#> [14,]        5      6 -0.063945909
(PP <- RotMatPPO(seeds[, 1:7], seeds[, 8], model = "LDA", split = "entropy"))
#>       Variable Number Coefficient
#>  [1,]        6      1  1.00000000
#>  [2,]        7      2  1.00000000
#>  [3,]        5      3  1.00000000
#>  [4,]        5      4  0.84899943
#>  [5,]        1      4  0.42679608
#>  [6,]        6      4 -0.05823805
#>  [7,]        7      4  0.30602845
#>  [8,]        2      5 -0.42409016
#>  [9,]        3      5 -0.90512230
#> [10,]        4      5 -0.03001925
#> [11,]        3      6  0.92258733
#> [12,]        5      6  0.17607151
#> [13,]        1      6 -0.04931458
#> [14,]        2      6  0.33970504

# regression
data(body_fat)
(PP <- RotMatPPO(body_fat[, 2:15], body_fat[, 1], model = "Log", split = "mse"))
#>       Variable Number   Coefficient
#>  [1,]       12      1  1.0000000000
#>  [2,]        8      2  1.0000000000
#>  [3,]        9      3  1.0000000000
#>  [4,]       14      4  1.0000000000
#>  [5,]        5      5 -0.1354890116
#>  [6,]       10      5 -0.0229807153
#>  [7,]       14      5  0.9318006142
#>  [8,]       11      5 -0.0487637387
#>  [9,]       12      5 -0.1148845383
#> [10,]        2      5 -0.0924499623
#> [11,]        9      5 -0.2978907099
#> [12,]        7      6 -0.0425456052
#> [13,]        4      6  0.0137041007
#> [14,]        6      6  0.0316612459
#> [15,]        8      6 -0.0108830294
#> [16,]        3      6  0.0107094563
#> [17,]        1      6 -0.9976644991
#> [18,]       13      6 -0.0378424231
#> [19,]        1      7 -0.9668121838
#> [20,]       14      7  0.2391075465
#> [21,]        9      7 -0.0053082782
#> [22,]        5      7  0.0443749634
#> [23,]       12      7 -0.0441831784
#> [24,]        2      7  0.0006183072
#> [25,]       11      7 -0.0644354848
(PP <- RotMatPPO(body_fat[, 2:15], body_fat[, 1], model = "Rand", split = "mse"))
#>       Variable Number Coefficient
#>  [1,]       12      1   1.0000000
#>  [2,]        5      2   1.0000000
#>  [3,]        3      3   1.0000000
#>  [4,]        4      4   1.0000000
#>  [5,]        5      5   0.3779645
#>  [6,]        9      5  -0.3779645
#>  [7,]       12      5  -0.3779645
#>  [8,]       14      5   0.3779645
#>  [9,]        1      5   0.3779645
#> [10,]       10      5   0.3779645
#> [11,]        8      5  -0.3779645
#> [12,]        7      6  -0.3779645
#> [13,]        4      6  -0.3779645
#> [14,]        2      6  -0.3779645
#> [15,]       13      6   0.3779645
#> [16,]       11      6  -0.3779645
#> [17,]        3      6   0.3779645
#> [18,]        6      6   0.3779645
#> [19,]        5      7   0.3779645
#> [20,]        9      7  -0.3779645
#> [21,]       12      7   0.3779645
#> [22,]       14      7  -0.3779645
#> [23,]        1      7  -0.3779645
#> [24,]       10      7   0.3779645
#> [25,]        8      7   0.3779645
(PP <- RotMatPPO(body_fat[, 2:15], body_fat[, 1], model = "PPR", split = "mse"))
#>       Variable Number  Coefficient
#>  [1,]        8      1  1.000000000
#>  [2,]       10      2  1.000000000
#>  [3,]        5      3  1.000000000
#>  [4,]        6      4  1.000000000
#>  [5,]        7      5 -0.356875669
#>  [6,]        6      5  0.037456061
#>  [7,]       13      5 -0.186967615
#>  [8,]        2      5 -0.027215019
#>  [9,]       14      5  0.883994707
#> [10,]        5      5  0.215317575
#> [11,]       10      5  0.087925847
#> [12,]       12      6 -0.045902870
#> [13,]        3      6  0.018505068
#> [14,]        1      6 -0.994007545
#> [15,]        4      6 -0.000279017
#> [16,]        9      6 -0.057642171
#> [17,]       11      6 -0.077971676
#> [18,]        8      6  0.009859475
#> [19,]        1      7 -0.966846911
#> [20,]       14      7  0.235875959
#> [21,]        7      7 -0.010618395
#> [22,]        5      7  0.029799022
#> [23,]       13      7 -0.024434531
#> [24,]       10      7  0.026277615
#> [25,]       11      7 -0.085330484