Learn R Programming

topologyR (version 0.1.2)

analyze_topology_factors: Calculate topology characteristics for different IQR factors

Description

This function analyzes how different IQR (Interquartile Range) factors affect the topology's characteristics. It helps users determine the optimal factor for their specific data by showing how the factor choice impacts the base size and set sizes in the resulting topology.

Usage

analyze_topology_factors(data, factors = NULL, plot = TRUE)

Value

A data.frame with the following columns:

factor

Numeric. The IQR factor used for threshold calculation.

threshold

Numeric. The calculated threshold value (IQR/factor).

base_size

Integer. Number of sets in the topological base.

max_set_size

Integer. Size of the largest set in the base.

min_set_size

Integer. Size of the smallest set in the base.

If plot = TRUE, also generates a line plot showing the relationship between IQR factors and base sizes as a side effect.

Arguments

data

Numeric vector containing the data to analyze

factors

Numeric vector of factors to test (default: c(1, 2, 4, 8, 16))

plot

Logical, whether to display a plot (default: TRUE)

Details

The function works by:

  1. Calculating different thresholds using IQR/factor

  2. Creating a subbase using these thresholds

  3. Generating the base from intersections of subbase elements

  4. Analyzing the resulting topology's characteristics

A larger factor results in a smaller threshold, which typically leads to a finer topology with more distinct sets but smaller set sizes.

Examples

Run this code
# Generate sample data
data <- rnorm(100)

# Analyze topology with default factors
results <- analyze_topology_factors(data)
print(results)

# Use custom factors
custom_results <- analyze_topology_factors(data, factors = c(2, 4, 6))
print(custom_results)

Run the code above in your browser using DataLab