Answers.Body: <p><em>Answer from @llrs, converted from comment:</em></p>
  <p>Perhaps I'm not understanding correctly what you are doing. But these <a href="https://stats.stackexchange.com/a/11702/105234">stability tests</a> are used when the number of clusters is unknown, so you test the resolution, or other metrics for a range of numbers of clusters. Then you choose the best one (either the one that is better by the score, or the one that increasing the number of clusters don't improve your metric much more)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-08T21:32:53.707Z
Answers.LastActivityDate: 2021-07-08T21:32:53.707Z
Answers.UserDisplayName: gringer
Answers.Body: <p>If you have both cluster assignments, you can check for consistency of assignment by looking at pairwise counts using <code>table</code> in R:</p>
  <pre><code>cons.mat &lt;- table(clusters.1, clusters.2)
  </code></pre>
  <p>The result of this will be a matrix showing the number of cells / samples that have the observed cluster assignments via each method. If the two cluster assignments are similar, then samples from one cluster via one method should be mostly assigned to one cluster in the other method. You can check this by comparing table cell values with their row/column sum:</p>
  <pre><code>## show consistency along the first dimension
  apply(cons.mat, 1, function(x){max(x / sum(x))})
  ## show consistency along the second dimension
  apply(cons.mat, 2, function(x){max(x / sum(x))})
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-07T23:56:19.410Z
Answers.LastActivityDate: 2021-08-07T23:56:19.410Z
Answers.UserDisplayName: gringer
Body: <p>I have a set of eight gene clusters which I obtained from clustering a network. However, I had to update the genes in the network at a later stage which lead to certain deletions (genes not present in the new gene list). I did the clustering again and this time there were a total of 9 clusters. Is there some way in which I could compare the earlier eight clusters with the new nine ones to effectively say that "clustering has happened along the same lines". It would have been easier to do an eight to eight comparison checking from the largest to the smallest cluster. However, since I have nine clusters now, I am kinda in a fix as how to compare.
  I used the same clustering algorithm to cluster the network in both the cases</p>
  
Tags: <networks><clustering>
Title: Comparing between different set of clusters produced from the same network
ThreadText: # Comparing between different set of clusters produced from the same network
  
  (Asked by: username_0 on 2018-10-25)
  
  I have a set of eight gene clusters which I obtained from clustering a network. However, I had to update the genes in the network at a later stage which lead to certain deletions (genes not present in the new gene list). I did the clustering again and this time there were a total of 9 clusters. Is there some way in which I could compare the earlier eight clusters with the new nine ones to effectively say that "clustering has happened along the same lines". It would have been easier to do an eight to eight comparison checking from the largest to the smallest cluster. However, since I have nine clusters now, I am kinda in a fix as how to compare.
  I used the same clustering algorithm to cluster the network in both the cases
  
  **Tags:** networks, clustering
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-07-08. Score: 0
  
  *Answer from @llrs, converted from comment:*
  
  Perhaps I'm not understanding correctly what you are doing. But these [stability tests](https://stats.stackexchange.com/a/11702/105234) are used when the number of clusters is unknown, so you test the resolution, or other metrics for a range of numbers of clusters. Then you choose the best one (either the one that is better by the score, or the one that increasing the number of clusters don't improve your metric much more)
  
  
  ---
  
  ### Answer by username_1 on 2021-08-07. Score: -1
  
  If you have both cluster assignments, you can check for consistency of assignment by looking at pairwise counts using `table` in R:
  
  ```
  cons.mat <- table(clusters.1, clusters.2)
  
  ```
  
  The result of this will be a matrix showing the number of cells / samples that have the observed cluster assignments via each method. If the two cluster assignments are similar, then samples from one cluster via one method should be mostly assigned to one cluster in the other method. You can check this by comparing table cell values with their row/column sum:
  
  ```
  ## show consistency along the first dimension
  apply(cons.mat, 1, function(x){max(x / sum(x))})
  ## show consistency along the second dimension
  apply(cons.mat, 2, function(x){max(x / sum(x))})
  
  ```
  
  
  ---
  
  