Giter Club home page Giter Club logo

tclust's Introduction

tclust: Robust Trimmed Clustering

CRAN version R-CMD-check downloads downloads license

The package tclust provides functions for robust trimmed clustering. The methods are described in Garcia-Escudero (2008) doi:10.1214/07-AOS515, Fritz et al. (2012) doi:10.18637/jss.v047.i12, Garcia-Escudero et al. (2011) doi:10.1007/s11222-010-9194-z and others.

Installation

The tclust package is on CRAN (The Comprehensive R Archive Network) and the latest release can be easily installed using the command

install.packages("tclust")
library(tclust)

Building from source

To install the latest stable development version from GitHub, you can pull this repository and install it using

## install.packages("remotes")
remotes::install_github("valentint/tclust", build_opts = c("--no-build-vignettes"))

Of course, if you have already installed remotes, you can skip the first line (I have commented it out).

Example

Outlying data can heavily influence standard clustering methods. At the same time, clustering principles can be useful when robustifying statistical procedures. These two reasons motivate the development of feasible robust model-based clustering approaches. Instead of trying to “fit” noisy data, a proportion α of the most outlying observations is trimmed. The tclust package efficiently handles different cluster scatter constraints. Graphical exploratory tools are also provided to help the user make sensible choices for the trimming proportion as well as the number of clusters to search for.

library(tclust)
#> Robust Trimmed Clustering (version 2.0-0)
data (M5data)
x <- M5data[, 1:2]

clus.a <- tclust (x, k = 3, alpha = 0.1, restr.fact =  1,
                  restr = "eigen", equal.weights = TRUE)
clus.b <- tclust (x, k = 3, alpha = 0.1, restr.fact =  1,
                   equal.weights = TRUE)
clus.c <- tclust (x, k = 3, alpha = 0.1, restr.fact =  1,
                  restr = "deter", equal.weights = TRUE)
clus.d <- tclust (x, k = 3, alpha = 0.1, restr.fact = 50,
                  restr = "eigen", equal.weights = FALSE)

pa <- par (mfrow = c (2, 2))
plot (clus.a, main = "(a) tkmeans")
plot (clus.b, main = "(b) Gallegos and Ritter")
plot (clus.c, main = "(c) Gallegos")
plot (clus.d, main = "(d) tclust")

par (pa)

The trimmed k-means clustering method by Cuesta-Albertos, Gordaliza and Matran (1997) optimizes the k-means criterion under trimming a portion of the points:

library(tclust)
data (swissbank)
## Two clusters and 8% trimming level
clus <- tkmeans (swissbank, k = 2, alpha = 0.08)

## Pairs plot of the clustering solution
pairs (swissbank, col = clus$cluster + 1)

                                  # Two coordinates
plot (swissbank[, 4], swissbank[, 6], col = clus$cluster + 1,
     xlab = "Distance of the inner frame to lower border",
     ylab = "Length of the diagonal")

plot (clus)

Community guidelines

Report issues and request features

If you experience any bugs or issues or if you have any suggestions for additional features, please submit an issue via the Issues tab of this repository. Please have a look at existing issues first to see if your problem or feature request has already been discussed.

Contribute to the package

If you want to contribute to the package, you can fork this repository and create a pull request after implementing the desired functionality.

Ask for help

If you need help using the package, or if you are interested in collaborations related to this project, please get in touch with the package maintainer.

tclust's People

Contributors

valentint avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

lkampoli

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.