print_akstats: Descriptive (Change) statistics

Description Usage Arguments Details Value References Examples

View source: R/print_akstats.R

Description

This function perform two tasks: (i) it generate the descriptive and change statistics of groups, particularly suited for the outputs form the akclustr function, and (ii) generates the plots of the groups (performances).

Usage

1
print_akstats(ak_object, k = 3, reference = 1, n_quant = 4, show_plots = FALSE)

Arguments

ak_object

An output of akclustr function. The object contains individual trajectories and their cluster solution(s) at the specified values of k. Also, includes the optimal value of k based on the criterion specified. at (different) values of k the traj.

k

[integer] k cluster to generate its solution.

reference

[numeric] Specifying the reference line from which the direction of each group is measured. Options are: 1: slope of mean trajectory, 2: slope of medoid trajectory, 3: slope of a horizontal line (i.e. slope = 0). Default: 1.

n_quant

[numeric] Number of equal intervals (quantiles) to create between the reference line (R) and the medoids (M) of the most-diverging groups of both sides of (R). Default is 4 - meaning quartile subdivisions on each side of (R). In this scenario, the function returns the quartile in which the medoid of each group falls. This result can be used to further categorize the groups into 'classes'. For example, groups that fall within the 1st quartile may be classified as 'Stable' groups (Adepeju et al. 2021).

show_plots

[TRUE or FALSE] Provides the trajectory group plot. Please, see plot_akstats function for more plot options. Defaults FALSE

Details

Generates the plot of trajectory groupings. Given an ak_object class (from the akclustr function), this function show the plots of cluster groups. The plot component draws from plot_akstats function.

Value

A plot showing group membership or sizes (proportion) and statistics.

References

1. Adepeju, M. et al. (2021). Anchored k-medoids: A novel adaptation of k-medoids further refined to measure inequality in the exposure to crime across micro places, doi: 10.1007/s42001-021-00103-1.

2. Wickham H. (2016). Elegant graphics for Data Analysis. Spring-Verlag New York (2016).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(traj)

trajectry <- data_imputation(traj, id_field = TRUE, method = 1,
replace_with = 1, fill_zeros = FALSE)

print(trajectry$CompleteData)

trajectry <- props(trajectry$CompleteData, id_field = TRUE)

aksolution <- akclustr(trajectry, id_field = TRUE,
    method = "linear", k = c(3,5), crit='Calinski_Harabasz')

print_akstats(aksolution, k = 4, show_plots=FALSE)

akmedoids documentation built on April 13, 2021, 9:07 a.m.