Learn R Programming

Overview

archetypal is a package for performing Archetypal Analysis (AA) by using a properly modified version of PCHA algorithm.

Basic functions are:

  • archetypal() do AA
  • find_outmost_projected_convexhull_points Projected CH initial solution.
  • find_outmost_convexhull_points CH initial solution.
  • find_outmost_partitioned_convexhull_points() Partitioned CH initial solution.
  • find_furthestsum_points() Furthest Sum initial solution.
  • find_outmost_points() Outmost initial solution.
  • find_optimal_kappas() search for the optimal number of archetypes
  • find_pcha_optimal_parameters() search for the optimal updating parameters of PCHA algorithm
  • check_Bmatrix() check B matrix after run of AA.
  • study_AAconvergence() study the convergence of PCHA algorithm
  • find_closer_points() find the closer to archetypes data points

Install the archetypal package and then read vignette("archetypal", package = "archetypal").

Installation

# Install with dependencies:
install.packages("archetypal",dependencies=TRUE)

Usage

library(archetypal)

data("wd2")
df = wd2
aa = archetypal(df = df, kappas = 3,verbose = FALSE, rseed = 9102)

# Time for computing Projected Convex Hull was 0.01 secs 
# Next projected convex hull initial solution will be used... 
#           x        y
# 34 5.687791 3.481611
# 62 1.961799 2.793497
# 5  5.123878 2.745874
# 
# archs=aa$BY
# archs
# x        y
# [1,] 5.430757 3.146258
# [2,] 2.043435 2.710947
# [3,] 3.128401 4.781751
# aa[c("SSE","varexpl","iterations","time" )]
# $SSE
# [1] 1.717538
# 
# $varexpl
# [1] 0.9993186
# 
# $iterations
# [1] 63
# 
# $time
# [1] 8.1
# cbind(names(aa))
# [,1]             
# [1,] "BY"             
# [2,] "A"              
# [3,] "B"              
# [4,] "SSE"            
# [5,] "varexpl"        
# [6,] "initialsolution"
# [7,] "freqstable"     
# [8,] "iterations"     
# [9,] "time"           
# [10,] "converges"      
# [11,] "nAup"           
# [12,] "nAdown"         
# [13,] "nBup"           
# [14,] "nBdown"         
# [15,] "run_results"   

Contact

Please send comments, suggestions or bug reports to dchristop@econ.uoa.gr or dem.christop@gmail.com

Copy Link

Version

Install

install.packages('archetypal')

Monthly Downloads

277

Version

1.3.1

License

GPL (>= 2)

Maintainer

Demetris Christopoulos

Last Published

May 23rd, 2024

Functions in archetypal (1.3.1)

find_outmost_partitioned_convexhull_points

Function which finds the outermost convex hull points after making np samples and finding convex hull for each of them.
find_pcha_optimal_parameters

Finds the optimal updating parameters to be used for the PCHA algorithm
plot.archetypal

Plot an object of the class archetypal.
find_outmost_projected_convexhull_points

Function which finds the outermost projected convex hull points in order to be used as initial solution in archetypal analysis
find_outmost_convexhull_points

Function which finds the outermost convex hull points in order to be used as initial solution in archetypal analysis
find_outmost_points

Function which finds the outermost points in order to be used as initial solution in archetypal analysis
grouped_resample

Function for performing simple or Dirichlet resampling
plot.kappa_tools

Plot an object of the class kappa_tools
kappa_tools

Compute kappa tools for data dimensionality analysis
gallupGPS6

Gallup Global Preferences Study processed data set of six variables
print.archetypal

Print an object of the class archetypal.
summary.archetypal

Summary for an object of the class archetypal.
study_AAconvergence

Function which studies the convergence of Archetypal Analysis when using the PCHA algorithm
wd2

2D data set for demonstration purposes
wd3

3D data set for demonstration purposes
wd25

2D data set created by 5 points for demonstration purposes
plot_archs

A function for plotting arechetypes
plot.study_AAconvergence

Plot an object of the class study_AAconvergence
FurthestSum

Application of FurthestSum algorithm in order to find an initial solution for Archetypal Analysis
archetypal-package

Finds the Archetypal Analysis of a Data Frame
align_archetypes_from_list

Align archetypes from a list either by the most frequent found or by using a given archetype
find_furthestsum_points

Function which finds the furthest sum points in order to be used as initial solution in archetypal analysis
check_Bmatrix

Function which checks B matrix of Archetypal Analysis Y ~ A B Y in order to find the used rows for creating each archetype and the relevant used weights.
archetypal

archetypal: Finds the archetypal analysis of a data frame by using a variant of the PCHA algorithm
find_closer_points

Function which finds the data points that are closer to the archetypes during all iterations of the algorithm PCHA
find_optimal_kappas

Function for finding the optimal number of archetypes
AbsoluteTemperature

Global Absolute Temperature data set for Northern Hemisphere 1969-2013
dirichlet_sample

Function which performs Dirichlet sampling