vignettes/profiles-with-rank.Rmd
profiles-with-rank.Rmd
This article introduces the rank functions that are included in the wpa R package. These are powerful functions that scan a full person query dataset and automatically identify noteworthy groups, i.e. those exhibiting the highest or lowest values for a metric in the population.
Rank functions can uncover previously unknown patterns and interesting trends, without analysts having to manually slice the data across multiple attributes. You can think of them as a tool for automatic group exploration - an efficient method for identifying the top and bottom group of employees without manually reviewing all the possible organisational divisions.
Additionally, these functions can reveal what combination of attributes best describe a group that shows a specific behaviour (i.e for example, what organisational attributes represent employees suffering from excessive workload, receiving insufficient coaching, etc). As business leaders often want to develop targeted interventions to address specific issues, these functions can be a great way to inform action planning and transformation initiatives.
This article is divided in four sections. After this introduction, section two describes rank functions and show how them can be used with person query outputs. In the following section, we explore their use for profiling - i.e. to identify in which groups a specific behaviour is most common. The fourth and final section includes a list of additional use cases that can benefit from this method.
To get started, let’s open a new session in R and load the wpa R package. We will also use dplyr to facilitate data manipulation:
We will use the sq_data
demo dataset, which contains a
weekly person query output, and apply the
collaboration_rank()
function:
sq_data %>%
collaboration_rank(return = "table")
#> # A tibble: 18 × 4
#> hrvar group Collaboration_hours n
#> <chr> <chr> <dbl> <int>
#> 1 FunctionType Sales 31.1 66
#> 2 FunctionType Marketing 26.6 125
#> 3 Organization Human Resources 24.9 71
#> 4 LevelDesignation Manager 22.8 200
#> 5 Organization IT 22.6 130
#> 6 LevelDesignation Senior IC 21.4 67
#> 7 LevelDesignation Junior IC 20.6 58
#> 8 FunctionType Operations 20.3 115
#> 9 Organization Finance 20.0 292
#> 10 FunctionType Engineering 19.9 49
#> 11 LevelDesignation Support 19.3 257
#> 12 Organization Customer Service 18.9 61
#> 13 LevelDesignation Director 18.6 43
#> 14 Organization Financial Planning 17.3 75
#> 15 FunctionType IT 17.1 22
#> 16 FunctionType R_and_D 15.8 74
#> 17 FunctionType Finance 15.7 74
#> 18 FunctionType G_and_A 15.5 104
The output table contains the results from the automatic group
exploration. The rank function has taken all available organisational
attributes in this dataset (FunctionType
,
Organization
, LevelDesignation
, and
IsActive
) and calculated the average collaboration hours
for each group within each organisational attribute. The table shows the
analysed results for all groups, ranked from highest to lowest.
To view the entire table, we can add the function print
to the command above.
sq_data %>%
collaboration_rank(return = "table") %>%
print(n = 30)
#> # A tibble: 18 × 4
#> hrvar group Collaboration_hours n
#> <chr> <chr> <dbl> <int>
#> 1 FunctionType Sales 31.1 66
#> 2 FunctionType Marketing 26.6 125
#> 3 Organization Human Resources 24.9 71
#> 4 LevelDesignation Manager 22.8 200
#> 5 Organization IT 22.6 130
#> 6 LevelDesignation Senior IC 21.4 67
#> 7 LevelDesignation Junior IC 20.6 58
#> 8 FunctionType Operations 20.3 115
#> 9 Organization Finance 20.0 292
#> 10 FunctionType Engineering 19.9 49
#> 11 LevelDesignation Support 19.3 257
#> 12 Organization Customer Service 18.9 61
#> 13 LevelDesignation Director 18.6 43
#> 14 Organization Financial Planning 17.3 75
#> 15 FunctionType IT 17.1 22
#> 16 FunctionType R_and_D 15.8 74
#> 17 FunctionType Finance 15.7 74
#> 18 FunctionType G_and_A 15.5 104
This analysis shows us that the 82 employees labelled as
"FunctionType = "Sales"
have the highest collaboration
hours, with a weekly average of 31 hours. In second place, there are 60
individuals in Organization = "Inventory Management"
with
26.2 hours. On the lower end, the 75 employees labelled as
Organization = "Biz Dev"
appear to have the lowest
collaboration time.
This output is useful to identify groups that are worth investigating
(e.g. employees labelled as "FunctionType = Sales"
). It
also reveals that splits by FunctionType
and
Organization
are more interesting than those by
LevelDesignation
, as they have more variation; all groups
in LevelDesignation
have similar levels of collaboration,
between 18 and 22 hours a week. Rank functions can also display this
information in visual form. We can get that by changing the
return
argument from "table"
to
"plot"
:
sq_data %>%
collaboration_rank(return = "plot")
This plot contains the same information as the table above. Each row corresponds to a different organisational attribute and the bubbles show how the population is split across different subgroups, where bubble size is proportional to the number of individuals. The five groups in orange are clearly the ones spending most time in collaboration, with Sales being far ahead of the other groups. Keep in mind that each row of bubbles represents a different way to slice the same population, so groups across rows are not mutually exclusive.
In our baseline analysis, we uncovered that the 82 employees labelled
as FunctionType = "Sales"
have the highest average
collaboration hours. However, it is likely that some employees in this
group are more affected than others. Furthermore, there may be pockets
in other parts of this company that may be experiencing similar levels
of collaboration overload, but that are hidden given the structure of
the organisational data (for example, the managers within a particular
business unit).
The rank function includes an additional mode called “combine” that allows us to take our analysis one step further by performing on two HR variables the same analysis in a combinatorial manner:
sq_data %>%
collaboration_rank(return = "table", mode = "combine")
#> # A tibble: 168 × 4
#> hrvar group Collaboration_hours n
#> <chr> <chr> <dbl> <int>
#> 1 Combined [FunctionType] Sales [LevelDesignation] M… 33.7 25
#> 2 Combined [FunctionType] Sales [LevelDesignation] J… 30.0 10
#> 3 Combined [FunctionType] Sales [LevelDesignation] S… 29.5 18
#> 4 Combined [FunctionType] Sales [LevelDesignation] S… 28.7 9
#> 5 Combined [FunctionType] Marketing [LevelDesignatio… 27.9 48
#> 6 Combined [FunctionType] Marketing [LevelDesignatio… 27.7 11
#> 7 Combined [FunctionType] Marketing [LevelDesignatio… 26.1 14
#> 8 Combined [FunctionType] Marketing [LevelDesignatio… 25.5 45
#> 9 Combined [FunctionType] Marketing [LevelDesignatio… 24.2 7
#> 10 Combined [FunctionType] Operations [LevelDesignati… 22.7 8
#> # ℹ 158 more rows
The output table contains similar results from the group exploration above, but with more granularity. The function has automatically created smaller groups by combining two distinct groups from the organisational attributes in scope. In this case, it seems that the 28 managers in Sales are the worst affected group, with a weekly average of 33.7 hours in collaboration per week - that sounds like a lot of meetings!
So far, we have limited our analysis to
collaboration_rank()
, which only performs the analysis on
the metric Collaboration_hours
. However, the wpa R
package includes many other rank functions for key Workplace
Analytics metrics:
afterhours_rank()
- for
After_hours_collaboration_hours
email_rank()
- for Email_hours
meeting_rank()
- for
Meeting_hours
one2one_rank()
- for
Meeting_hours_with_manager_1_on_1
workloads_rank()
- for
Workweek_span
Additionally, if you want to apply this to any other numeric variable
of your choice, you can use the more general version below by specifying
the metric as a string with the argument metric
:
In the previous section, we explored how rank functions can help analysts uncover interesting insights, without the need of manually slicing the data across multiple attributes.
Rank functions have an additional use: they can help us identify what combination of attributes best describe a group that shows a given behaviour. For example, we may be concerned about individuals that are experiencing both a heavy collaboration load (more than 20 hours a week on average) and long workweeks (workweek span of over 60 hours), and would like to know where in the organisations these individuals sit.
To answer that question, let’s create a new numeric custom metric
(i.e. a binary flag that is only either 1
or
0
) and then apply the create_rank()
function:
sq_data %>%
mutate(At_risk = ifelse(Collaboration_hours > 20 & Workweek_span > 60 , 1, 0)) %>%
create_rank(metric = "At_risk", mode = "combine")
#> # A tibble: 168 × 4
#> hrvar group At_risk n
#> <chr> <chr> <dbl> <int>
#> 1 Combined [FunctionType] Marketing [LevelDesignation] Director 0.306 7
#> 2 Combined [FunctionType] Marketing [LevelDesignation] Senior IC 0.286 14
#> 3 Combined [FunctionType] Sales [LevelDesignation] Senior IC 0.286 9
#> 4 Combined [FunctionType] Sales [LevelDesignation] Junior IC 0.271 10
#> 5 Combined [FunctionType] Marketing [LevelDesignation] Manager 0.265 48
#> 6 Combined [FunctionType] Marketing [LevelDesignation] Support 0.263 45
#> 7 Combined [FunctionType] Sales [LevelDesignation] Support 0.254 18
#> 8 Combined [FunctionType] Sales [LevelDesignation] Manager 0.234 25
#> 9 Combined [FunctionType] Marketing [LevelDesignation] Junior IC 0.208 11
#> 10 Combined [FunctionType] Engineering [LevelDesignation] Junior … 0 5
#> # ℹ 158 more rows
The custom At_risk
variable identifies whether any
particular person-week exhibits high collaboration hours and long
workweeks. By combining this with create_rank()
, the
analysis reveals that the combination of heavy collaboration load plus
long workweeks is most prevalent among the 13 employees in
FunctionType = "Sales"
and
LevelDesignation = "Junior IC"
. In other words, the average
employee of these groups experience high collaboration load and long
workweeks 31% of the time.
In this article, we have shown how rank functions can be a powerful tool to both uncover previously unknown patterns and to profile the groups that are experiencing a certain behaviour. In the context of Workplace Analytics, we see a wide range of applications in the areas of wellbeing, ways of working, and sales excellence. Examples include:
We hope you found this article useful!
If you have any suggestions or feedback, please submit an issue at https://github.com/microsoft/wpa/issues.