krackhardt_datasets
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
krackhardt_datasets [2019/12/04 08:47] – [Using cutree] hkimscil | krackhardt_datasets [2019/12/13 09:47] – hkimscil | ||
---|---|---|---|
Line 65: | Line 65: | ||
< | < | ||
- | krack_friend <- delete.edges(krack_full, | + | krack_friend <- delete_edges(krack_full, |
summary(krack_friend) | summary(krack_friend) | ||
krack_friend[] | krack_friend[] | ||
- | krack_advice <- delete.edges(krack_full, | + | krack_advice <- delete_edges(krack_full, |
summary(krack_advice) | summary(krack_advice) | ||
krack_advice[] | krack_advice[] | ||
- | krack_reports_to <- delete.edges(krack_full, | + | krack_reports_to <- delete_edges(krack_full, |
summary(krack_reports_to) | summary(krack_reports_to) | ||
krack_reports_to[] | krack_reports_to[] | ||
Line 1654: | Line 1654: | ||
</ | </ | ||
{{: | {{: | ||
+ | |||
+ | ===== decision on # of clusters | ||
< | < | ||
# From a visual inspection of the correlation matrix, we can | # From a visual inspection of the correlation matrix, we can | ||
# decide on the proper number of clusters in this network. | # decide on the proper number of clusters in this network. | ||
- | # For this network, we'll use 4. (Note that the 1-cluster | + | # For this network, we'll use 6. (Note that the 1-cluster |
# solution doesn' | # solution doesn' | ||
# with the observed correlation matrix is undefined.) | # with the observed correlation matrix is undefined.) | ||
num_clusters = 4 | num_clusters = 4 | ||
- | clusters <- cutree(krack_reports_to_advice_hclust, k = num_clusters) | + | clusters <- cutree(krack_friend_advice_hclust, k = num_clusters) |
clusters | clusters | ||
- | + | ||
- | cluster_cor_mat <- clusterCorr(krack_reports_to_advice_cors, | + | cluster_cor_mat <- clusterCorr(krack_friend_advice_cors, clusters) |
- | | + | round(cluster_cor_mat,2) |
- | cluster_cor_mat | + | |
- | + | ||
# Let's look at the correlation between this cluster configuration | # Let's look at the correlation between this cluster configuration | ||
# and the observed correlation matrix. This should match the | # and the observed correlation matrix. This should match the | ||
# corresponding value from clustered_observed_cors above. | # corresponding value from clustered_observed_cors above. | ||
- | gcor(cluster_cor_mat, | + | gcor(cluster_cor_mat, |
- | + | ||
+ | </ | ||
+ | |||
+ | < | ||
##################### | ##################### | ||
# Questions: | # Questions: | ||
Line 1680: | Line 1684: | ||
##################### | ##################### | ||
| | ||
- | |||
- | |||
### NOTE ON DEDUCTIVE CLUSTERING | ### NOTE ON DEDUCTIVE CLUSTERING | ||
Line 1698: | Line 1700: | ||
# You could then examine the fitness of this cluster configuration | # You could then examine the fitness of this cluster configuration | ||
# as follows: | # as follows: | ||
- | deductive_cluster_cor_mat <- generate_cluster_cor_mat( | + | deductive_cluster_cor_mat <- generate_cluster_cor_mat(krack_friend_advice_cors, deductive_clusters) |
- | krack_reports_to_advice_cors, | + | |
- | | + | |
deductive_cluster_cor_mat | deductive_cluster_cor_mat | ||
- | gcor(deductive_cluster_cor_mat, | + | gcor(deductive_cluster_cor_mat, |
### END NOTE ON DEDUCTIVE CLUSTERING | ### END NOTE ON DEDUCTIVE CLUSTERING | ||
Line 1710: | Line 1710: | ||
# networks. | # networks. | ||
- | # Task valued | + | # Friendship |
- | task_mean | + | friend_mean |
- | task_mean | + | friend_mean |
- | task_valued_blockmodel | + | friend_valued_blockmodel |
- | task_valued_blockmodel | + | friend_valued_blockmodel |
- | # Task binary | + | # friend |
- | task_density | + | friend_density |
- | task_density | + | friend_density |
- | task_binary_blockmodel | + | friend_binary_blockmodel |
- | task_binary_blockmodel | + | friend_binary_blockmodel |
- | # Social | + | # advice |
advice_mean <- mean(as.matrix(krack_advice_matrix_row_to_col)) | advice_mean <- mean(as.matrix(krack_advice_matrix_row_to_col)) | ||
advice_mean | advice_mean | ||
Line 1732: | Line 1732: | ||
advice_valued_blockmodel | advice_valued_blockmodel | ||
- | # Social | + | # advice |
advice_density <- graph.density(krack_advice) | advice_density <- graph.density(krack_advice) | ||
advice_density | advice_density | ||
Line 1738: | Line 1738: | ||
advice_binary_blockmodel <- blockmodel(as.matrix(krack_advice_matrix_row_to_col_bin), | advice_binary_blockmodel <- blockmodel(as.matrix(krack_advice_matrix_row_to_col_bin), | ||
advice_binary_blockmodel | advice_binary_blockmodel | ||
+ | |||
+ | |||
# We can also permute the network to examine the within- and | # We can also permute the network to examine the within- and | ||
Line 1744: | Line 1746: | ||
cluster_cor_mat_per <- permute_matrix(clusters, | cluster_cor_mat_per <- permute_matrix(clusters, | ||
cluster_cor_mat_per | cluster_cor_mat_per | ||
+ | </ | ||
+ | < | ||
##################### | ##################### | ||
# Questions: | # Questions: |
krackhardt_datasets.txt · Last modified: 2019/12/13 14:11 by hkimscil