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).
print_akstats(ak_object, k = 3, reference = 1, n_quant = 4, show_plots = FALSE)
ak_object | An output of |
---|---|
k | [integer] |
reference | [numeric] Specifying the reference line from
which the direction of each group is measured. Options are:
|
n_quant | [numeric] Number of equal intervals (quantiles)
to create between the reference line |
show_plots | [TRUE or FALSE] Provides the trajectory group
plot. Please, see |
A plot showing group membership or sizes (proportion) and statistics.
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.
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).
data(traj) trajectry <- data_imputation(traj, id_field = TRUE, method = 1, replace_with = 1, fill_zeros = FALSE)#> [1] "8 entries were found/filled!"#> location_ids X2001 X2002 X2003 X2004 X2005 X2006 X2007 X2008 X2009 #> 1 E01012628 3 0.000 1.000000 2 1 0.000000 1.000 4 0 #> 2 E01004768 9 5.125 2.000000 4 7 5.000000 1.000 3 1 #> 3 E01004803 4 3.000 0.000000 10 2 3.000000 6.000 6 8 #> 4 E01004804 7 3.000 9.000000 3 2 4.857143 6.000 3 2 #> 5 E01004807 2 5.125 5.000000 5 6 4.857143 3.000 5 4 #> 6 E01004808 8 5.000 8.000000 4 1 5.000000 6.000 1 1 #> 7 E01004788 2 4.000 7.333333 2 2 4.000000 1.000 3 0 #> 8 E01004790 10 9.000 17.000000 13 15 4.857143 5.625 19 9 #> 9 E01004805 8 5.000 10.000000 7 9 4.000000 5.625 6 3 #> 10 E01004806 25 12.000 14.000000 15 18 13.000000 21.000 27 17trajectry <- props(trajectry$CompleteData, id_field = TRUE) aksolution <- akclustr(trajectry, id_field = TRUE, method = "linear", k = c(3,5), crit='Calinski_Harabasz')#> [1] "Processing...." #> [1] ".............." #> [1] "solution of k = 3 determined!" #> [1] "solution of k = 4 determined!" #> [1] "solution of k = 5 determined!"print_akstats(aksolution, k = 4, show_plots=FALSE)#> Warning: `fun.y` is deprecated. Use `fun` instead.#> $descriptive_stats #> group n n(%) %Prop.time1 %Prop.timeT Change %Change #> 1 A 2 20 21.8 4.4 -17.4 -395.5 #> 2 B 3 30 21.8 11.1 -10.7 -96.4 #> 3 C 3 30 19.2 28.9 9.7 33.6 #> 4 D 2 20 37.2 55.6 18.4 33.1 #> #> $change_stats #> group sn %+ve Traj. %-ve Traj. Qtl:1st-4th #> 1 A 1 0 100 4th (-ve) #> 2 B 2 0 100 3rd (-ve) #> 3 C 3 66.7 33.3 1st (+ve) #> 4 D 4 100 0 4th (+ve) #>