krackhardt_datasets
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
krackhardt_datasets [2019/12/04 08:37] – [correlation matrix out of the combined matrix (friend and advice)] hkimscil | krackhardt_datasets [2019/12/04 08:47] – [Using cutree] hkimscil | ||
---|---|---|---|
Line 1374: | Line 1374: | ||
# different numbers of clusters and assign vertices to clusters | # different numbers of clusters and assign vertices to clusters | ||
# as appropriate. For example: | # as appropriate. For example: | ||
- | cutree(krack_reports_to_advice_hclust, k=2) | + | cutree(krack_friend_advice_hclust, k=2) |
- | + | </ | |
+ | |||
+ | < | ||
+ | > cutree(krack_friend_advice_hclust, | ||
+ | | ||
+ | | ||
+ | > | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | < | ||
# Now we'll try to figure out the number of clusters that best | # Now we'll try to figure out the number of clusters that best | ||
# describes the underlying data. To do this, we'll loop through | # describes the underlying data. To do this, we'll loop through | ||
Line 1399: | Line 1409: | ||
# set a variable for our number of vertices. | # set a variable for our number of vertices. | ||
clustered_observed_cors = vector() | clustered_observed_cors = vector() | ||
- | num_vertices = length(V(krack_reports_to)) | + | num_vertices = length(V(krack_advice)) |
- | + | ||
# Next, we loop through the different possible cluster | # Next, we loop through the different possible cluster | ||
# configurations, | # configurations, | ||
Line 1407: | Line 1418: | ||
# pdf(" | # pdf(" | ||
- | clustered_observed_cors < | + | clustered_observed_cors < |
clustered_observed_cors | clustered_observed_cors | ||
plot(clustered_observed_cors$correlations) | plot(clustered_observed_cors$correlations) | ||
# dev.off() | # dev.off() | ||
- | + | ||
clustered_observed_cors$correlations | clustered_observed_cors$correlations | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | > clustered_observed_cors < | ||
+ | Warning message: | ||
+ | In cor(as.vector(d[g1[i], | ||
+ | 표준편차가 0입니다 | ||
+ | > clustered_observed_cors | ||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] NA | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.4896211 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.5944114 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.6398013 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.6538231 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.6723019 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.7019599 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.727137 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.7743714 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.7919439 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.8093965 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.8445199 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.8700886 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.8844067 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.9115517 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.9403353 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.9502702 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.9633198 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.9762881 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 0.9895545 | ||
+ | |||
+ | $label | ||
+ | [1] " | ||
+ | |||
+ | $clusters | ||
+ | | ||
+ | | ||
+ | |||
+ | $correlation | ||
+ | [1] 1 | ||
+ | |||
+ | $correlations | ||
+ | | ||
+ | [17] 0.9502702 0.9633198 0.9762881 0.9895545 1.0000000 | ||
+ | |||
+ | > plot(clustered_observed_cors$correlations) | ||
+ | > | ||
+ | > clustered_observed_cors$correlations | ||
+ | | ||
+ | [17] 0.9502702 0.9633198 0.9762881 0.9895545 1.0000000 | ||
+ | > | ||
+ | </ | ||
+ | {{: | ||
+ | |||
+ | < | ||
# 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. |
krackhardt_datasets.txt · Last modified: 2019/12/13 14:11 by hkimscil