Start from clean slate and free up memory
Load R packages
## [1] 2185
## [1] 275
## [1] 1690 650 1629 3967 3520 3489 3248 1494 3572 4469
Convert network
object into edgelist
Check for attributes
## [1] "bipartite" "directed" "hyper" "loops" "mnext" "multiple"
## [7] "n"
## [1] 2186
## [1] "annualSales" "birthYear" "budget"
## [4] "city" "conferences" "currentEmployees"
## [7] "dbName" "deathType" "deathYear"
## [10] "degreeCentrality" "dues" "dunsno"
## [13] "eigenCentrality" "email" "employees"
## [16] "foundingYear" "galeName" "googleWebAddress"
## [19] "googlName" "lexNexName" "lineOfBusiness"
## [22] "localGroups" "locationType" "matrixName"
## [25] "members" "na" "naics1"
## [28] "naics10" "naics11" "naics12"
## [31] "naics2" "naics3" "naics4"
## [34] "naics5" "naics6" "naics7"
## [37] "naics8" "naics9" "nationalGroups"
## [40] "orgID" "ownership" "ownsOrRents"
## [43] "plantSize" "products" "properName"
## [46] "refUSAName" "regionalGroups" "salesAll"
## [49] "salesIndividual" "sic1" "sic10"
## [52] "sic11" "sic12" "sic13"
## [55] "sic2" "sic3" "sic4"
## [58] "sic5" "sic6" "sic7"
## [61] "sic8" "sic9" "staff"
## [64] "state" "stateGroups" "subjCategory"
## [67] "subjDescription" "subsidized" "vertex.names"
## [70] "webaddress" "zipcode"
## [1] "case1" "case2" "case3" "case4" "case5"
## [6] "case6" "case7" "case8" "case9" "caseName1"
## [11] "caseName2" "caseName3" "caseName4" "caseName5" "caseName6"
## [16] "caseName7" "caseName8" "caseName9" "na"
## [1] 4006 4006 4006 4536 4536 4491 6318 6318 6377 8230 8698
## [12] 8703 9142 6977 9142 9226 9226 9226 9226 9226 11571 7437
## [23] 7930 7930 7930 9226 9226 9376 9226 9226 9226 9226 8230
## [34] 8230 9030 9301 9301 4006 4006 4006 4006 9158 6977 9158
## [45] 9158 9142 6977 9142 4006 4006 4491 4491 6318 6318 6377
## [56] 7930 7930 7930 7930 8230 9158 6977 4006 8230 4491 8230
## [67] 8230 8230 8698 11488 9189 11488 4491 9376 7930 6377 7930
## [78] 7930 7930 9376 8698 9376 9189 9189 9189 9189 9189 9189
## [89] 9189 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [100] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [111] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [122] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [133] 9376 9376 6977 9376 8230 6318 6318 8230 7930 7930 7930
## [144] 7930 8230 9158 11689 9158 9158 9158 9158 6318 6318 8230
## [155] 9158 9376 9376 8230 8698 9376 9189 11670 11670 9189 9189
## [166] 9189 9189 9189 9189 9376 9376 9376 9376 9376 9376 9376
## [177] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [188] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [199] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [210] 9376 9376 9376 9376 9376 6977 9376 9505 9505 9505 9505
## [221] 9505 9505 9505 9505 9505 11488 9454 9454 9454 8537 11624
## [232] 11624 11624 11612 11488 9142 9142 9142 11624 9226 9226 9226
## [243] 11624 11488 9226 11612 6318 8230 7930 7930 7930 7930 8230
## [254] 9158 9158 9158 9158 9376 9376 9376 9376 9376 9376 9158
## [265] 9158 9158 6369 6369 6369 6369 6369 8698 6369 6369 6369
## [276] 6369 9158 6369 6369 6369 8698 6369 6369 8698 6369 8698
## [287] 8698 9376 9376 8230 9376 9376 9376 9376 9376 9376 9376
## [298] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [309] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [320] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [331] 9376 9376 9376 9376 9376 9376 9390 9390 9390 9390 9390
## [342] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [353] 9376 9390 9376 9602 7922 7930 7930 7930 9376 9376 9376
## [364] 9376 9376 9376 7930 7930 9158 7930 9376 9376 9376 9376
## [375] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [386] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [397] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [408] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [419] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [430] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [441] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [452] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [463] 9376 9376 9158 9158 9158 9505 9505 9505 7930 7930 9602
## [474] 9602 9602 9142 9142 9142 9376 9602 7930 9376 9376 11624
## [485] 11624 8230 11624 9390 9390 9390 9390 9390 11624 9390 8230
## [496] 9602 9602 9602 9030 11624 9390 11624 8230 11624 11612 8698
## [507] 9376 11624 11624 8230 11624 11612 8230 11571 9602 9158 11612
## [518] 9602 11488 11488 11488 11488 11488 11488 9158 11488 9390 9390
## [529] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [540] 9390 9390 9390 9390 9165 9165 11612 9767 9767 9767 9767
## [551] 9767 9767 9767 9767 9767 9767 11612 9767 9158 9158 9602
## [562] 11612 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [573] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [584] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [595] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [606] 9376 9376 8703 9376 9186 9186 9454 9454 9454 9454 9158
## [617] 9189 9189 9189 9189 9189 9189 9142 9142 9142 9226 9226
## [628] 9226 9226 9142 9226 9226 9226 9226 9158 9158 9158 11670
## [639] 9158 11670 9158 9158 9158 9158 9158 11670 9158 9158 9158
## [650] 9158 9158 9158 9158 9158 9158 9158 11624 11624 9165 9165
## [661] 9165 9165 9165 9165 9165 9165 9165 9165 9390 9390 9390
## [672] 9390 9165 9390 9186 9189 9189 9189 9189 9189 11488 9189
## [683] 9189 9189 9189 9189 9189 9189 9189 9189 9189 9226 9226
## [694] 9226 9226 9226 9226 9226 9226 9226 9226 9226 9226 9226
## [705] 9226 9226 9226 9301 9301 9376 9376 9376 9376 9376 9376
## [716] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [727] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [738] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [749] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [760] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [771] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [782] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [793] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [804] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [815] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [826] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [837] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [848] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [859] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [870] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [881] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [892] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [903] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [914] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [925] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [936] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [947] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [958] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [969] 9376 9376 9376 9376 9376 11612 9376 9376 9376 9376 9376
## [980] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [991] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1002] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1013] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1024] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1035] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1046] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1057] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1068] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1079] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1090] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1101] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1112] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1123] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1134] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1145] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1156] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1167] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1178] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1189] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1200] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1211] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1222] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1233] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1244] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1255] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1266] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1277] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1288] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1299] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1310] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1321] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1332] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1343] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1354] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1365] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1376] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1387] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1398] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1409] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1420] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1431] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1442] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1453] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1464] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1475] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1486] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1497] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1508] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1519] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1530] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1541] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1552] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1563] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1574] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1585] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1596] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1607] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1618] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1629] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1640] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1651] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1662] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1673] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1684] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1695] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1706] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1717] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1728] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1739] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376
## [1750] 9376 9376 9376 9376 9376 9376 9376 9376 9376 9376 9390
## [1761] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1772] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1783] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1794] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1805] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1816] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1827] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1838] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1849] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1860] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1871] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1882] 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390 9390
## [1893] 9390 9390 9390 9390 9390 9390 11624 9390 9390 9390 9390
## [1904] 9390 9390 9390 9454 9454 9454 9454 9454 9454 9454 9454
## [1915] 9454 9505 9505 9505 9602 9602 9602 9602 9602 9602 9602
## [1926] 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767
## [1937] 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767
## [1948] 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767
## [1959] 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767
## [1970] 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767 9767
## [1981] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [1992] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2003] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2014] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2025] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2036] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2047] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2058] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2069] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2080] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2091] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2102] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2113] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2124] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2135] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2146] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2157] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2168] 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488 11488
## [2179] 11488 11488 11488 11488 11488 11488 11488
Retrieve all node attributes and store in data.frame
attributes.list <-list.vertex.attributes(net)
attributes <- data.frame(sapply(attributes.list, function(x) get.vertex.attribute(net, x)))
attributes$node_id <- network.vertex.names(net)
Retrieve all edge attributes and store in data.frame (these are essentially multiple edgelists)
# Get edge attributes (list of amicus briefs SIGs signed together)
edgeatttr.list <- list.edge.attributes(net)
edge.attributes <- as.matrix(sapply(edgeatttr.list, function(x) get.edge.attribute(net,x)))
# Add edge attributes to edge.list
complete.matrix <- data.frame(cbind(mat, edge.attributes))
colnames(complete.matrix)[1:2] <- c("source", "target")
# Create edge weight = count of number of amicus briefs co-signed for edge dyad
complete.matrix$edge_value <- rowSums(sapply(colnames(complete.matrix[grep("(case)[[:digit:]]", names(complete.matrix))]), function(x) ifelse(is.na(complete.matrix[[x]]), 0, 1)))
valued.mat <- complete.matrix[, c(1,2,ncol(complete.matrix))]
valued.mat[1:10,]
source | target | edge_value |
---|---|---|
1 | 6 | 3 |
1 | 7 | 6 |
1 | 8 | 5 |
1 | 9 | 6 |
1 | 10 | 6 |
1 | 12 | 5 |
1 | 18 | 2 |
1 | 19 | 1 |
1 | 27 | 2 |
1 | 47 | 1 |
annualSales | birthYear | budget | city | conferences | currentEmployees | dbName | deathType | deathYear | degreeCentrality | dues | dunsno | eigenCentrality | employees | foundingYear | galeName | googleWebAddress | googlName | lexNexName | lineOfBusiness | localGroups | locationType | matrixName | members | na | naics1 | naics10 | naics11 | naics12 | naics2 | naics3 | naics4 | naics5 | naics6 | naics7 | naics8 | naics9 | nationalGroups | orgID | ownership | ownsOrRents | plantSize | products | properName | refUSAName | regionalGroups | salesAll | salesIndividual | sic1 | sic10 | sic11 | sic12 | sic13 | sic2 | sic3 | sic4 | sic5 | sic6 | sic7 | sic8 | sic9 | staff | state | stateGroups | subjCategory | subjDescription | subsidized | vertex.names | webaddress | zipcode | node_id | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NA | 1967 | 7.4e+07 | New York | annual symposium | 100 | Environmental Defense Inc | NA | NA | 15 | individual, $25-$5,000 annual. | 07-982-2748 | 0.0912861889789961 | members@environmentaldefense.org | 275 | 1967 | Environmental Defense | NA | NA | NA | Civic/Social Association Business Consulting Services | NA | HEADQUARTERS | ENVIRONMENTAL DEFENSE | 500000 | FALSE | 813410 | NA | NA | NA | 541618 | NA | NA | NA | NA | NA | NA | NA | NA | 1690 | PRIVATE | RENTS | 33000 | CONSULTING SVC: Business, NEC MEMBERSHIP ORGS, CIVIC, SOCIAL & FRATERNAL: Protection | ENVIRONMENTAL DEFENSE | NA | 8 | 122811000 | 122811000 | 86419903 | NA | NA | NA | NA | 8748 | 8399 | 8699 | NA | NA | NA | NA | NA | 300 | NY | 19 | Environmental and Agricultural Organizations | Environment; Environmental Education; Environmental Law; Law; Pollution Control | NON-SUBSIDIARY | 1690 | http://www.environmentaldefense.org | 10010 | 1690 |
NA | 1866 | NA | La Palma | NA | 80 | Atlantic Richfield Co Inc | NA | NA | 5 | NA | 04-542-6723 | 8.57065140860854e-17 | NA | NA | 1870 | NA | NA | NA | NA | Professional Organization | NA | HEADQUARTERS | ATLANTIC RICHFIELD | NA | FALSE | 813920 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 650 | PRIVATE | OWNS | NA | ORGANIZATIONS: Professional | ATLANTIC RICHFIELD CO | NA | NA | 9400000 | NA | 8621 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | CA | NA | NA | NA | NON-SUBSIDIARY | 650 | www.richfieldco.com | 90623-253190623-2531 | 650 |
NA | 1933 | 5e+07 | Washington | annual convention (exhibits) - every June. | 197 | Edison Electric Institute Inc | NA | NA | 12 | associate (with less than $50 million annual revenues), $4,000 annual; associate (with more than $50 million annual revenues), $6,000 annual | 06-496-8670 | 2.6936332998484e-16 | bfarrell@eei.org | 197 | 1933 | Edison Electric Institute (EEI) | NA | NA | NA | Business Association | NA | SINGLE LOCATION | EDISON ELECTRIC INSTITUTE | 200 | FALSE | 813910 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 1629 | PRIVATE | RENTS | 115000 | ASSOCIATIONS: Trade | EDISON ELECTRIC INSTITUTE | NA | NA | 20700000 | 20700000 | 8611 | NA | NA | NA | NA | 4911 | 86110100 | NA | NA | NA | NA | NA | NA | 200 | DC | NA | Trade, Business, and Commercial Organizations | Utilities | NON-SUBSIDIARY | 1629 | http://www.eei.org | 20004-2696 | 1629 |
NA | 1973 | 5e+06 | Sacramento | NA | 55 | PACIFIC LEGAL FOUNDATION | NA | NA | 5 | NA | 07-153-9878 | 1.10194089539253e-16 | rlr@pacificlegal.org | 55 | 1973 | Pacific Legal Foundation (PLF) | NA | NA | NA | Legal Services Office | NA | HEADQUARTERS | PACIFIC LEGAL FOUNDATION | NA | FALSE | 541110 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 3967 | PRIVATE | NA | 14000 | LEGAL OFFICES & SVCS | PACIFIC LEGAL FOUNDATION | NA | NA | 7400000 | 7400000 | 8641 | NA | NA | NA | NA | 8111 | 8111 | NA | NA | NA | NA | NA | NA | 54 | CA | NA | Legal, Governmental, Public Administration, and Military Organizations | Public Interest Law | NON-SUBSIDIARY | 3967 | http://www.pacificlegal.org | 95834-2918 | 3967 |
NA | 1942 | 8.7e+07 | Arlington | annual meeting (exhibits) | 497 | NATIONAL RURAL ELECTRIC COOPERATIVE ASSOCIATION | NA | NA | 2 | silver (associate), $1,250 annual; gold (associate), $6,500 annual; platinum (associate), $12,000 annual | 04-549-7427 | 4.28532570430427e-17 | patrick.lavigne@nreca.coop | 885 | 1942 | National Rural Electric Cooperative Association (NRECA) | NA | NA | NA | Business Association | NA | HEADQUARTERS | NATIONAL RURAL ELECTRIC COOPERATIVE ASSOCIATION | 1000 | FALSE | 813910 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 3520 | PRIVATE | OWNS | 248000 | ASSOCIATIONS: Trade | NATIONAL RURAL ELECTRIC COOPERATIVE ASSOCIATION | NA | 10 | 162671000 | 162671000 | 8611 | NA | NA | NA | NA | 4911 | 86110100 | NA | NA | NA | NA | NA | NA | 650 | VA | NA | Trade, Business, and Commercial Organizations | Electrical | NON-SUBSIDIARY | 3520 | http://www.nreca.org | 22203-1867 | 3520 |
NA | 1919 | 1.7e+07 | Washington | annual dinner, for fundraising | 85 | National Parks & Conservation Association | NA | NA | 11 | individual, $25 annual | 07-484-5157 | 0.0511892566815803 | npca@npca.org | 102 | 1919 | National Parks Conservation Association (NPCA) | NA | NA | NA | Civic/Social Association | NA | HEADQUARTERS | NATIONAL PARKS CONSERVATION ASSOCIATION | 300000 | FALSE | 813410 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 3489 | PRIVATE | RENTS | 2100 | MEMBERSHIP ORGS, CIVIC, SOCIAL & FRATERNAL: Protection | NATIONAL PARKS CONSERVATION ASSOCIATION | NA | 10 | 60423400 | 60423400 | 8699 | NA | NA | NA | NA | 9512 | 86419903 | NA | NA | NA | NA | NA | NA | 110 | DC | NA | Legal, Governmental, Public Administration, and Military Organizations | Parks and Recreation | NON-SUBSIDIARY | 3489 | http://www.npca.org | 20036-1628 | 3489 |
Breiger & Pattison (1986), in their discussion of local role analysis, use a subset of data on the social relations among Renaissance Florentine families (person aggregates) collected by John Padgett in 1994 from historical documents. The two relations are business ties (flobusiness - specifically, recorded financial ties such as loans, credits and joint partnerships) and marriage alliances (flomarriage).
As Breiger & Pattison point out, the original data are symmetrically coded. This is acceptable perhaps for marital ties, but is unfortunate for the financial ties (which are almost certainly directed). To remedy this, the financial ties can be recoded as directed relations using some external measure of power - for instance, a measure of wealth. Both networks provide vertex information on (1) wealth each family’s net wealth in 1427 (in thousands of lira); (2) priorates the number of priorates (seats on the civic council) held between 1282- 1344; and (3) totalties the total number of business or marriage ties in the total dataset of 116 families (see Breiger & Pattison (1986), p 239).
Substantively, the data include families who were locked in a struggle for political control of the city of Florence in around 1430. Two factions were dominant in this struggle: one revolved around the infamous Medicis (9), the other around the powerful Strozzis (15).
library(tidyverse)
# if you're interested in exploring the complete dataset, check it here
florentine.families <- rio::import("./data/florentine_families_relations_full.xlsx")
# Group by family surname and sum over ties
flo.marriage.fam <- florentine.families %>% filter(Relationship_type=="Marriage") %>% group_by(sender=tolower(Actor1surname), receiver=tolower(Actor2surname)) %>% summarise(Tie_coding= n())
flo.g <- igraph::graph_from_data_frame(flo.marriage.fam)
igraph::V(flo.g)$color <- as.factor(igraph::V(flo.g)$name)
# Plot
igraph::plot.igraph(flo.g, vertex.label=NA, vertex.size = 5, layout=igraph::layout.fruchterman.reingold,
edge.arrow.size=0.2)
# We'll analyze a subset of this data
data(florentine)
# Bring attribute data for subset of the network
flo.attr <- rio::import("./data/florentine_attributes_subset.xlsx")
g <- snatools::as_igraph(flomarriage)
igraph::V(g)$faction <- as.character(flo.attr$faction[order(flo.attr$family)])
# Color the party factions
igraph::V(g)$color <- igraph::V(g)$faction
igraph::V(g)$color <- gsub("medici","gold",igraph::V(g)$color) # Medici are gold
igraph::V(g)$color <- gsub("oligarchs","blue",igraph::V(g)$color) # Oligarchs are blue
igraph::V(g)$color <- gsub("split","gray70",igraph::V(g)$color) # Split affiliat ion is gray
igraph::V(g)$color
## [1] "gold" "gray70" "gray70" "blue" "blue" "gold" "blue"
## [8] "blue" "gold" "gold" "blue" "gold" "gold" "gray70"
## [15] "blue" "gold"
g %>%
igraph::articulation_points() %>%
as.list() %>%
names() %>%
as.data.frame() %>%
`colnames<-`("Cut Points")
Cut Points |
---|
Albizzi |
Guadagni |
Medici |
Salviati |
We will look at the neighbourhood of a node, two or three steps out. Below, we generate a function to count the number of neighbours at two and three steps out:
# Function for 2-step reach
reach2<-function(x){
r=vector(length=igraph::vcount(x))
for (i in 1:igraph::vcount(x)){
n=igraph::neighborhood(x,2,nodes=i)
ni=unlist(n)
l=length(ni)
r[i]=(l)}
r}
# Function for 3-step reach
reach3<-function(x){
r=vector(length=igraph::vcount(x))
for (i in 1:igraph::vcount(x)){
n=igraph::neighborhood(x,3,nodes=i)
ni=unlist(n)
l=length(ni)
r[i]=(l)}
r}
Reach_2 <- reach2(g)
Reach_3 <- reach3(g)
To see how many weak ties each node has, we first need to calculate how many nodes are in each node’s neighborhood at two steps out (reach2
). Then, we need only subtract the number of nodes that are ajacent to the node (`degree).
## Acciaiuoli Albizzi Barbadori Bischeri Castellani
## 6 8 8 6 4
## Ginori Guadagni Lamberteschi Medici Pazzi
## 3 6 4 6 2
## Peruzzi Pucci Ridolfi Salviati Strozzi
## 4 1 9 6 5
## Tornabuoni
## 8
Burt’s (1992) measures of structural holes are supported by iGraph and ego network variants of these measures are supported by egonet
; this package is compatable with the sna
package.
However, egonet
has been removed from CRAN. So, we install it locally from an older version.
A small tool for Social Network Analysis, dealing with ego-centric network measures, including Burt’s effective size and aggregate constraint and an import code suitable for a large number of adjacency matrices.
The Egonet package is also available as free web application on http://www.egonet.associazionerospo.org (and an example of output can be seen here: http://www.egonet.associazionerospo.org/egonetdata/EgonetOutput.htm)
year <- seq(2012, 2013, by=1)
for (y in year){
edgelist.name <- paste("matrix", y, sep=".")
attr.name <- paste("attr", y, sep=".")
net.name <- paste("net", y, sep=".")
edgelist.data <- as.matrix(table(rio::import(paste("./data/edgelist", y, ".dta", sep=""))))
edgelist.data <- edgelist.data %*% t(edgelist.data)
diag(edgelist.data) <- 0
edgelist.data[edgelist.data > 1] <- 1
attr.data <- rio::import(paste("./data/attr", y, ".dta", sep=""), convert.factors=F)
network <- network::network(edgelist.data, directed=FALSE,ignore.eval=FALSE,names.eval='grants')
#edgelist.data <- edgelist.data[-isolates(network), -isolates(network)] # remove isolates
#attr.data <- attr.data[-]
assign(edgelist.name, value = edgelist.data)
assign(attr.name, value=attr.data)
assign(net.name, value=network)
rm(edgelist.data, attr.data, attr.name, edgelist.name, network, net.name)
}
# Remove isolates
mat12 <- matrix.2012[-sna::isolates(net.2012), -sna::isolates(net.2012)]
attributes.12 <- attr.2012[-c(sna::isolates(net.2012)),]
mat13 <- matrix.2013[-sna::isolates(net.2013), -sna::isolates(net.2013)]
attributes.13 <- attr.2013[-c(sna::isolates(net.2013)),]
# Extract ego-networks and calculate measures
ego.nets.12 <- sna::ego.extract(mat12, neighborhood="combined")
results.12 <- data.frame(piid = attributes.12$piid, gender = attributes.12$gender, ego=NA,
effsize = NA, constraint = NA, efficiency = NA, hierarchy = NA, size = NA)
for (i in 1:length(ego.nets.12)){
ego <- names(ego.nets.12[i])
ego.net <- ego.nets.12[i][[1]]
dimnames(ego.net) <- NULL
colnames(ego.net) <- rownames(ego.net) <- c("EGO", 2:ncol(ego.net))
# Get structural holes measures from egonet package
sh <- egonet::index.egonet(ego.net)
results.12$size[i] <- nrow(ego.net)-1
results.12$ego[i] <- ego
results.12$effsize[i] <- sh[1]
results.12$constraint[i] <- sh[2]
results.12$efficiency[i] <- sh[5]
results.12$hierarchy[i] <- sh[6]
}
# Store average SH mesaures by some attribute
effsize.g <- results.12 %>% group_by(gender) %>% summarise(mean = mean(effsize))
constraint.g <- results.12 %>% group_by(gender) %>% summarise(mean = mean(constraint))
efficiency.g <- results.12 %>% group_by(gender) %>% summarise(mean = mean(efficiency))
hierarchy.g <- results.12 %>% group_by(gender) %>% summarise(mean = mean(hierarchy))
size.g <- results.12 %>% group_by(gender) %>% summarise(mean = mean(size))
# Push the results
table(results.12$size[results.12$gender == "Female"])
##
## 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 23 24
## 24 8 5 5 12 2 2 6 2 1 1 1 1 1 1 2 1 4 1 1 1 1
##
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 24 28 30 38
## 47 29 20 21 8 7 6 5 6 5 4 4 7 5 6 3 4 4 1 2 2 1 1 1
The brokerage measure included in the sna
package (hint: it needs a network
object) builds on past work on borkerage (Marsden 1982), but is a more explicitly group oriented measure. Unlike Burt’s (1992) measure, the Gould-Fernandez measure requires specifying a group variable based on an attribute. We will use race in the example below.
**Brokerage Roles*: a group-based concept
w_I
: Coordinator, mediates Within Group Contact (\(A \rightarrow A \rightarrow A\))
w_O
: Itinerant Broker/Consultant, mediates contact between individuals in a group to which the actor does not belong (\(A \rightarrow B \rightarrow A\))b_{IO}
: Representative, mediates incoming contact from out-group members (\(A \rightarrow B \rightarrow B\))b_{OI}
: Gatekeeper, mediates outgoing contact from in-group members, (\(A \rightarrow A \rightarrow B\))b_O
: Liason Role, mediates contact between individuals of two differnt groups, neither of which the actor belongs, (\(A \rightarrow B \rightarrow C\))t
: Total or Cumulative Brokerage (total number of time a node fills any of the above roles)If you run the function without $raw.nli
appended to the end, you will see that it produces fourteen different forms of output. It is worth mentioning that you can also produce a normalized score that will give the magnitude of the differences between nodes, rather than the raw number of times. Use this approach if you prefer to simplify the table by displaying how the nodes differ by order of magnitude.
The brokerage function does this by providing normalized output that is scaled on the z distribution, referred to “z scores”. Z scores are calculated by comparing each number to the average for the distribution and dividing by the standard deviation.
\[z = \frac{x - \bar{x}}{s}\] In the results you’ll encounter both positive and negative valyes (the scale is cetered at 0). Consider that anything grater than 1.96 or less than -1.96 (2 sd away from the mean) is significantly different from the “typical” at p=0.05 level of significance. This is helpful to identify the nodes that stand out by being statistically significantly greater/less than the average for the network.
To produce normalized scores add z.nli
to the function. Use round()
to reduce number of digits.
Type ?brokerage
for more information
Using faculty grant application data
** Using Add Health data **
# Import data, create network object
AHS.Nodes <- load("./data/AHS_nodes.Rda")
AHS.Edges <- load("./data/AHS_edges.Rda")
ahs.net <- network::network(AHS_Edges, matrix.type = "edgelist")
network::set.vertex.attribute(ahs.net, "Race", AHS_Nodes$race5)
# Calculate roles & position counts
AHS_Brokerage <- sna::brokerage(ahs.net, "Race")
# Raw scores
head(AHS_Brokerage$raw.nli)
## w_I w_O b_IO b_OI b_O t
## 1 1 9 5 4 19 38
## 2 0 0 0 0 0 0
## 3 0 8 0 0 18 26
## 4 0 0 2 0 1 3
## 5 0 0 0 2 0 2
## 6 0 0 0 0 13 13
## w_I w_O b_IO b_OI b_O t
## 1 Inf Inf Inf Inf Inf 1.02
## 2 NA NA NA NA NA NA
## 3 NA NA NA NA NA NA
## 4 NA NA NA NA NA NA
## 5 NA NA NA NA NA NA
## 6 NA NA NA NA NA NA
\[ \textbf{E-I Index} = \frac{E - I}{E + I} \] E-I Index was proposed by Krackhard and Stern (1988) to capture relative prevalence of between- and within-group ties. From that perspective it can be interpreted as a measure of network segregation.
The E-I Index is not common to many R packages, and it is not as simple as it seems to program. To make your life simpler, it is necessary to first install a package called isnar
, written and maintained by Michal Bojanowski as a supplement to igraph
. It is only available through Git Hub, as it’s an R package in development.
The generic method for using the E-I Index in isnar is ei(g, "attribute")
, where g
is an igraph object, with a qualitative attribute (attribute
) assigned to each of the vertices.
# Convert our Add Health network object to igraph
ahs.g <- snatools::as_igraph(ahs.net)
# Run E-I Index
isnar::ei(ahs.g, "Race")
## [1] -0.2586946
The index of qualitative variation (IQV) is a measure of variation among the categories of a qualitative variable. It is calculated as
\[ 1 - \sum p_2 * (\frac{k}{k-1})\] ,
where \(p\) is the proportion in each category, and K is the number of categories. The variable ranges from 0 to 1, where 0 represents a completely homogeneous group, and 1 represents a group with equal parts in each category.
The function below also returns Blau’s index. It takes as input a matrix and an attribute vector.
get_iqvs <- function(matrix, attribute) {
mat <- matrix
attr_levels = attribute
num_levels = length(unique(attr_levels))
iqvs = rep(0, nrow(mat))
blau_index = rep(0, nrow(mat))
for (ego in 1:nrow(mat)) {
# initialize actor-specific variables
alter_attr_counts = rep(0, num_levels)
num_alters_this_ego = 0
sq_fraction_sum = 0
for (alter in 1:ncol(mat)) {
# only examine alters that are actually tied to ego
if (mat[ego, alter] == 1) {
num_alters_this_ego = num_alters_this_ego + 1
# get the alter's level on the attribute
alter_attr = attribute[alter]
# increment the count of alters with this level
# of the attribute by 1
alter_attr_counts[alter_attr] <- alter_attr_counts[alter_attr] + 1
}
}
for (i in 1:num_levels) {
attr_fraction = alter_attr_counts[i] /
num_alters_this_ego
sq_fraction_sum = sq_fraction_sum + attr_fraction ^ 2
}
# now we can compute the ego's blau index...
blau_index[ego] = 1 - sq_fraction_sum
# and the ego's IQV, which is just a normalized blau index
iqvs[ego] = blau_index[ego] / (1 - (1 / num_levels))
}
return(list(iqvs, blau_index))
}
ahs.mat <- igraph::as_adjacency_matrix(ahs.g)
ahs.attr <- igraph::get.vertex.attribute(ahs.g)$Race
ahs_iqv <- get_iqvs(ahs.mat, ahs.attr)[[1]]
ahs_blau <- get_iqvs(ahs.mat, ahs.attr)[[2]]
If you prefer to use an igraph
object, use the following function. Warning: it will deploy igraph
into the environment. Prepare for conflicts. TAKE SHELTER!
iqv <- function(graph, attribute) {
require(igraph)
N <- length(igraph::V(graph))
cats <- unique(igraph::get.vertex.attribute(graph,attribute,igraph::V(graph)))
nlev <- length(cats)
cat_list <- rep(0,N)
p <- rep(0, N)
p2_list <- as.list(0)
for (j in 1:nlev) {
for(i in 1:length(igraph::V(graph))){
i_att <- igraph::get.vertex.attribute(graph, attribute, igraph::V(graph)[igraph::neighborhood(graph,1)[[i]]])
att <- length(which(i_att==cats[j]))
num <- length(igraph::V(graph)[igraph::neighborhood(graph, 1)[[i]]])
p[i]<-att/num
p2<-p*p
}
p2_list[[j]] <- p2
cat_list <- cat_list + p2
}
IQV <- (nlev/(nlev-1))*(1-cat_list)
IQV1 <- as.list(0)
IQV1[[2]] <- IQV
IQV1[[1]] <- mean(IQV)
names(IQV1) <- c("full_graph", "egonet")
return (IQV1)
detach("package:igraph", unload=TRUE)
}
# Prepare data with two attributes: gender and department
### Data
mat12 <- matrix.2012[-isolates(net.2012), -isolates(net.2012)]
mat13 <- matrix.2013[-isolates(net.2013), -isolates(net.2013)]
attributes.12 <- attr.2012[-c(isolates(net.2012)),]
attributes.13 <- attr.2013[-c(isolates(net.2013)),]
## Attributes
dep.12 <- as.numeric(as.factor(attributes.12$department))
gender.12 <- as.numeric(as.factor(attributes.12$gender))
# Run IQV and plot
## Inter-disciplinary heterogeneity by gender
iqv.dep <- get_iqvs(mat12, dep.12)[[1]] ## Heterogeneity by discipline
iqv.male <- iqv.dep[gender.12 == 2]
iqv.female <- iqv.dep[gender.12 == 1]
iqv.male.mean <- mean(iqv.dep[gender.12 == 2]) # 0.395
iqv.female.mean <- mean(iqv.dep[gender.12 == 1]) # 0.397
iqv.male.sd <- sd(iqv.dep[gender.12 == 2]) # 0.344
iqv.female.sd <- sd(iqv.dep[gender.12 == 1]) # 0.353
heterogeneity <- data.frame(gender = attributes.12$gender,iqv = 0)
heterogeneity$iqv[which(attributes.12$gender == "Male")] <- iqv.male
heterogeneity$iqv[which(attributes.12$gender == "Female")] <- iqv.female
means <- data.frame(measure = heterogeneity$iqv, cond = heterogeneity$gender)
means <- means %>% group_by(cond) %>% summarise(cent.mean=mean(measure))
# Plot
ggplot(data = heterogeneity, aes(x = iqv, fill=gender)) +
#geom_histogram(alpha=.5, position="identity") +
geom_density(alpha=.7) +
geom_vline(data=means, aes(xintercept=means$cent.mean), colour=c("#FF8585", "#19A3FF"),
linetype="dashed", size=1, alpha=.7) + ylim(0,3.2) + xlim(0,1) +
theme(axis.text.x = element_text(angle = 45, hjust = 1),
axis.title.y = element_text(size=14), axis.title.x = element_text(size=12)) +
xlab("Heterogeneity Index") + ylab("") + ggtitle("2012") + ylab("Density") +
scale_fill_manual(name = "Gender", values = c("#FF8585", "#19A3FF"))
The original CONCOR algorithm was developed by Ron Breiger, Scott Boorman, and Phipps Arabie. If you are interested, you can check out their original (1975) paper: “An Algorithm for Clustering Relational Data with Applications to Social Network Analysis and Comparison with Multidimensional Scaling. Journal of Mathematical Psychology, 12: 328– 383.. The original version was written in Fortran. Since then, Adam Slez has rewritten the program in R.
Although it was developed with structural equivalence in mind, CONCOR is used for equivalence in general, since we rarely expect to see true structrual equivalence in a network. Because Adam Slez has not committed his concoR
package to CRAN, we will have to install it from his github site. You will only have to do this once.
CONCOR requires a matrix, or stack of matrices to make its calculations. So, start by loading concoR and extracting a matrix from an igraph network.
Using Roethlisberger & Dickson Bank Wiring Room
These are the observational data on 14 Western Electric (Hawthorne Plant) employees from the bank wiring room first presented in Roethlisberger & Dickson (1939). The data are better known through a scrutiny made of the interactions in Homans (1950), and the CONCOR analysis presented in Breiger et al (1975).
The employees worked in a single room and include two inspectors (I1 and I3), three solderers (S1, S2 and S3), and nine wiremen or assemblers (W1 to W9). The interaction categories include: RDGAM, participation in horseplay; RDCON, participation in arguments about open windows; RDPOS, friendship; RDNEG, antagonistic (negative) behavior; RDHLP, helping others with work; and RDJOB, the number of times workers traded job assignments.
# load Bank Wiring dataset:
library(concoR)
data(bank_wiring)
detach("package:concoR", unload=T)
bank_wiring
## $Liking
## I1 I3 W1 W2 W3 W4 W5 W6 W7 W8 W9 S1 S2 S4
## I1 0 0 0 0 1 0 0 0 0 0 0 0 0 0
## I3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W1 0 0 0 0 1 1 0 0 0 0 0 1 0 0
## W2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W3 1 0 1 0 0 1 0 0 0 0 0 1 0 0
## W4 0 0 1 0 1 0 0 0 0 0 0 1 0 0
## W5 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W6 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W7 0 0 0 0 0 0 0 0 0 1 1 1 0 0
## W8 0 0 0 0 0 0 0 0 1 0 1 0 0 1
## W9 0 0 0 0 0 0 0 0 1 1 0 0 0 1
## S1 0 0 1 0 1 1 0 0 1 0 0 0 0 0
## S2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## S4 0 0 0 0 0 0 0 0 0 1 1 0 0 0
##
## $Games
## I1 I3 W1 W2 W3 W4 W5 W6 W7 W8 W9 S1 S2 S4
## I1 0 0 1 1 1 1 0 0 0 0 0 0 0 0
## I3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W1 1 0 0 1 1 1 1 0 0 0 0 1 0 0
## W2 1 0 1 0 1 1 0 0 0 0 0 1 0 0
## W3 1 0 1 1 0 1 1 0 0 0 0 1 0 0
## W4 1 0 1 1 1 0 1 0 0 0 0 1 0 0
## W5 0 0 1 0 1 1 0 0 1 0 0 1 0 0
## W6 0 0 0 0 0 0 0 0 1 1 1 0 0 0
## W7 0 0 0 0 0 0 1 1 0 1 1 0 0 1
## W8 0 0 0 0 0 0 0 1 1 0 1 0 0 1
## W9 0 0 0 0 0 0 0 1 1 1 0 0 0 1
## S1 0 0 1 1 1 1 1 0 0 0 0 0 0 0
## S2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## S4 0 0 0 0 0 0 0 0 1 1 1 0 0 0
##
## $Antagonism
## I1 I3 W1 W2 W3 W4 W5 W6 W7 W8 W9 S1 S2 S4
## I1 0 1 0 1 0 0 0 0 0 0 0 0 0 0
## I3 1 0 0 0 0 0 1 1 1 1 1 0 0 1
## W1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W2 1 0 0 0 0 0 0 0 1 1 1 0 0 0
## W3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W4 0 0 0 0 0 0 1 0 0 0 0 0 0 0
## W5 0 1 0 0 0 1 0 1 1 1 1 1 1 0
## W6 0 1 0 0 0 0 1 0 1 0 0 0 0 0
## W7 0 1 0 1 0 0 1 1 0 0 0 0 0 0
## W8 0 1 0 1 0 0 1 0 0 0 0 0 0 0
## W9 0 1 0 1 0 0 1 0 0 0 0 0 0 0
## S1 0 0 0 0 0 0 1 0 0 0 0 0 0 0
## S2 0 0 0 0 0 0 1 0 0 0 0 0 0 0
## S4 0 1 0 0 0 0 0 0 0 0 0 0 0 0
##
## $Helping
## I1 I3 W1 W2 W3 W4 W5 W6 W7 W8 W9 S1 S2 S4
## I1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## I3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W1 0 0 0 0 1 0 0 0 0 0 1 1 0 0
## W2 0 0 0 0 1 1 0 0 0 0 0 1 0 0
## W3 0 0 0 1 0 0 0 0 0 0 0 0 0 0
## W4 0 0 1 0 1 0 0 1 0 0 0 0 0 0
## W5 0 0 0 0 1 0 0 0 0 0 0 0 0 0
## W6 0 0 0 0 1 0 0 0 1 1 1 0 0 0
## W7 0 0 0 0 0 0 0 0 0 0 0 0 0 1
## W8 0 0 0 0 0 0 0 1 1 0 1 0 0 0
## W9 0 0 0 0 0 0 0 0 0 0 0 0 0 1
## S1 0 0 0 0 0 0 0 0 1 0 0 0 0 0
## S2 0 0 0 0 0 0 0 1 0 0 0 0 0 0
## S4 0 0 0 0 0 1 0 0 0 1 0 0 0 0
##
## $Windows
## I1 I3 W1 W2 W3 W4 W5 W6 W7 W8 W9 S1 S2 S4
## I1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## I3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## W4 0 0 0 0 0 0 1 1 1 0 1 0 0 0
## W5 0 0 0 0 0 1 0 1 0 0 0 1 0 0
## W6 0 0 0 0 0 1 1 0 1 1 1 1 0 1
## W7 0 0 0 0 0 1 0 1 0 1 1 0 0 1
## W8 0 0 0 0 0 0 0 1 1 0 1 1 0 1
## W9 0 0 0 0 0 1 0 1 1 1 0 1 0 0
## S1 0 0 0 0 0 0 1 1 0 1 1 0 0 1
## S2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## S4 0 0 0 0 0 0 0 1 1 1 0 1 0 0
Next, run the concoR algorithm to identify the various structrual equivalence “blocks”.
Functional note: The list()
function in concor_hca
is necessary if you are using only one matrix. The program was developed to work with arrays
(lists of matrices), so it doesn’t play well with single matrices without this command.
block | vertex | |
---|---|---|
1 | 1 | I1 |
6 | 2 | I3 |
2 | 1 | W1 |
7 | 2 | W2 |
3 | 1 | W3 |
4 | 1 | W4 |
8 | 2 | W5 |
9 | 3 | W6 |
11 | 4 | W7 |
12 | 4 | W8 |
13 | 4 | W9 |
5 | 1 | S1 |
10 | 3 | S2 |
14 | 4 | S4 |
The output gives the vertex names, as well as the “blocks” or classes that each vertex was classified into. We can visualize this information in one of two ways: as a block matrix, or as a network visualization. We’ll do each below.
First, we can plot the network in statnet
, using the blockmodel
function. Note: we input the network
object for the Florentine network along with the output of the concor_hca
function.
blk_mod <- sna::blockmodel(bank.wiring.net, blks$block,
glabels = names(bank_wiring),
plabels = rownames(bank_wiring[[1]]))
blk_mod
##
## Network Blockmodel:
##
## Block membership:
##
## I1 I3 W1 W2 W3 W4 W5 W6 W7 W8 W9 S1 S2 S4
## 1 2 1 2 1 1 2 3 4 4 4 1 3 4
##
## Reduced form blockmodel:
##
## Liking
## Block 1 Block 2 Block 3 Block 4
## Block 1 0.70 0 0 0.0500000
## Block 2 0.00 0 0 0.0000000
## Block 3 0.00 0 0 0.0000000
## Block 4 0.05 0 0 0.8333333
##
## Games
## Block 1 Block 2 Block 3 Block 4
## Block 1 0.9 0.60000000 0.000 0.00000000
## Block 2 0.6 0.00000000 0.000 0.08333333
## Block 3 0.0 0.00000000 0.000 0.37500000
## Block 4 0.0 0.08333333 0.375 1.00000000
##
## Antagonism
## Block 1 Block 2 Block 3 Block 4
## Block 1 0.0000000 0.2666667 0.000 0.0000000
## Block 2 0.2666667 0.3333333 0.500 0.8333333
## Block 3 0.0000000 0.5000000 0.000 0.1250000
## Block 4 0.0000000 0.8333333 0.125 0.0000000
##
## Helping
## Block 1 Block 2 Block 3 Block 4
## Block 1 0.2000000 0.06666667 0.100 0.1000000
## Block 2 0.2666667 0.00000000 0.000 0.0000000
## Block 3 0.1000000 0.00000000 0.500 0.3750000
## Block 4 0.0500000 0.00000000 0.125 0.4166667
##
## Windows
## Block 1 Block 2 Block 3 Block 4
## Block 1 0.0000000 0.1333333 0.2000000 0.2500000
## Block 2 0.1333333 0.0000000 0.1666667 0.0000000
## Block 3 0.2000000 0.1666667 0.0000000 0.5000000
## Block 4 0.2500000 0.0000000 0.5000000 0.8333333
# Add the block designations to igraph data
network::set.vertex.attribute(bank.wiring.net, "blocks", blks$block)
igraph::V(g)$blocks <- blks$block
igraph::plot.igraph(g, vertex.color=igraph::V(g)$blocks)
Aleš Žiberna has written the blockmodeling
package on R
.
install.packages("blockmodeling")
#install.packages("./packages/rngtools", repos = NULL, type = "source")
The “optimization”" approach is where you assign some number of random partitions and require the algorithm to re-sort the network to a point where the various blocks contain a best fit to the network. There are a number of possible options for soting the network under the command. Here, we use the sum of squares methods. Also, the command asks the algorithm to find “complete” blocks (all 1s, and no 0s) if possible. Try it with and without this.
For more information see ŽIBERNA, Aleš (2007): Generalized Blockmodeling of Valued Networks. Social Networks, Jan. 2007, vol. 29, no. 1, 105-126.
# Extract the matrix in igraph
mat <- as.matrix(igraph::get.adjacency(g))
# Try a two block partition.
?blockmodeling::optRandomParC
class2 <- blockmodeling::optRandomParC(M=mat, k=2, approaches = "ss", blocks="com", rep=10)
##
##
## Starting optimization of the partiton 1 of 10 partitions.
## Starting partition: 2 1 2 1 1 2 2 2 1 2 1 2 1 1 1 2
## Final error: 29.33333
## Final partition: 2 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1
##
##
## Starting optimization of the partiton 2 of 10 partitions.
## Starting partition: 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1
## Final error: 29.33333
## Final partition: 2 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1
##
##
## Starting optimization of the partiton 3 of 10 partitions.
## Starting partition: 2 1 1 1 1 1 1 1 2 1 2 2 2 2 2 2
## Final error: 26.92803
## Final partition: 1 1 1 2 2 1 1 1 1 1 2 1 1 1 2 1
##
##
## Starting optimization of the partiton 4 of 10 partitions.
## Starting partition: 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## Final error: 29.33333
## Final partition: 1 2 2 2 2 1 2 1 2 1 2 1 2 1 2 2
##
##
## Starting optimization of the partiton 5 of 10 partitions.
## Starting partition: 1 2 1 1 2 1 2 1 2 2 1 2 1 2 1 2
## Final error: 29.23636
## Final partition: 1 2 1 1 1 1 2 1 2 1 1 1 2 1 1 2
##
##
## Starting optimization of the partiton 6 of 10 partitions.
## Starting partition: 1 2 2 1 2 1 1 2 1 2 1 2 1 2 2 1
## Final error: 29.33333
## Final partition: 2 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1
##
##
## Starting optimization of the partiton 7 of 10 partitions.
## Starting partition: 1 1 1 2 1 1 2 2 2 1 2 2 2 1 1 1
## Final error: 29.33333
## Final partition: 1 2 2 2 2 1 2 1 2 1 2 1 2 1 2 2
##
##
## Starting optimization of the partiton 8 of 10 partitions.
## Starting partition: 2 1 1 1 2 1 2 1 2 2 1 2 1 2 1 2
## Final error: 29.43304
## Final partition: 2 2 1 1 1 2 2 2 1 2 1 2 1 2 1 1
##
##
## Starting optimization of the partiton 9 of 10 partitions.
## Starting partition: 1 1 1 1 1 1 2 2 2 2 1 2 2 1 2 2
## Final error: 29.33333
## Final partition: 1 2 2 2 2 1 2 1 2 1 2 1 2 1 2 2
##
##
## Starting optimization of the partiton 10 of 10 partitions.
## Starting partition: 2 1 2 1 2 2 2 2 1 2 1 1 2 1 1 1
## Final error: 29.33333
## Final partition: 2 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1
##
##
## Optimization of all partitions completed
## 1 solution(s) with minimal error = 26.92803 found.
#class2 <- blockmodeling::opt.random.par(M=mat, k=2, rep=10, approach="ss", blocks="com")
# Tru a four block partition
class4 <- blockmodeling::optRandomParC(M=mat, k=4, rep=10, approach="ss", blocks="com")
##
##
## Starting optimization of the partiton 1 of 10 partitions.
## Starting partition: 1 4 2 1 2 4 1 2 1 3 3 2 3 4 2 1
## Final error: 17.83333
## Final partition: 2 2 2 3 3 1 1 1 4 1 3 1 2 2 3 2
##
##
## Starting optimization of the partiton 2 of 10 partitions.
## Starting partition: 1 2 2 4 4 3 2 4 4 3 3 1 3 1 1 2
## Final error: 24.14815
## Final partition: 1 1 1 1 1 2 4 1 4 3 1 2 1 3 4 1
##
##
## Starting optimization of the partiton 3 of 10 partitions.
## Starting partition: 1 3 3 4 2 2 1 4 4 3 1 2 4 2 3 1
## Final error: 17.83333
## Final partition: 3 3 3 1 1 2 2 2 4 2 1 2 3 3 1 3
##
##
## Starting optimization of the partiton 4 of 10 partitions.
## Starting partition: 3 1 4 2 4 3 3 1 2 1 4 3 4 1 2 2
## Final error: 19.47024
## Final partition: 1 3 1 4 4 1 2 1 2 1 4 1 1 1 4 3
##
##
## Starting optimization of the partiton 5 of 10 partitions.
## Starting partition: 1 1 4 4 4 1 3 3 2 3 3 4 4 2 2 4
## Final error: 19.08333
## Final partition: 2 2 2 4 4 1 3 2 3 1 4 1 2 2 4 2
##
##
## Starting optimization of the partiton 6 of 10 partitions.
## Starting partition: 4 2 1 1 2 4 4 3 3 4 1 1 4 3 2 4
## Final error: 17.83333
## Final partition: 4 4 4 1 1 3 3 3 2 3 1 3 4 4 1 4
##
##
## Starting optimization of the partiton 7 of 10 partitions.
## Starting partition: 2 1 1 4 4 4 4 2 3 3 2 3 2 1 1 3
## Final error: 19.08333
## Final partition: 4 4 4 1 1 3 2 4 2 3 1 3 4 4 1 4
##
##
## Starting optimization of the partiton 8 of 10 partitions.
## Starting partition: 4 4 4 4 4 2 1 4 4 4 4 4 4 3 4 4
## Final error: 17.83333
## Final partition: 4 4 4 2 2 1 1 1 3 1 2 1 4 4 2 4
##
##
## Starting optimization of the partiton 9 of 10 partitions.
## Starting partition: 2 2 1 4 2 3 2 2 2 2 2 2 2 2 2 2
## Final error: 21.94444
## Final partition: 3 3 3 2 2 2 2 2 1 2 2 2 4 3 2 4
##
##
## Starting optimization of the partiton 10 of 10 partitions.
## Starting partition: 4 2 4 2 1 2 2 4 3 1 3 4 2 3 2 3
## Final error: 19.08333
## Final partition: 2 2 2 3 3 1 4 2 4 1 3 1 2 2 3 2
##
##
## Optimization of all partitions completed
## 3 solution(s) with minimal error = 17.83333 found.
par(mfrow=c(1,2)) # set the plot window for one row and two columns
plot(class2, main="")
title("Two Block Partition")
plot(class4, main="")
title("Four Block Partition")
par(mfrow=c(1,1)) # reset the plot window back to one row and one column
## [1] "best" "call" "checked.par" "err"
## [5] "initial.param" "M" "nIter" "Random.seed"
## $best1
## $err
## [1] 17.83333
##
## $EM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1.666667 0.95 1.833333 0
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 0.95 1.8 3.466667 0
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 1.833333 3.466667 1.866667 0
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 0
##
##
## $Earr
## , , 1, 1
##
## [,1]
## [1,] 1.666667
##
## , , 2, 1
##
## [,1]
## [1,] 0.95
##
## , , 3, 1
##
## [,1]
## [1,] 1.833333
##
## , , 4, 1
##
## [,1]
## [1,] 0
##
## , , 1, 2
##
## [,1]
## [1,] 0.95
##
## , , 2, 2
##
## [,1]
## [1,] 1.8
##
## , , 3, 2
##
## [,1]
## [1,] 3.466667
##
## , , 4, 2
##
## [,1]
## [1,] 0
##
## , , 1, 3
##
## [,1]
## [1,] 1.833333
##
## , , 2, 3
##
## [,1]
## [1,] 3.466667
##
## , , 3, 3
##
## [,1]
## [1,] 1.866667
##
## , , 4, 3
##
## [,1]
## [1,] 0
##
## , , 1, 4
##
## [,1]
## [1,] 0
##
## , , 2, 4
##
## [,1]
## [1,] 0
##
## , , 3, 4
##
## [,1]
## [1,] 0
##
## , , 4, 4
##
## [,1]
## [1,] 0
##
##
## $sameErr
## [1] 1
##
## $IM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
##
## $clu
## [1] 3 3 3 1 1 2 2 2 4 2 1 2 3 3 1 3
##
## $call
## optParC(M = M, clu = temppar, approaches = approaches, blocks = blocks,
## useMulti = useMulti, save.initial.param = save.initial.param.opt)
##
## $resC
## $resC$nr
## [1] 16
##
## $resC$nc
## [1] 16
##
## $resC$nRel
## [1] 1
##
## $resC$isTwoMode
## [1] 0
##
## $resC$isSym
## [1] 1
##
## $resC$diag
## [1] 1
##
## $resC$nColClus
## [1] 4
##
## $resC$nRowClus
## [1] 4
##
## $resC$nUnitsRowClu
## [1] 4 5 6 1
##
## $resC$nUnitsColClu
## [1] 4 4 4 4
##
## $resC$rowParArr
## [,1] [,2] [,3] [,4]
## [1,] 4 9 1 8
## [2,] 3 5 2 6
## [3,] 10 11 0 8
## [4,] 14 7 15 12
## [5,] 12 6 13 0
## [6,] 3 6 12 0
## [7,] 14 0 0 0
## [8,] 0 0 0 0
## [9,] 0 0 0 0
## [10,] 0 0 0 0
## [11,] 0 0 0 0
## [12,] 0 0 0 0
## [13,] 0 0 0 0
## [14,] 0 0 0 0
## [15,] 0 0 0 0
## [16,] 0 0 0 0
##
## $resC$colParArr
## [,1] [,2] [,3] [,4]
## [1,] 0 4 1 3
## [2,] 6 5 2 7
## [3,] 10 11 9 8
## [4,] 15 13 14 12
## [5,] 0 0 0 0
## [6,] 0 0 0 0
## [7,] 0 0 0 0
## [8,] 0 0 0 0
## [9,] 0 0 0 0
## [10,] 0 0 0 0
## [11,] 0 0 0 0
## [12,] 0 0 0 0
## [13,] 0 0 0 0
## [14,] 0 0 0 0
## [15,] 0 0 0 0
## [16,] 0 0 0 0
##
## $resC$approaches
## [1] 0
##
## $resC$maxBlockTypes
## [1] 1
##
## $resC$nBlockTypeByBlock
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
##
## $resC$blocks
## , , 1, 1
##
## [,1]
## [1,] 1
##
## , , 2, 1
##
## [,1]
## [1,] 1
##
## , , 3, 1
##
## [,1]
## [1,] 1
##
## , , 4, 1
##
## [,1]
## [1,] 1
##
## , , 1, 2
##
## [,1]
## [1,] 1
##
## , , 2, 2
##
## [,1]
## [1,] 1
##
## , , 3, 2
##
## [,1]
## [1,] 1
##
## , , 4, 2
##
## [,1]
## [1,] 1
##
## , , 1, 3
##
## [,1]
## [1,] 1
##
## , , 2, 3
##
## [,1]
## [1,] 1
##
## , , 3, 3
##
## [,1]
## [1,] 1
##
## , , 4, 3
##
## [,1]
## [1,] 1
##
## , , 1, 4
##
## [,1]
## [1,] 1
##
## , , 2, 4
##
## [,1]
## [1,] 1
##
## , , 3, 4
##
## [,1]
## [1,] 1
##
## , , 4, 4
##
## [,1]
## [1,] 1
##
##
## $resC$IM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
##
## $resC$EM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1.666667 0.95 1.833333 0
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 0.95 1.8 3.466667 0
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 1.833333 3.466667 1.866667 0
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 0
##
##
## $resC$Earr
## , , 1, 1
##
## [,1]
## [1,] 1.666667
##
## , , 2, 1
##
## [,1]
## [1,] 0.95
##
## , , 3, 1
##
## [,1]
## [1,] 1.833333
##
## , , 4, 1
##
## [,1]
## [1,] 0
##
## , , 1, 2
##
## [,1]
## [1,] 0.95
##
## , , 2, 2
##
## [,1]
## [1,] 1.8
##
## , , 3, 2
##
## [,1]
## [1,] 3.466667
##
## , , 4, 2
##
## [,1]
## [1,] 0
##
## , , 1, 3
##
## [,1]
## [1,] 1.833333
##
## , , 2, 3
##
## [,1]
## [1,] 3.466667
##
## , , 3, 3
##
## [,1]
## [1,] 1.866667
##
## , , 4, 3
##
## [,1]
## [1,] 0
##
## , , 1, 4
##
## [,1]
## [1,] 0
##
## , , 2, 4
##
## [,1]
## [1,] 0
##
## , , 3, 4
##
## [,1]
## [1,] 0
##
## , , 4, 4
##
## [,1]
## [1,] 0
##
##
## $resC$err
## [1] 17.83333
##
## $resC$justChange
## [1] 0
##
## $resC$rowCluChange
## [1] 2 3
##
## $resC$colCluChange
## [1] 0 0
##
## $resC$sameIM
## [1] 0
##
## $resC$regFun
## , , 1, 1
##
## [,1]
## [1,] 0
##
## , , 2, 1
##
## [,1]
## [1,] 0
##
## , , 3, 1
##
## [,1]
## [1,] 0
##
## , , 4, 1
##
## [,1]
## [1,] 0
##
## , , 1, 2
##
## [,1]
## [1,] 0
##
## , , 2, 2
##
## [,1]
## [1,] 0
##
## , , 3, 2
##
## [,1]
## [1,] 0
##
## , , 4, 2
##
## [,1]
## [1,] 0
##
## , , 1, 3
##
## [,1]
## [1,] 0
##
## , , 2, 3
##
## [,1]
## [1,] 0
##
## , , 3, 3
##
## [,1]
## [1,] 0
##
## , , 4, 3
##
## [,1]
## [1,] 0
##
## , , 1, 4
##
## [,1]
## [1,] 0
##
## , , 2, 4
##
## [,1]
## [1,] 0
##
## , , 3, 4
##
## [,1]
## [1,] 0
##
## , , 4, 4
##
## [,1]
## [1,] 0
##
##
## $resC$homFun
## [1] 0
##
## $resC$usePreSpec
## , , 1, 1
##
## [,1]
## [1,] FALSE
##
## , , 2, 1
##
## [,1]
## [1,] FALSE
##
## , , 3, 1
##
## [,1]
## [1,] FALSE
##
## , , 4, 1
##
## [,1]
## [1,] FALSE
##
## , , 1, 2
##
## [,1]
## [1,] FALSE
##
## , , 2, 2
##
## [,1]
## [1,] FALSE
##
## , , 3, 2
##
## [,1]
## [1,] FALSE
##
## , , 4, 2
##
## [,1]
## [1,] FALSE
##
## , , 1, 3
##
## [,1]
## [1,] FALSE
##
## , , 2, 3
##
## [,1]
## [1,] FALSE
##
## , , 3, 3
##
## [,1]
## [1,] FALSE
##
## , , 4, 3
##
## [,1]
## [1,] FALSE
##
## , , 1, 4
##
## [,1]
## [1,] FALSE
##
## , , 2, 4
##
## [,1]
## [1,] FALSE
##
## , , 3, 4
##
## [,1]
## [1,] FALSE
##
## , , 4, 4
##
## [,1]
## [1,] FALSE
##
##
## $resC$preSpecM
## , , 1, 1
##
## [,1]
## [1,] NA
##
## , , 2, 1
##
## [,1]
## [1,] NA
##
## , , 3, 1
##
## [,1]
## [1,] NA
##
## , , 4, 1
##
## [,1]
## [1,] NA
##
## , , 1, 2
##
## [,1]
## [1,] NA
##
## , , 2, 2
##
## [,1]
## [1,] NA
##
## , , 3, 2
##
## [,1]
## [1,] NA
##
## , , 4, 2
##
## [,1]
## [1,] NA
##
## , , 1, 3
##
## [,1]
## [1,] NA
##
## , , 2, 3
##
## [,1]
## [1,] NA
##
## , , 3, 3
##
## [,1]
## [1,] NA
##
## , , 4, 3
##
## [,1]
## [1,] NA
##
## , , 1, 4
##
## [,1]
## [1,] NA
##
## , , 2, 4
##
## [,1]
## [1,] NA
##
## , , 3, 4
##
## [,1]
## [1,] NA
##
## , , 4, 4
##
## [,1]
## [1,] NA
##
##
## $resC$minUnitsRowCluster
## [1] 1
##
## $resC$minUnitsColCluster
## [1] 1
##
## $resC$maxUnitsRowCluster
## [1] 9999
##
## $resC$maxUnitsColCluster
## [1] 9999
##
## $resC$sameErr
## [1] 1
##
## $resC$nIter
## [1] 16
##
## $resC$combWeights
## , , 1, 1
##
## [,1]
## [1,] 1
##
## , , 2, 1
##
## [,1]
## [1,] 1
##
## , , 3, 1
##
## [,1]
## [1,] 1
##
## , , 4, 1
##
## [,1]
## [1,] 1
##
## , , 1, 2
##
## [,1]
## [1,] 1
##
## , , 2, 2
##
## [,1]
## [1,] 1
##
## , , 3, 2
##
## [,1]
## [1,] 1
##
## , , 4, 2
##
## [,1]
## [1,] 1
##
## , , 1, 3
##
## [,1]
## [1,] 1
##
## , , 2, 3
##
## [,1]
## [1,] 1
##
## , , 3, 3
##
## [,1]
## [1,] 1
##
## , , 4, 3
##
## [,1]
## [1,] 1
##
## , , 1, 4
##
## [,1]
## [1,] 1
##
## , , 2, 4
##
## [,1]
## [1,] 1
##
## , , 3, 4
##
## [,1]
## [1,] 1
##
## , , 4, 4
##
## [,1]
## [1,] 1
##
##
## $resC$exchageClusters
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
## [2,] 1 1 1 1
## [3,] 1 1 1 1
## [4,] 1 1 1 1
##
##
## attr(,"class")
## [1] "optPar"
##
## $best2
## $err
## [1] 17.83333
##
## $EM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1.666667 0 0.95 1.833333
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 0
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 0.95 0 1.8 3.466667
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 1.833333 0 3.466667 1.866667
##
##
## $Earr
## , , 1, 1
##
## [,1]
## [1,] 1.666667
##
## , , 2, 1
##
## [,1]
## [1,] 0
##
## , , 3, 1
##
## [,1]
## [1,] 0.95
##
## , , 4, 1
##
## [,1]
## [1,] 1.833333
##
## , , 1, 2
##
## [,1]
## [1,] 0
##
## , , 2, 2
##
## [,1]
## [1,] 0
##
## , , 3, 2
##
## [,1]
## [1,] 0
##
## , , 4, 2
##
## [,1]
## [1,] 0
##
## , , 1, 3
##
## [,1]
## [1,] 0.95
##
## , , 2, 3
##
## [,1]
## [1,] 0
##
## , , 3, 3
##
## [,1]
## [1,] 1.8
##
## , , 4, 3
##
## [,1]
## [1,] 3.466667
##
## , , 1, 4
##
## [,1]
## [1,] 1.833333
##
## , , 2, 4
##
## [,1]
## [1,] 0
##
## , , 3, 4
##
## [,1]
## [1,] 3.466667
##
## , , 4, 4
##
## [,1]
## [1,] 1.866667
##
##
## $sameErr
## [1] 1
##
## $IM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
##
## $clu
## [1] 4 4 4 1 1 3 3 3 2 3 1 3 4 4 1 4
##
## $call
## optParC(M = M, clu = temppar, approaches = approaches, blocks = blocks,
## useMulti = useMulti, save.initial.param = save.initial.param.opt)
##
## $resC
## $resC$nr
## [1] 16
##
## $resC$nc
## [1] 16
##
## $resC$nRel
## [1] 1
##
## $resC$isTwoMode
## [1] 0
##
## $resC$isSym
## [1] 1
##
## $resC$diag
## [1] 1
##
## $resC$nColClus
## [1] 4
##
## $resC$nRowClus
## [1] 4
##
## $resC$nUnitsRowClu
## [1] 4 1 5 6
##
## $resC$nUnitsColClu
## [1] 4 3 3 6
##
## $resC$rowParArr
## [,1] [,2] [,3] [,4]
## [1,] 4 8 5 0
## [2,] 14 6 7 15
## [3,] 10 7 9 2
## [4,] 3 0 11 12
## [5,] 6 0 6 13
## [6,] 0 0 15 1
## [7,] 0 0 1 0
## [8,] 0 0 0 0
## [9,] 0 0 0 0
## [10,] 0 0 0 0
## [11,] 0 0 0 0
## [12,] 0 0 0 0
## [13,] 0 0 0 0
## [14,] 0 0 0 0
## [15,] 0 0 0 0
## [16,] 0 0 0 0
##
## $resC$colParArr
## [,1] [,2] [,3] [,4]
## [1,] 2 1 7 0
## [2,] 3 4 8 5
## [3,] 10 14 13 6
## [4,] 11 0 0 9
## [5,] 0 0 0 12
## [6,] 0 0 0 15
## [7,] 0 0 0 0
## [8,] 0 0 0 0
## [9,] 0 0 0 0
## [10,] 0 0 0 0
## [11,] 0 0 0 0
## [12,] 0 0 0 0
## [13,] 0 0 0 0
## [14,] 0 0 0 0
## [15,] 0 0 0 0
## [16,] 0 0 0 0
##
## $resC$approaches
## [1] 0
##
## $resC$maxBlockTypes
## [1] 1
##
## $resC$nBlockTypeByBlock
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
##
## $resC$blocks
## , , 1, 1
##
## [,1]
## [1,] 1
##
## , , 2, 1
##
## [,1]
## [1,] 1
##
## , , 3, 1
##
## [,1]
## [1,] 1
##
## , , 4, 1
##
## [,1]
## [1,] 1
##
## , , 1, 2
##
## [,1]
## [1,] 1
##
## , , 2, 2
##
## [,1]
## [1,] 1
##
## , , 3, 2
##
## [,1]
## [1,] 1
##
## , , 4, 2
##
## [,1]
## [1,] 1
##
## , , 1, 3
##
## [,1]
## [1,] 1
##
## , , 2, 3
##
## [,1]
## [1,] 1
##
## , , 3, 3
##
## [,1]
## [1,] 1
##
## , , 4, 3
##
## [,1]
## [1,] 1
##
## , , 1, 4
##
## [,1]
## [1,] 1
##
## , , 2, 4
##
## [,1]
## [1,] 1
##
## , , 3, 4
##
## [,1]
## [1,] 1
##
## , , 4, 4
##
## [,1]
## [1,] 1
##
##
## $resC$IM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
##
## $resC$EM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1.666667 0 0.95 1.833333
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 0
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 0.95 0 1.8 3.466667
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 1.833333 0 3.466667 1.866667
##
##
## $resC$Earr
## , , 1, 1
##
## [,1]
## [1,] 1.666667
##
## , , 2, 1
##
## [,1]
## [1,] 0
##
## , , 3, 1
##
## [,1]
## [1,] 0.95
##
## , , 4, 1
##
## [,1]
## [1,] 1.833333
##
## , , 1, 2
##
## [,1]
## [1,] 0
##
## , , 2, 2
##
## [,1]
## [1,] 0
##
## , , 3, 2
##
## [,1]
## [1,] 0
##
## , , 4, 2
##
## [,1]
## [1,] 0
##
## , , 1, 3
##
## [,1]
## [1,] 0.95
##
## , , 2, 3
##
## [,1]
## [1,] 0
##
## , , 3, 3
##
## [,1]
## [1,] 1.8
##
## , , 4, 3
##
## [,1]
## [1,] 3.466667
##
## , , 1, 4
##
## [,1]
## [1,] 1.833333
##
## , , 2, 4
##
## [,1]
## [1,] 0
##
## , , 3, 4
##
## [,1]
## [1,] 3.466667
##
## , , 4, 4
##
## [,1]
## [1,] 1.866667
##
##
## $resC$err
## [1] 17.83333
##
## $resC$justChange
## [1] 0
##
## $resC$rowCluChange
## [1] 2 3
##
## $resC$colCluChange
## [1] 0 0
##
## $resC$sameIM
## [1] 0
##
## $resC$regFun
## , , 1, 1
##
## [,1]
## [1,] 0
##
## , , 2, 1
##
## [,1]
## [1,] 0
##
## , , 3, 1
##
## [,1]
## [1,] 0
##
## , , 4, 1
##
## [,1]
## [1,] 0
##
## , , 1, 2
##
## [,1]
## [1,] 0
##
## , , 2, 2
##
## [,1]
## [1,] 0
##
## , , 3, 2
##
## [,1]
## [1,] 0
##
## , , 4, 2
##
## [,1]
## [1,] 0
##
## , , 1, 3
##
## [,1]
## [1,] 0
##
## , , 2, 3
##
## [,1]
## [1,] 0
##
## , , 3, 3
##
## [,1]
## [1,] 0
##
## , , 4, 3
##
## [,1]
## [1,] 0
##
## , , 1, 4
##
## [,1]
## [1,] 0
##
## , , 2, 4
##
## [,1]
## [1,] 0
##
## , , 3, 4
##
## [,1]
## [1,] 0
##
## , , 4, 4
##
## [,1]
## [1,] 0
##
##
## $resC$homFun
## [1] 0
##
## $resC$usePreSpec
## , , 1, 1
##
## [,1]
## [1,] FALSE
##
## , , 2, 1
##
## [,1]
## [1,] FALSE
##
## , , 3, 1
##
## [,1]
## [1,] FALSE
##
## , , 4, 1
##
## [,1]
## [1,] FALSE
##
## , , 1, 2
##
## [,1]
## [1,] FALSE
##
## , , 2, 2
##
## [,1]
## [1,] FALSE
##
## , , 3, 2
##
## [,1]
## [1,] FALSE
##
## , , 4, 2
##
## [,1]
## [1,] FALSE
##
## , , 1, 3
##
## [,1]
## [1,] FALSE
##
## , , 2, 3
##
## [,1]
## [1,] FALSE
##
## , , 3, 3
##
## [,1]
## [1,] FALSE
##
## , , 4, 3
##
## [,1]
## [1,] FALSE
##
## , , 1, 4
##
## [,1]
## [1,] FALSE
##
## , , 2, 4
##
## [,1]
## [1,] FALSE
##
## , , 3, 4
##
## [,1]
## [1,] FALSE
##
## , , 4, 4
##
## [,1]
## [1,] FALSE
##
##
## $resC$preSpecM
## , , 1, 1
##
## [,1]
## [1,] NA
##
## , , 2, 1
##
## [,1]
## [1,] NA
##
## , , 3, 1
##
## [,1]
## [1,] NA
##
## , , 4, 1
##
## [,1]
## [1,] NA
##
## , , 1, 2
##
## [,1]
## [1,] NA
##
## , , 2, 2
##
## [,1]
## [1,] NA
##
## , , 3, 2
##
## [,1]
## [1,] NA
##
## , , 4, 2
##
## [,1]
## [1,] NA
##
## , , 1, 3
##
## [,1]
## [1,] NA
##
## , , 2, 3
##
## [,1]
## [1,] NA
##
## , , 3, 3
##
## [,1]
## [1,] NA
##
## , , 4, 3
##
## [,1]
## [1,] NA
##
## , , 1, 4
##
## [,1]
## [1,] NA
##
## , , 2, 4
##
## [,1]
## [1,] NA
##
## , , 3, 4
##
## [,1]
## [1,] NA
##
## , , 4, 4
##
## [,1]
## [1,] NA
##
##
## $resC$minUnitsRowCluster
## [1] 1
##
## $resC$minUnitsColCluster
## [1] 1
##
## $resC$maxUnitsRowCluster
## [1] 9999
##
## $resC$maxUnitsColCluster
## [1] 9999
##
## $resC$sameErr
## [1] 1
##
## $resC$nIter
## [1] 18
##
## $resC$combWeights
## , , 1, 1
##
## [,1]
## [1,] 1
##
## , , 2, 1
##
## [,1]
## [1,] 1
##
## , , 3, 1
##
## [,1]
## [1,] 1
##
## , , 4, 1
##
## [,1]
## [1,] 1
##
## , , 1, 2
##
## [,1]
## [1,] 1
##
## , , 2, 2
##
## [,1]
## [1,] 1
##
## , , 3, 2
##
## [,1]
## [1,] 1
##
## , , 4, 2
##
## [,1]
## [1,] 1
##
## , , 1, 3
##
## [,1]
## [1,] 1
##
## , , 2, 3
##
## [,1]
## [1,] 1
##
## , , 3, 3
##
## [,1]
## [1,] 1
##
## , , 4, 3
##
## [,1]
## [1,] 1
##
## , , 1, 4
##
## [,1]
## [1,] 1
##
## , , 2, 4
##
## [,1]
## [1,] 1
##
## , , 3, 4
##
## [,1]
## [1,] 1
##
## , , 4, 4
##
## [,1]
## [1,] 1
##
##
## $resC$exchageClusters
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
## [2,] 1 1 1 1
## [3,] 1 1 1 1
## [4,] 1 1 1 1
##
##
## attr(,"class")
## [1] "optPar"
##
## $best3
## $err
## [1] 17.83333
##
## $EM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1.8 0.95 0 3.466667
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 0.95 1.666667 0 1.833333
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 0
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 3.466667 1.833333 0 1.866667
##
##
## $Earr
## , , 1, 1
##
## [,1]
## [1,] 1.8
##
## , , 2, 1
##
## [,1]
## [1,] 0.95
##
## , , 3, 1
##
## [,1]
## [1,] 0
##
## , , 4, 1
##
## [,1]
## [1,] 3.466667
##
## , , 1, 2
##
## [,1]
## [1,] 0.95
##
## , , 2, 2
##
## [,1]
## [1,] 1.666667
##
## , , 3, 2
##
## [,1]
## [1,] 0
##
## , , 4, 2
##
## [,1]
## [1,] 1.833333
##
## , , 1, 3
##
## [,1]
## [1,] 0
##
## , , 2, 3
##
## [,1]
## [1,] 0
##
## , , 3, 3
##
## [,1]
## [1,] 0
##
## , , 4, 3
##
## [,1]
## [1,] 0
##
## , , 1, 4
##
## [,1]
## [1,] 3.466667
##
## , , 2, 4
##
## [,1]
## [1,] 1.833333
##
## , , 3, 4
##
## [,1]
## [1,] 0
##
## , , 4, 4
##
## [,1]
## [1,] 1.866667
##
##
## $sameErr
## [1] 1
##
## $IM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] "com" "com" "com" "com"
##
##
## $clu
## [1] 4 4 4 2 2 1 1 1 3 1 2 1 4 4 2 4
##
## $call
## optParC(M = M, clu = temppar, approaches = approaches, blocks = blocks,
## useMulti = useMulti, save.initial.param = save.initial.param.opt)
##
## $resC
## $resC$nr
## [1] 16
##
## $resC$nc
## [1] 16
##
## $resC$nRel
## [1] 1
##
## $resC$isTwoMode
## [1] 0
##
## $resC$isSym
## [1] 1
##
## $resC$diag
## [1] 1
##
## $resC$nColClus
## [1] 4
##
## $resC$nRowClus
## [1] 4
##
## $resC$nUnitsRowClu
## [1] 5 4 1 6
##
## $resC$nUnitsColClu
## [1] 1 1 1 13
##
## $resC$rowParArr
## [,1] [,2] [,3] [,4]
## [1,] 5 14 8 0
## [2,] 9 3 0 1
## [3,] 7 10 0 2
## [4,] 11 4 0 13
## [5,] 6 10 0 15
## [6,] 7 0 0 12
## [7,] 4 0 0 15
## [8,] 0 0 0 7
## [9,] 0 0 0 13
## [10,] 0 0 0 13
## [11,] 0 0 0 5
## [12,] 0 0 0 14
## [13,] 0 0 0 13
## [14,] 0 0 0 0
## [15,] 0 0 0 0
## [16,] 0 0 0 0
##
## $resC$colParArr
## [,1] [,2] [,3] [,4]
## [1,] 6 5 13 0
## [2,] 0 0 0 1
## [3,] 0 0 0 2
## [4,] 0 0 0 3
## [5,] 0 0 0 4
## [6,] 0 0 0 7
## [7,] 0 0 0 8
## [8,] 0 0 0 9
## [9,] 0 0 0 10
## [10,] 0 0 0 11
## [11,] 0 0 0 12
## [12,] 0 0 0 14
## [13,] 0 0 0 15
## [14,] 0 0 0 0
## [15,] 0 0 0 0
## [16,] 0 0 0 0
##
## $resC$approaches
## [1] 0
##
## $resC$maxBlockTypes
## [1] 1
##
## $resC$nBlockTypeByBlock
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
##
## $resC$blocks
## , , 1, 1
##
## [,1]
## [1,] 1
##
## , , 2, 1
##
## [,1]
## [1,] 1
##
## , , 3, 1
##
## [,1]
## [1,] 1
##
## , , 4, 1
##
## [,1]
## [1,] 1
##
## , , 1, 2
##
## [,1]
## [1,] 1
##
## , , 2, 2
##
## [,1]
## [1,] 1
##
## , , 3, 2
##
## [,1]
## [1,] 1
##
## , , 4, 2
##
## [,1]
## [1,] 1
##
## , , 1, 3
##
## [,1]
## [1,] 1
##
## , , 2, 3
##
## [,1]
## [1,] 1
##
## , , 3, 3
##
## [,1]
## [1,] 1
##
## , , 4, 3
##
## [,1]
## [1,] 1
##
## , , 1, 4
##
## [,1]
## [1,] 1
##
## , , 2, 4
##
## [,1]
## [1,] 1
##
## , , 3, 4
##
## [,1]
## [1,] 1
##
## , , 4, 4
##
## [,1]
## [1,] 1
##
##
## $resC$IM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
##
##
## $resC$EM
## , , 1
##
## [,1] [,2] [,3] [,4]
## [1,] 1.8 0.95 0 3.466667
##
## , , 2
##
## [,1] [,2] [,3] [,4]
## [1,] 0.95 1.666667 0 1.833333
##
## , , 3
##
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 0
##
## , , 4
##
## [,1] [,2] [,3] [,4]
## [1,] 3.466667 1.833333 0 1.866667
##
##
## $resC$Earr
## , , 1, 1
##
## [,1]
## [1,] 1.8
##
## , , 2, 1
##
## [,1]
## [1,] 0.95
##
## , , 3, 1
##
## [,1]
## [1,] 0
##
## , , 4, 1
##
## [,1]
## [1,] 3.466667
##
## , , 1, 2
##
## [,1]
## [1,] 0.95
##
## , , 2, 2
##
## [,1]
## [1,] 1.666667
##
## , , 3, 2
##
## [,1]
## [1,] 0
##
## , , 4, 2
##
## [,1]
## [1,] 1.833333
##
## , , 1, 3
##
## [,1]
## [1,] 0
##
## , , 2, 3
##
## [,1]
## [1,] 0
##
## , , 3, 3
##
## [,1]
## [1,] 0
##
## , , 4, 3
##
## [,1]
## [1,] 0
##
## , , 1, 4
##
## [,1]
## [1,] 3.466667
##
## , , 2, 4
##
## [,1]
## [1,] 1.833333
##
## , , 3, 4
##
## [,1]
## [1,] 0
##
## , , 4, 4
##
## [,1]
## [1,] 1.866667
##
##
## $resC$err
## [1] 17.83333
##
## $resC$justChange
## [1] 0
##
## $resC$rowCluChange
## [1] 2 1
##
## $resC$colCluChange
## [1] 0 0
##
## $resC$sameIM
## [1] 0
##
## $resC$regFun
## , , 1, 1
##
## [,1]
## [1,] 0
##
## , , 2, 1
##
## [,1]
## [1,] 0
##
## , , 3, 1
##
## [,1]
## [1,] 0
##
## , , 4, 1
##
## [,1]
## [1,] 0
##
## , , 1, 2
##
## [,1]
## [1,] 0
##
## , , 2, 2
##
## [,1]
## [1,] 0
##
## , , 3, 2
##
## [,1]
## [1,] 0
##
## , , 4, 2
##
## [,1]
## [1,] 0
##
## , , 1, 3
##
## [,1]
## [1,] 0
##
## , , 2, 3
##
## [,1]
## [1,] 0
##
## , , 3, 3
##
## [,1]
## [1,] 0
##
## , , 4, 3
##
## [,1]
## [1,] 0
##
## , , 1, 4
##
## [,1]
## [1,] 0
##
## , , 2, 4
##
## [,1]
## [1,] 0
##
## , , 3, 4
##
## [,1]
## [1,] 0
##
## , , 4, 4
##
## [,1]
## [1,] 0
##
##
## $resC$homFun
## [1] 0
##
## $resC$usePreSpec
## , , 1, 1
##
## [,1]
## [1,] FALSE
##
## , , 2, 1
##
## [,1]
## [1,] FALSE
##
## , , 3, 1
##
## [,1]
## [1,] FALSE
##
## , , 4, 1
##
## [,1]
## [1,] FALSE
##
## , , 1, 2
##
## [,1]
## [1,] FALSE
##
## , , 2, 2
##
## [,1]
## [1,] FALSE
##
## , , 3, 2
##
## [,1]
## [1,] FALSE
##
## , , 4, 2
##
## [,1]
## [1,] FALSE
##
## , , 1, 3
##
## [,1]
## [1,] FALSE
##
## , , 2, 3
##
## [,1]
## [1,] FALSE
##
## , , 3, 3
##
## [,1]
## [1,] FALSE
##
## , , 4, 3
##
## [,1]
## [1,] FALSE
##
## , , 1, 4
##
## [,1]
## [1,] FALSE
##
## , , 2, 4
##
## [,1]
## [1,] FALSE
##
## , , 3, 4
##
## [,1]
## [1,] FALSE
##
## , , 4, 4
##
## [,1]
## [1,] FALSE
##
##
## $resC$preSpecM
## , , 1, 1
##
## [,1]
## [1,] NA
##
## , , 2, 1
##
## [,1]
## [1,] NA
##
## , , 3, 1
##
## [,1]
## [1,] NA
##
## , , 4, 1
##
## [,1]
## [1,] NA
##
## , , 1, 2
##
## [,1]
## [1,] NA
##
## , , 2, 2
##
## [,1]
## [1,] NA
##
## , , 3, 2
##
## [,1]
## [1,] NA
##
## , , 4, 2
##
## [,1]
## [1,] NA
##
## , , 1, 3
##
## [,1]
## [1,] NA
##
## , , 2, 3
##
## [,1]
## [1,] NA
##
## , , 3, 3
##
## [,1]
## [1,] NA
##
## , , 4, 3
##
## [,1]
## [1,] NA
##
## , , 1, 4
##
## [,1]
## [1,] NA
##
## , , 2, 4
##
## [,1]
## [1,] NA
##
## , , 3, 4
##
## [,1]
## [1,] NA
##
## , , 4, 4
##
## [,1]
## [1,] NA
##
##
## $resC$minUnitsRowCluster
## [1] 1
##
## $resC$minUnitsColCluster
## [1] 1
##
## $resC$maxUnitsRowCluster
## [1] 9999
##
## $resC$maxUnitsColCluster
## [1] 9999
##
## $resC$sameErr
## [1] 1
##
## $resC$nIter
## [1] 22
##
## $resC$combWeights
## , , 1, 1
##
## [,1]
## [1,] 1
##
## , , 2, 1
##
## [,1]
## [1,] 1
##
## , , 3, 1
##
## [,1]
## [1,] 1
##
## , , 4, 1
##
## [,1]
## [1,] 1
##
## , , 1, 2
##
## [,1]
## [1,] 1
##
## , , 2, 2
##
## [,1]
## [1,] 1
##
## , , 3, 2
##
## [,1]
## [1,] 1
##
## , , 4, 2
##
## [,1]
## [1,] 1
##
## , , 1, 3
##
## [,1]
## [1,] 1
##
## , , 2, 3
##
## [,1]
## [1,] 1
##
## , , 3, 3
##
## [,1]
## [1,] 1
##
## , , 4, 3
##
## [,1]
## [1,] 1
##
## , , 1, 4
##
## [,1]
## [1,] 1
##
## , , 2, 4
##
## [,1]
## [1,] 1
##
## , , 3, 4
##
## [,1]
## [1,] 1
##
## , , 4, 4
##
## [,1]
## [1,] 1
##
##
## $resC$exchageClusters
## [,1] [,2] [,3] [,4]
## [1,] 1 1 1 1
## [2,] 1 1 1 1
## [3,] 1 1 1 1
## [4,] 1 1 1 1
##
##
## attr(,"class")
## [1] "optPar"
## [1] 3 3 3 1 1 2 2 2 4 2 1 2 3 3 1 3
We can use the partition the same way we did in concoR
. Add the partition to the network and plot it in igraph
.
Euclidean distance is a method of calculating similarities by comparing common distances from some nodes to other nodes. It may be used for either structural equivalence or automorphic equivalence. Below is a modification of what Carter Butts wrote into sna
.
#Cluster based on structural equivalence
# BEWARE: The blockmodeling package interferes with this function.
# Detach blockmodeling before you begin. detach("package:blockmodeling", unload=TRUE)
eq<-sna::equiv.clust(net,method="euclidean",mode="graph")
# Form a blockmodel
b<-sna::blockmodel(net, eq, h=4, mode = "graph") # h = 4 is the highest you can go for Medici
plot(b) # Plot it
REGE is actually a set of algorithms that compute similarities - or dissimilarities - between vertices that equate to regular equivalence.
REGE
, REGE.for
- Classical REGE or REGGE, as also implemented in Ucinet. Similarities in terms of regular equivalence are computed. The REGE.for is a wrapper for calling the FORTRAN subrutine written by White (1985a), modified to be called by R. The REGE does the same, however it is written in R. The functions with and without “.for” differ only in whether they are implemented in R of FORTRAN. Needless to say, the functions implemented in FORTRAN are much faster.
REGE.ow, REGE.ow.for - The above function, modified so that a best match is searched for each arc separately (and not for both arcs, if they exist, together).
REGE.ownm.for - The above function, modified so that a best match for an outgoing ties is searched on row-normalized network and for incoming ties on column-normalized network.
Militarized interstate disputes are widely thought to be less likely among democratic countries that have high levels of trade and extensive participation in international organizations.
Much of the statistical association typically reported in this literature apparently stems from three components: a) geographical proximity, b) dependence among militarized interstate disputes with the same initiator or target, and c) the higher-order dependencies in these dyadic data.
Once these are incorporated, covariates associated with the Kantian peace tripod (democracy, trade, and international governmental organizations) tend to lose most of their statistical power.
Despite high statistical significance and putative substantive importance, none of the variables representing the Kantian tripod is associated with any substantial degree of predictive power.
Using data from Peterson’s 2014 JCR “Dyadic Trade, Exist costs and conflict”
Abstract:
“Most studies of the link between dyadic trade and militarized conflict examine the extent of trade interaction. However, interaction measures do not account for the impact of cutting off trade (i.e., exit costs). In this article, I highlight the link between exit costs, the cost of conflict, and “the spoils of conquest,” arguing that one state’s exit costs are associated with higher incidence of dyadic conflict when its trade partner’s exit costs are low. However, its exit costs become less aggravating—and eventually pacifying—as its trade partner’s exit costs increase. I test this argument by estimating import demand and export supply elasticities, developing yearly exit cost measures for directed dyads, 1984–2000. Statistical tests confirm that unilaterally high exit costs are aggravating, but that jointly high exit costs are pacifying, a pattern most prominent for trade in strategic commodities."
peterson <- rio::import("./data/JCR_rep_data.dta")
#install.packages("countrycode")
library(countrycode)
peterson$cname1 <- countrycode(peterson$ccode1, "cown", "cowc")
peterson$cname2 <- countrycode(peterson$ccode2, "cown", "cowc")
peterson <- peterson %>% select(ccode1, ccode2, cname1, cname2, year, fcwinit, fcwongo, lndist, fincthc, finctlc, polity1_adj, polity2_adj, polity_int, s_wt_glo)
Description of variables
ccode1
, Correlates of War code number for state 1ccode2
, Correlates of War code number for state 2cname1
, Name State 1cname2
, Name State 2year
, Year of observationfcwinit
, MID initiation t+1fcwongo
, MID ongoing t+1lndist
, natural log of distancefinctlc
, count of low conflict events t+1fincthc
, count of high conflict events t+1polity1_adj
, polity2 combined score for A (+10)polity2_adj
, polity2 combined score for B (+10)polity_int
, polity2 interaction of each state’s combined democracy–autocracy score(rescaled from 0 to 20) from the Polity IV projects_wt_glo
, alliance similarity using Signorino and Ritter’s (1999) global weighted S score (accounts for similar foreign policy preferences)