Package 'KlerRSS'

Title: Intelligent Ranked Set Sampling with 'Excel' Integration and SRS Comparison
Description: Provides tools for Ranked Set Sampling (RSS) analysis, data import, statistical estimation, and comparison with Simple Random Sampling (SRS). The package offers a complete workflow from 'Excel' and CSV data import and cleaning to RSS implementation, efficiency evaluation, visualization, and automated reporting. Intelligent ranking procedures based on correlation analysis, regression models, and machine learning methods are included to address imperfect ranking commonly encountered in practical RSS applications. Monte Carlo simulation tools are provided for evaluating estimator performance under different sampling scenarios. Ranked Set Sampling was originally introduced by McIntyre (1952) <doi:10.2307/3001960> as an efficient alternative to simple random sampling when ranking information is available at low cost. The package supports researchers, statisticians, and practitioners working in agricultural, environmental, biological, and other applied sciences.
Authors: Khalid Ul Islam Rather [aut, cre]
Maintainer: Khalid Ul Islam Rather <[email protected]>
License: GPL-3
Version: 0.2.4
Built: 2026-07-09 14:23:05 UTC
Source: https://github.com/cran/KlerRSS

Help Index


Complete RSS Analysis

Description

Runs the complete Ranked Set Sampling (RSS) analysis workflow by comparing the performance of RSS and Simple Random Sampling (SRS) using the supplied dataset.

Usage

kler_analyze(data, m = 3, r = 10)

Arguments

data

A data frame containing the study variable.

m

An integer specifying the set size. Default is 3.

r

An integer specifying the number of cycles. Default is 10.

Value

A list containing the results returned by 'kler_compare()', including the comparative analysis of RSS and SRS.

Examples

data <- data.frame(y = rnorm(100))
kler_analyze(data, m = 3, r = 5)

Compare RSS and SRS

Description

Compares Ranked Set Sampling (RSS) and Simple Random Sampling (SRS) using the supplied dataset and computes summary statistics and relative efficiency.

Usage

kler_compare(data, m = 3, r = 5)

Arguments

data

A data frame containing the study variable.

m

An integer specifying the set size. Default is 3.

r

An integer specifying the number of cycles. Default is 5.

Value

A list containing the sample means, sample variances, and relative efficiency of RSS compared with SRS.

Examples

data <- data.frame(y = rnorm(100))
kler_compare(data, m = 3, r = 5)

Import and Clean Data

Description

Imports data from CSV or 'Excel' (.xlsx) files and removes missing values.

Usage

kler_import(file)

Arguments

file

A character string specifying the path to a CSV or 'Excel' (.xlsx) file.

Details

The function automatically detects the file format from its extension. Files with the '.csv' extension are imported using 'utils::read.csv()', while '.xlsx' files are imported using 'readxl::read_excel()'.

Value

A cleaned data frame with missing values removed.

Examples

tmp <- tempfile(fileext = ".csv")
write.csv(data.frame(y = rnorm(10)), tmp, row.names = FALSE)
kler_import(tmp)

Machine Learning-Based Ranking for Ranked Set Sampling

Description

Simulates imperfect judgment ranking by adding random noise to the true ranks of the observations. This function can be used to emulate ranking errors in Ranked Set Sampling (RSS).

Usage

kler_ml_rank(x, noise_level = 0.1)

Arguments

x

A numeric vector to be ranked.

noise_level

A non-negative numeric value controlling the amount of ranking error. Larger values correspond to greater ranking uncertainty. The default is 0.1.

Value

An integer vector giving the indices that order the observations according to the simulated noisy ranking.


Distribution Comparison Plot

Description

Creates a density plot comparing the distributions of Simple Random Sampling (SRS) and Ranked Set Sampling (RSS) samples.

Usage

kler_plot_distribution(srs_sample, rss_sample)

Arguments

srs_sample

A numeric vector containing the SRS observations.

rss_sample

A numeric vector containing the RSS observations.

Value

A 'ggplot2' object representing the density comparison of the two sampling methods.

Examples

srs <- rnorm(100)
rss <- rnorm(100, mean = 0.5)
kler_plot_distribution(srs, rss)

Efficiency Comparison Plot

Description

Creates a bar chart comparing the sample variances obtained from Simple Random Sampling (SRS) and Ranked Set Sampling (RSS).

Usage

kler_plot_efficiency(comparison)

Arguments

comparison

A list returned by 'kler_compare()'.

Value

A 'ggplot2' object displaying the variance comparison between SRS and RSS.

Examples

data <- data.frame(y = rnorm(100))
comp <- kler_compare(data, m = 3, r = 5)
kler_plot_efficiency(comp)

Automated RSS Report

Description

Generates a text report summarizing the comparison between Ranked Set Sampling (RSS) and Simple Random Sampling (SRS).

Usage

kler_report(results)

Arguments

results

A list returned by 'kler_compare()'.

Value

A character string containing the analysis report.

Examples

data <- data.frame(y = rnorm(100))
res <- kler_compare(data, m = 3, r = 5)
cat(kler_report(res))

Ranked Set Sampling

Description

Draws a Ranked Set Sampling (RSS) sample from a univariate dataset using the classical RSS procedure.

Usage

kler_rss(data, m, r)

Arguments

data

A data frame containing at least one numeric variable.

m

A positive integer specifying the set size.

r

A positive integer specifying the number of sampling cycles.

Value

A numeric vector containing the Ranked Set Sampling (RSS) observations.

Examples

data <- data.frame(y = rnorm(100))
rss <- kler_rss(data, m = 3, r = 5)
head(rss)

Monte Carlo Simulation for RSS and SRS

Description

Performs a Monte Carlo simulation to compare the performance of Ranked Set Sampling (RSS) and Simple Random Sampling (SRS).

Usage

kler_simulation(n = 50, m = 3, r = 10, N = 500)

Arguments

n

A positive integer specifying the population sample size.

m

A positive integer specifying the set size.

r

A positive integer specifying the number of cycles.

N

A positive integer specifying the number of Monte Carlo repetitions.

Value

A list containing the estimated means, variances, and relative efficiency of RSS compared with SRS.

Examples

kler_simulation(n = 50, m = 3, r = 5, N = 10)

True Ranked Set Sampling (RSS)

Description

Draws a Ranked Set Sampling (RSS) sample from a data set using the classical RSS procedure.

Usage

kler_true_rss(data, m, r)

Arguments

data

A data frame containing at least one numeric variable.

m

A positive integer specifying the set size.

r

A positive integer specifying the number of sampling cycles.

Value

A numeric vector containing the Ranked Set Sampling (RSS) sample.

Examples

data <- data.frame(y = rnorm(100))
rss <- kler_true_rss(data, m = 3, r = 5)
head(rss)