Package 'RobPC'

Title: Robust Panel Clustering Algorithm
Description: Performs both classical and robust panel clustering by applying Principal Component Analysis (PCA) for dimensionality reduction and clustering via standard K-Means or Trimmed K-Means. The method is designed to ensure stable and reliable clustering, even in the presence of outliers. Suitable for analyzing panel data in domains such as economic research, financial time-series, healthcare analytics, and social sciences. The package allows users to choose between classical K-Means for standard clustering and Trimmed K-Means for robust clustering, making it a flexible tool for various applications. For this package, we have benefited from the studies Rencher (2003), Wang and Lu (2021) <DOI:10.25236/AJBM.2021.031018>, Cuesta-Albertos et al. (1997) <https://www.jstor.org/stable/2242558?seq=1>.
Authors: Hasan Bulut [aut, cre]
Maintainer: Hasan Bulut <[email protected]>
License: GPL-2
Version: 1.4
Built: 2025-02-21 05:36:51 UTC
Source: https://github.com/cran/RobPC

Help Index


Robust Panel Clustering Algorithm

Description

Robust Panel Clustering Algorithm

Usage

RobPC(data, k, robclust = FALSE, trim = 0.25)

Arguments

data

the panel data. It must be array.

k

the number of clusters.

robclust

a logical arguments. If robclust=TRUE, the function implements the robust panel clustering analysis. Otherwise, it implements the traditional panel clustering analysis. The default value is robclust=TRUE.

trim

numeric between 0 and 1. Proportion of points to be trimmed. The default value is 0.25.

Details

RobPC function implements the traditional or robust panel clustering analysis without being affected by outliers in the panel data.

Value

a list with 2 elements:

clusters

integer vector coding cluster membership. If robclust=TRUE, this vector includes codes as k+1 to define outliers clusters.

clustering_method

The used clustering method which is "Robust Panel Clustering" or "Panel Clustering".

Author(s)

Hasan BULUT <[email protected]>

References

Bulut et al. (Unpublished). A Robust Clustering Algorithms for Panel Data.

Wang, W., & Lu, Y. (2021). Application of clustering analysis of panel data in economic and social research based on R software. Acad. J. Bus. Manag, 3, 98-104.

Cuesta-Albertos, J. A., Gordaliza, A., & MatrĂ¡n, C. (1997). Trimmed k-means: an attempt to robustify quantizers. The Annals of Statistics, 25(2), 553-576.

Examples

set.seed(123)
 n_obs <- 10  # Number of observations (N)
 n_time <- 5   # Number of time periods (T)
 n_vars <- 3   # Number of variables (D)
 
 data <- array(rnorm(n_obs * n_time * n_vars), dim = c(n_obs, n_time, n_vars))

 # Apply the Classical Panel Clustering
 
    result_classic <- RobPC(data,k=3,robclust = FALSE)
    result_classic
    
 # Apply the Robust Panel Clustering
 
    result_robust<- RobPC(data,k=3,robclust = TRUE,trim=0.2)
    result_robust