Description Usage Arguments Details Value See Also Examples

Variable selection with KPC using directed K-NN graph or minimum spanning tree (MST)

1 2 3 4 5 6 7 8 9 10 |

`Y` |
a matrix of responses (n by dy) |

`X` |
a matrix of predictors (n by dx) |

`k` |
a function |

`Knn` |
the number of nearest neighbor; or "MST" |

`num_features` |
the number of variables to be selected, cannot be larger than dx. The default value is NULL and in that
case it will be set equal to dx. If |

`stop` |
If |

`numCores` |
number of cores that are going to be used for parallelizing the process. |

`verbose` |
whether to print each selected variables during the forward stepwise algorithm |

A stepwise forward selection of variables using KPC. At each step the *X_j* maximizing *\hat{ρ^2}(Y,X_j | selected X_i)* is selected.
It is suggested to normalize the predictors before applying KFOCI.
Euclidean distance is used for computing the K-NN graph and the MST.

The algorithm returns a vector of the indices from 1,...,dx of the selected variables

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
n = 200
p = 10
X = matrix(rnorm(n * p), ncol = p)
Y = X[, 1] * X[, 2] + sin(X[, 1] * X[, 3])
KFOCI(Y, X, kernlab::rbfdot(1), Knn=1, numCores=1)
## Not run:
### install the package olsrr first
surgical = olsrr::surgical
for (i in 1:9) surgical[,i] = (surgical[,i] - mean(surgical[,i]))/sd(surgical[,i])
ky = kernlab::rbfdot(1/(2*stats::median(stats::dist(surgical$y))^2))
colnames(surgical)[KFOCI(surgical[,9],surgical[,1:8],ky,Knn=1)]
#### "enzyme_test" "pindex" "liver_test" "alc_heavy"
n = 200
p = 1000
set.seed(1)
X = matrix(rnorm(n * p), ncol = p)
Y = X[, 1] * X[, 2] + sin(X[, 1] * X[, 3])
KFOCI(Y, X, kernlab::rbfdot(1), Knn=1, numCores = 7, verbose=TRUE)
# 1 2 3
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.