kSearch | R Documentation |
Performs dimension estimation using various search strategies (forward, backward, binary)
and hypothesis testing methods that evaluate whether the true dimension d \leq k
.
The search continues until a p-value exceeds the specified alpha threshold, which indicates
that the null hypothesis is not rejected. The search can optionally continue to test all values, as there may not be a global optimum
in the tested range.
kSearch(
X,
method,
search = c("forward", "backward", "binary"),
alpha = 0.05,
early_stop = NULL,
min_dim = NULL,
max_dim = NULL,
...
)
X |
A data matrix with |
method |
A function that performs a hypothesis test given |
search |
A character string specifying the search strategy.
Options are |
alpha |
A numeric significance level (default = 0.05) used as the threshold for rejecting the null hypothesis. |
early_stop |
Logical or |
min_dim |
Optional integer to limit the minimum dimension to search. By default, this is set according to the |
max_dim |
Optional integer to limit the maximum dimension to search. By default, this is set according to the |
... |
Additional arguments passed to the testing function |
This function is designed to work with the following tests:
FOBIasymp
, FOBIboot
ICSboot
NGPPsim
PCAasymp
, PCAboot
, PCAschott
SIRasymp
, SIRboot
These tests evaluate the null hypothesis that the true dimension d \leq k
, and return
a p-value indicating whether the null is rejected or not.
The search work as follows:
"forward"
(default) performs a linear search starting from the smallest possible value of k
and incrementing upward. Returns the smallest k
where the null is not rejected.
"backward"
performs a linear search starting from the largest possible value of k
and decrementing downward. Returns k
+1, where k
is the largest dimension where the null is rejected.
"binary"
splits the possible range of k
s in half and performs a binary search. This search may skip testing some possible k
values, but it is typically faster than linear search.
An object of class ictest
inheriting from htest
, with additional elements:
tested.ks
An integer vector of all tested values of k
during the search.
tested.ks.pvals
A numeric vector of p-values corresponding to each tested k
.
Katariina Perkonoja
# Applying forward search with PCAasymp while evaluating
# all valid values of k (early_stop = FALSE)
n <- 200
S <- cbind(rnorm(n, sd = 2), rnorm(n, sd = 1.5),
rnorm(n), rnorm(n), rnorm(n))
A <- rorth(5)
X <- S %*% t(A)
result <- kSearch(
X = X,
method = PCAasymp,
alpha = 0.05,
search = "forward",
early_stop = FALSE
)
result
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.