The tna
package includes functionalities for finding
cliques of the transition network as well as discovering communities. We
begin by loading the package and the example data set
engagement
.
library("tna")
data("engagement", package = "tna")
We fit the TNA model to the data.
<- tna(engagement)
tna_model print(tna_model)
#> State Labels
#>
#> Active, Average, Disengaged
#>
#> Transition Probability Matrix
#>
#> Active Average Disengaged
#> Active 0.52519894 0.4279399 0.04686118
#> Average 0.24669137 0.5632610 0.19004764
#> Disengaged 0.09871795 0.4782051 0.42307692
#>
#> Initial Probabilities
#>
#> Active Average Disengaged
#> 0.270 0.355 0.375
plot(tna_model)
Next, we apply several community finding algorithms to the model (see
?communities
for more details), and plot the results for
the leading_eigen
algorithm.
<- communities(tna_model)
cd plot(cd, method = "leading_eigen")
Cliques can be obtained with the cliques
function. Here
we look for dyads and triads by setting size = 2
and
size = 3
, respectively. Finally, we plot the results.
<- cliques(tna_model, size = 2)
dyads <- cliques(tna_model, size = 3)
triads plot(dyads)
plot(triads)