kSearch: Relevant Component Estimation via Iterative Search

View source: R/kSearch.R

kSearchR Documentation

Relevant Component Estimation via Iterative Search

Description

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.

Usage

kSearch(
  X,
  method,
  search = c("forward", "backward", "binary"),
  alpha = 0.05,
  early_stop = NULL,
  min_dim = NULL,
  max_dim = NULL,
  ...
)

Arguments

X

A data matrix with p>1 columns.

method

A function that performs a hypothesis test given X and dimension k. For more details on supported tests, see the "Details" section below.

search

A character string specifying the search strategy. Options are forward (default), backward and binary. For more details on search techniques, see the "Details" section below.

alpha

A numeric significance level (default = 0.05) used as the threshold for rejecting the null hypothesis.

early_stop

Logical or NULL. Controls whether the search stops early once the null hypothesis is not rejected. If NULL (default), the behavior is determined by the selected search strategy: TRUE for "forward" and "backward", and FALSE for "binary". If explicitly set to TRUE or FALSE, this overrides the strategy's default behavior.

min_dim

Optional integer to limit the minimum dimension to search. By default, this is set according to the method being used.

max_dim

Optional integer to limit the maximum dimension to search. By default, this is set according to the method being used.

...

Additional arguments passed to the testing function method.

Details

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 ks in half and performs a binary search. This search may skip testing some possible k values, but it is typically faster than linear search.

Value

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.

Author(s)

Katariina Perkonoja

Examples

# 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


ICtest documentation built on June 8, 2025, 10:42 a.m.