graph_eigenvalues.formula {dann} | R Documentation |
A helper for sub_dann
Description
A helper for sub_dann
Usage
## S3 method for class 'formula'
graph_eigenvalues(
formula,
data,
neighborhood_size = max(floor(nrow(data)/5), 50),
weighted = FALSE,
sphere = "mcd",
...
)
Arguments
formula |
A formula. Y ~ X1 + X1 |
data |
A data frame. |
neighborhood_size |
The number of data points used to calculate between and within class covariance. |
weighted |
weighted argument to ncoord. See |
sphere |
One of "mcd", "mve", "classical", or "none" See |
... |
Additional parameters passed to methods. |
Details
This function plots the eigenvalues found by fpc::ncoord()
. The user
should make a judgement call on how many eigenvalues are large and set sub_dann's
numDim to that number.
Value
A ggplot2 graph.
Examples
library(dann)
library(mlbench)
library(magrittr)
library(dplyr)
set.seed(1)
train <- mlbench.circle(300, 2) %>%
tibble::as_tibble()
colnames(train) <- c("X1", "X2", "Y")
# Add 5 unrelated variables
train <- train %>%
mutate(
U1 = runif(300, -1, 1),
U2 = runif(300, -1, 1),
U3 = runif(300, -1, 1),
U4 = runif(300, -1, 1),
U5 = runif(300, -1, 1)
)
graph_eigenvalues(Y ~ X1 + X2 + U1 + U2 + U3 + U4 + U5, train)
[Package dann version 1.0.0 Index]