To provide an overview of the cluster characteristics, we consider cluster mean and median values. In @fig-mean-heatmap, cluster mean values are reported for each variable and colored according to the difference with the average mean among clusters (`Avg mean`). In @fig-cluster-comp-mean, the cluster mean value is standardized with respect to the average mean among clusters for each variable). That is,
where $\\bar{graph_open}x{graph_close}_i$ is the mean value of a given variable for cluster $i$ and $\\bar{graph_open}x{graph_close}_{graph_open}Avg{graph_close}$ is the average mean among clusters (i.e, $\\frac{graph_open}\\sum_i{graph_open}\\bar{graph_open}x{graph_close}_i{graph_close}{graph_close}{graph_open}\\#i{graph_close}$).
where $\\bar{graph_open}x{graph_close}_i$ is the mean value of a given variable for cluster $i$, $\\bar{graph_open}x{graph_close}_{graph_open}Avg{graph_close}$ is the average mean among clusters (i.e, $\\frac{graph_open}\\sum_i{graph_open}\\bar{graph_open}x{graph_close}_i{graph_close}{graph_close}{graph_open}\\#i{graph_close}$), and $\\bar{graph_open}x{graph_close}_{graph_open}Std{graph_close}$ is the standard deviation of the cluster means (i.e, $Std(\\bar{graph_open}x{graph_close}_i)$).
```{graph_open}python{graph_close}
#| fig-align: center
...
...
@@ -594,10 +594,10 @@ qmd.plot_cluster_comp_loop(
In @fig-median-heatmap, cluster median values are reported for each variable and colored according to the difference with the average median among clusters (`Avg median`). In @fig-cluster-comp-median, the cluster median value is standardized with respect to the average median among clusters for each variable). That is,
where $\\tilde{graph_open}x{graph_close}_i$ is the median value of a given variable for cluster $i$ and $\\tilde{graph_open}x{graph_close}_{graph_open}Avg{graph_close}$ is the average median among clusters (i.e, $\\frac{graph_open}\\sum_i{graph_open}\\tilde{graph_open}x{graph_close}_i{graph_close}{graph_close}{graph_open}\\#i{graph_close}$).
where $\\tilde{graph_open}x{graph_close}_i$ is the median value of a given variable for cluster $i$, $\\tilde{graph_open}x{graph_close}_{graph_open}Avg{graph_close}$ is the average median among clusters (i.e, $\\frac{graph_open}\\sum_i{graph_open}\\tilde{graph_open}x{graph_close}_i{graph_close}{graph_close}{graph_open}\\#i{graph_close}$), , and $\\tilde{graph_open}x{graph_close}_{graph_open}Avg{graph_close}$ is the interquantile range of the cluster medians (i.e, $IQR(\\tilde{graph_open}x{graph_close}_i)$)..
```{graph_open}python{graph_close}
...
...
@@ -776,19 +776,25 @@ def get_dict_stat(
selected_grouped=data.groupby(['cluster_lab'])
cluster_means=selected_grouped.mean()
cluster_medians=selected_grouped.median()
overall_mean=cluster_means.mean()
ovarall_sd=cluster_means.std()
overall_median=cluster_medians.mean()
ovarall_iqr=cluster_medians.apply(# interqunaitle range