Adding simulation files
Adding real data to data folder Adding first simulations results
This commit is contained in:
parent
1dc57d5602
commit
38cefffceb
10 changed files with 56228 additions and 9 deletions
BIN
code/data/dore/dore-matrices.Rds
Normal file
BIN
code/data/dore/dore-matrices.Rds
Normal file
Binary file not shown.
55277
code/data/dore/interaction-data.txt
Normal file
55277
code/data/dore/interaction-data.txt
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,162 @@
|
|||
publi;web;latitude;longitude;locationtot;feedingguild1;feedingguild2;samplingyear
|
||||
adaime;adaime2017_A;2.5;-51.5;terra firme forest, floodable areas and savannas, Cal<61>oene municipality, Amapa State, Brazil;fruit eater;NoOrthoptera;2013
|
||||
adaime;adaime2017_B;3.5;-51.8;terra firme forest, floodable areas and savannas, Oiapoque municipality, Amapa State, Brazil;fruit eater;NoOrthoptera;2013
|
||||
Aldryhim;Aldryhim1985;24;-46; Saudi Arabia, Saudi Arabia;sap sucker;NoOrthoptera;1995
|
||||
basset;basset1996;-7.4;146.73;grasslands and forest patches, dominated by secondary forests, Mt Kaindi, Wau, Papua New Guinea;leaf chewing;NoOrthoptera;1993
|
||||
bergamini;bergamini2016;-17.6;-43.6;grasslands, Brazilian Cerrado savannas, Brazil;flower eater;NoOrthoptera;2003
|
||||
bluthgen;bluthgen2006;4.97;117.8;mature lowland evergreen dipterocarp forest , Danun Valley conservation area, Danum Valley, Sabah, Malaysia;leaf chewing;NoOrthoptera;2004
|
||||
bodner;bodner2009;-3.97;-79.98;pristine montane forest, Reserva biologica San Francisco, Zamora-Chinchipe, Ecuador ;leaf chewing;NoOrthoptera;2006
|
||||
Brehm;Brehm2003;-3.97;-79.08;primary disturbed montane rainforest and early successional stages after human disturbances, Estacion Cientifica San Francisco, Zamora Chinchipe, South Ecuador;mixed;NoOrthoptera;2000
|
||||
Brown;Brown2019;14;99.7;lowland seasonal evergreen rainforest, Khao Chong Botanical Garden, Thailand;mixed;NoOrthoptera;2015
|
||||
coley;coley2006;9;-80;moist tropical lowland forest, Barro Colorado Island, Panama;leaf chewing;NoOrthoptera;1999
|
||||
cuevas-reyes;cuevas-reyes;19.49;-104.99;tropical deciduous forest and patches of tropical riparian forest, Chamela-Cuixmala Biosphere reserve, Pacific coast of Jalisco, Mexico;gall maker;NoOrthoptera;2001
|
||||
dyer&gentry;dyer&gentry2002;10.43;-83.98;wetland, La Selva biological station, Costa Rica;leaf chewing;NoOrthoptera;2002
|
||||
garcia&robledo;garcia&robledo2013;10.43;-83.98;aseasonal tropical wet forest, La Sevla Biological Station, Costa Rica;leaf chewing;NoOrthoptera;2011
|
||||
Hackett2019;Hackett2019_HH;50.72;-1.75;ocean-adjacent peninsula consisting of a mosaic of habitats, Hengistbury Head, UK;mixed;NoOrthoptera;2013
|
||||
Hackett2019;Hackett2019_TP;-46.59;169.43;ocean-adjacent peninsula consisting of a mosaic of habitats, Tautuku Peninsula, New Zealand;mixed;NoOrthoptera;2015
|
||||
heleno;heleno2009;37.78;-25.22;native vegetation was cleared for pastures, replaced by production forest or taken over by weeds, Serra da Tronqueira, Sao Miguel, Azores archipelago, Portugal;mixed;NoOrthoptera;2006
|
||||
hemidi;hemidi2013;34.8;5.73; Biskra, Alg<6C>rie;sap sucker;NoOrthoptera;2011
|
||||
henneman&memmott;henneman&memmott1;22.09;-159.56;isolated from agricultural areas, Alakai Swamp, island of Kauai, Hawaii;leaf chewing;NoOrthoptera;2000
|
||||
henneman&memmott;henneman&memmott2;22.09;-159.56;wetland, Alakai Swamp, island of Kauai, Hawaii;leaf chewing;NoOrthoptera;2000
|
||||
Ibanez;Ibanez2013;45.03;6.4;subalpine grasslands, Vilar d'Ar<41>ne, central french alps;leaf chewing;Orthoptera;2011
|
||||
Idechil;Idechil2007;7.5;134.5; Republic of Palau, islands of Palau;sap sucker;NoOrthoptera;2004
|
||||
janzen;janzen1980;10.8;-85.7;deciduous forest with moister habitats , Santa Rosa National Park, Costa Rica;frugivore_seed predator;NoOrthoptera;1980
|
||||
janzen;janzen2003;10.83;-85.6;rainforest, Area de conservation Guanacaste, Costa Rica;leaf chewing;NoOrthoptera;2003
|
||||
joern;joern_altuda;30.4;-103.6;mountainous area with arid grassland plant species, Altuda and Marathon, near Alpine, Texas;leaf chewing;Orthoptera;1975
|
||||
joern;joern_marathon;30.4;-103.6;arid grassland, Alpine, Texas, USA;leaf chewing;Orthoptera;1975
|
||||
Joern1985;Joern1985;41.578544;-101.707547;Arapaho Prairie, upland Sand Hills grassland, Arthur County, Nebraska, USA;leaf chewing;Orthoptera;1985
|
||||
kim&choi;kim&choi2021_A;35.41;127.48;temperate forest, mixed deciduous forest, Sangseonam hornbeam tree forest, South Korea;leaf chewing;NoOrthoptera;2016
|
||||
kim&choi;kim&choi2021_B;35.37;127.57;temperate forest, mixed deciduous forest, Mt Jirisan, banseon oak tree forest, South Korea;leaf chewing;NoOrthoptera;2016
|
||||
Knuff;Knuff2019;47.998955;8.205064;managed forests, southern Black Forest, southwestern Germany;gall maker;NoOrthoptera;2017
|
||||
kollars;kollars2013;48.32;18.1;alluvial soil with high content of clay fraction, Botanical garden of Slovak University of Agriculture, Nitra, Solavakia;mixed;NoOrthoptera;2012
|
||||
Konig2022;Konig2022;47.592457;12.940233;open grassland sites on calcareous bedrock, National Park Berchtesgaden and Lower Franconia, Bavaria, Germany;leaf chewing;Orthoptera;2019
|
||||
lewis;lewis2002;17.07;-88.69;moist tropical forest, Chiquibul Forest reserve, Cayo district, Belize, Central America;leaf miner;NoOrthoptera;1998
|
||||
Macfadyen;Macfadyen_A1;51.4;-2.69;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_A10;51;-2.49;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_A2;51.55;-2.49;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_A3;51.51;-2.42;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_A4;51.52;-2.49;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_A5;51.51;-2.5;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_A6;51.52;-2.48;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_A7;51.32;-2.35;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_A8;51.36;-2.47;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_A9;51.32;-2.34;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B1;5.421563;-2.6801987;temperate grassland, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B2;51.291623;-2.6028854;pasture fields, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B3;51.29728;-2.4066504;pasture fields, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B4;51.126799;-2.3271997;pasture fields, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B5;51.069394;-2.4322512;pasture fields, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B6;51.614902;-2.3436984;pasture fields, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B7;51.694362;-2.1084028;pasture fields, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B8;51.638776;-2.1769368;pasture fields, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B9;51.685258;-2.0148078;pasture fields, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
Macfadyen;Macfadyen_B10;51.142195;-2.2890993;pasture fields, 10 organic farms in UK, south west England;mixed;NoOrthoptera;2006
|
||||
martins;martins2020;-17.6;-43.6;grasslands, Brazilian Cerrado , Brazil;flower eater;NoOrthoptera;2005
|
||||
Masetti;Masetti2004_A;44.16;12.22;near a 5 yr hedgerow, potato, wheat, alfalfa and wine grapes, Centro Ricerche produzioni Vegetali, Bologna Province, Italia;leaf miner;NoOrthoptera;1999
|
||||
Masetti;Masetti2004_B;45;12;near a 4 yr hedgerow, corn, wheat and beets, Bologna Province, Italia, Bologna Province, Italia;leaf miner;NoOrthoptera;1999
|
||||
Masetti;Masetti2004_C;45;12;near a 6 yr hederow and a ditch, Bologna Province, Italia, Bologna Province, Italia;leaf miner;NoOrthoptera;1999
|
||||
massa;massa2001_A;37.6;14; Sicily, Italy;leaf miner;NoOrthoptera;2000
|
||||
massa;massa2001_B;30;35; Al Bahhath, Aqaba and Dana Village, Jordan;leaf miner;NoOrthoptera;1999
|
||||
memmott;memmott1994;10.83;-85.7;tropical dry forest, Santa Rosa National Park, Guanacaste, Costa Rica;leaf miner;NoOrthoptera;1990
|
||||
muller;muller1999;51.4;-0.64;heavily grazed field, Silwood Park, Berkshire, England;sap sucker;NoOrthoptera;1995
|
||||
nakagawa;nakagawa_1;4.33;113.83;humult and udult soils, Lambir Hills National Park, Sarawak, Malaysia;seed predator;NoOrthoptera;1998
|
||||
nakagawa;nakagawa_2;4.33;113.83;tropical lowland forest, Lambir Hills National Park, Malaysia;seed predator;NoOrthoptera;1998
|
||||
novotny1;novotny2005;-5.23;145.4;primary and secondary forests, Madang province, Papua New Guinea;fruit eater;NoOrthoptera;2001
|
||||
novotny2;novotny2012;-5.23;145.4;tropical lowland forest, Madang province, Papua New Guinea;mixed;NoOrthoptera;2008
|
||||
pearson&altermatt;pearson&altermatt2013;48.54;9.04; Baden W<>rttemberg, Germany;leaf chewing;NoOrthoptera;2005
|
||||
Peralta;Peralta2017;-41.49228;173.022973;native Nothofagaceae forest and exotic pine plantations, native and exotic plantation forests, New Zealand;leaf chewing;NoOrthoptera;2011
|
||||
Pitteloud;Pitteloud2020_B1;46.25788;7.02235;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_B2;46.26914;7.03241;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_B3;46.27424;7.04833;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_B4;46.28629;7.0957;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_B5.1;46.28567;7.12451;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_B5.2;46.29149;7.11251;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_B6;46.26865;7.10755;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_B7;46.27683;7.15518;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_B8;46.26852;7.16232;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_C1;46.86999;9.5166;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_C2;46.87022;9.50919;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_C3;46.8743;9.5083;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_C4;46.87021;9.48978;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_C5;46.87841;9.49396;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_C6;46.88867;9.48989;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_C7;46.88946;9.48001;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_C8;46.89054;9.47624;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_F1;46.4732;8.81948;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_F2;46.4887;8.79271;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_F3;46.4951;8.78085;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_F4;46.5028;8.7816;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_F5;46.50577;8.7947;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_F6;46.50891;8.77677;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_F7;46.51244;8.77881;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_F8;46.51553;8.78595;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_G1;46.63493;7.90025;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_G2;46.63957;7.9796;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_G3;46.64264;7.97271;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_G4;46.64737;7.97086;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_G5;46.64949;7.9509;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_G6;46.65319;7.94267;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_G7;46.65756;7.99056;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_G8;46.66035;7.9805;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_M1;46.12583;7.08096;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_M2;46.06652;7.14868;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_M3;46.05299;7.15534;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_M4;46.01957;7.1621;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_M5;46.02743;7.17717;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_M6;46.03024;7.17648;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_M7;46.03573;7.17791;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_M8;46.03712;7.18249;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_S1;46.31328;7.58466;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_S2;46.32012;7.57929;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_S3;46.3251;7.5532;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_S4;46.33103;7.56003;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_S5;46.3353;7.53348;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_S6;46.34787;7.5386;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_S7;46.34687;7.52317;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
Pitteloud;Pitteloud2020_S8;46.35071;7.52571;alpine open grasslands, open grasslands in Swiss Alps, Switzerland;leaf chewing;Orthoptera;2016
|
||||
pocock;pocock2012_aphid;51.31;-2.32;mixed farm: 50% arable, 50% grass pasture or ley, Norwood Farm, Somerset, UK;mixed;NoOrthoptera;2008
|
||||
prado;prado2004;-19;-43;high plant diversity and endemism, Campos rupestres, Brazil;flower eater;NoOrthoptera;1996
|
||||
Saavedra;Saavedra2017_initial_A;19.575694;-105.035162;tropical dry forest succession, Chamela<6C>Cuixmala Biosphere Reserve, forest succession - recently abandoned pastures, early successional forests abandoned and intermediate successional forests abandoned, Mexico;leaf chewing;NoOrthoptera;2010
|
||||
Saavedra;Saavedra2017_initial_B;19.572095;-105.054989;tropical dry forest succession, Chamela<6C>Cuixmala Biosphere Reserve, forest succession - recently abandoned pastures, early successional forests abandoned and intermediate successional forests abandoned, Mexico;leaf chewing;NoOrthoptera;2010
|
||||
Saavedra;Saavedra2017_initial_C;19.416939;-104.895751;tropical dry forest succession, Chamela<6C>Cuixmala Biosphere Reserve, forest succession - recently abandoned pastures, early successional forests abandoned and intermediate successional forests abandoned, Mexico;leaf chewing;NoOrthoptera;2010
|
||||
Saavedra;Saavedra2017_middle_A;19.610383;-105.027566;tropical dry forest succession, Chamela<6C>Cuixmala Biosphere Reserve, forest succession - recently abandoned pastures, early successional forests abandoned and intermediate successional forests abandoned, Mexico;leaf chewing;NoOrthoptera;2010
|
||||
Saavedra;Saavedra2017_middle_B;19.578039;-105.040484;tropical dry forest succession, Chamela<6C>Cuixmala Biosphere Reserve, forest succession - recently abandoned pastures, early successional forests abandoned and intermediate successional forests abandoned, Mexico;leaf chewing;NoOrthoptera;2010
|
||||
Saavedra;Saavedra2017_middle_C;19.509043;-104.9256;tropical dry forest succession, Chamela<6C>Cuixmala Biosphere Reserve, forest succession - recently abandoned pastures, early successional forests abandoned and intermediate successional forests abandoned, Mexico;leaf chewing;NoOrthoptera;2010
|
||||
Saavedra;Saavedra2017_late_A;19.603551;-105.090781;tropical dry forest succession, Chamela<6C>Cuixmala Biosphere Reserve, forest succession - recently abandoned pastures, early successional forests abandoned and intermediate successional forests abandoned, Mexico;leaf chewing;NoOrthoptera;2010
|
||||
Saavedra;Saavedra2017_late_B;19.596921;-105.033532;tropical dry forest succession, Chamela<6C>Cuixmala Biosphere Reserve, forest succession - recently abandoned pastures, early successional forests abandoned and intermediate successional forests abandoned, Mexico;leaf chewing;NoOrthoptera;2010
|
||||
Saavedra;Saavedra2017_late_C;19.498545;-104.931694;tropical dry forest succession, Chamela<6C>Cuixmala Biosphere Reserve, forest succession - recently abandoned pastures, early successional forests abandoned and intermediate successional forests abandoned, Mexico;leaf chewing;NoOrthoptera;2010
|
||||
Sanjaya2016;Sanjaya2016;-6.862444;107.595211;Botanical Garden UPI, Bandung, Indonesia;fruit eater;NoOrthoptera;2012
|
||||
Santos;Santos2006;-29.8;-51.77; Taquari, Rio Grande do Sul, Bazil;leaf miner;NoOrthoptera;2004
|
||||
SantosdeAraujo2019;SantosdeAraujo2019;48.318611;18.081944;Nitra City Park, Nitra, Slovakia;gall maker;NoOrthoptera;2008
|
||||
seifert;seifert2020_A;42.71;141.6;temperate lowland forest, Tomakomai, Hokkaido, Japan;leaf chewing;NoOrthoptera;2015
|
||||
seifert;seifert2020_B;38.9;-78.41;temperate lowland forest, Toms Brook, Virginia, USA;leaf chewing;NoOrthoptera;2017
|
||||
seifert;seifert2020_C;48.7;16.95;temperate lowland forest, Lanzhot , Czech Republic;leaf chewing;NoOrthoptera;2015
|
||||
shimada;shimada2020;35.039324;135.187705;paddy fields and grasslands, agricultural landscape, Japan;sap sucker;NoOrthoptera;2019
|
||||
Shinohara;Shinohara2019_Abandoned_1;35.495752;135.893636;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Abandoned_2;35.507486;135.909609;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Abandoned_3;35.489386;135.897067;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Abandoned_4;35.565453;135.908289;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Extensively_managed_1;35.498043;135.895563;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Extensively_managed_2;35.50826;135.908896;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Extensively_managed_3;35.489949;135.89785;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Extensively_managed_4;35.561526;135.905618;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Intensively_managed_1;35.498448;135.898817;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Intensively_managed_2;35.509203;135.907169;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Intensively_managed_3;35.489111;135.89987;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Shinohara;Shinohara2019_Intensively_managed_4;35.563264;135.907279;seminatural grasslands, agricultural landscape, Wakasa town, Fukui Prefecture in central Japan, Japan;mixed;NoOrthoptera;2016
|
||||
Silveira2021;Silveira2021_nonpreserved;-16.788637;-43.880394;Neotropical savanna areas in anthropized landscapes, northern Minas Gerais State, Brazil;mixed;mixed;2019
|
||||
Silveira2021;Silveira2021_preserved;-17.358135;-44.259766;Neotropical savanna areas in preserved landscapes, northern Minas Gerais State, Brazil;mixed;mixed;2019
|
||||
stary;stary2008;49.51;14.93;managed forests, Techobuz, Czech;sap sucker;NoOrthoptera;2007
|
||||
sugiura;sugiura2020;26.67;142.98;many endemic organisms: vascular plants and insects, Ogasawara Village, Tokyo metropolitan, Japan;mixed;NoOrthoptera;2008
|
||||
Sugiura2010;Sugiura2010;27.073072;142.217277;subtropical Ogasawara islands, Japan;mixed;NoOrthoptera;2008
|
||||
Szpeiner2008;Szpeiner2008;-31.403573;-64.144999;ornemental plants, Cordoba city, Argentina;sap sucker;NoOrthoptera;2002
|
||||
Tahar2015;Tahar2015;34.834667;5.738862;Biskra province, Algeria;sap sucker;NoOrthoptera;2014
|
||||
tavakilian;tavakilian1997;5.41;-52.97;swamp forests to mixed forests on well-drained soil, Sinnamary River Basin, French Guiana;deadwood eater;NoOrthoptera;1993
|
||||
tcharntke;tcharntke;49;8.32; Karlsruhe, southwest Germany;leaf miner;NoOrthoptera;1989
|
||||
Todorov2014;Todorov2014;42.157088;24.82175;Experimentally Field of Agriculture University, Agro-ecosystems, Plovdiv Region, Bulgaria;sap sucker;NoOrthoptera;2006
|
||||
ueckert;ueckert;40.17;-103.21;mixed-grass prairie, 27 km north of Akron, Washington county, Colorado;leaf chewing;Orthoptera;1968
|
||||
Volf2017;Volf2017_Tomakomai;42.716667;141.6;Tomakomai forest, Japan;mixed;NoOrthoptera;2014
|
||||
Volf2017;Volf2017_Lanzhot;48.8;17.083333;Lanzhot forest, Czech Republic;mixed;NoOrthoptera;2014
|
||||
Volf2017;Volf2017_Mikulcice;48.683333;16.933333;Mikulcice forest, Czech Republic;mixed;NoOrthoptera;2014
|
||||
Xi2020;Xi2020;32.763004;102.518629;alpine meadow in the eastern Qinghai-Tibetan Plateau, Hongyuan County, Sichuan Province, China;seed predator;NoOrthoptera;2016
|
||||
Zhu;Zhu2018;23.45;111.883333;subtropical forest, subtropical forest located within Heishiding Nature Reserve, south China, China;leaf chewing;NoOrthoptera;2014
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
192
code/simulations/simulations_NA_robustness.R
Normal file
192
code/simulations/simulations_NA_robustness.R
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
necessary_packages <- c(
|
||||
"remotes", "tictoc", "pROC", "sbm", "parallel", "colSBM"
|
||||
)
|
||||
|
||||
if (!all((necessary_packages %in% installed.packages()))) {
|
||||
install.packages(necessary_packages[-length(necessary_packages)])
|
||||
remotes::install_github(repo = "Chabert-Liddell/colSBM@merge-bipartite-2")
|
||||
}
|
||||
|
||||
|
||||
library("sbm")
|
||||
library("pROC")
|
||||
library("colSBM")
|
||||
|
||||
set.seed(1234)
|
||||
|
||||
eps <- 0.05
|
||||
|
||||
M <- 3
|
||||
|
||||
# Defining parameters
|
||||
nr <- 100
|
||||
nc <- 150
|
||||
pir <- c(0.5, 0.3, 0.2)
|
||||
pic <- c(0.5, 0.3, 0.2)
|
||||
alpha <- matrix(c(
|
||||
0.7, 0.4, 0.3,
|
||||
0.4, 0.2, eps,
|
||||
0.3, eps, eps
|
||||
), byrow = TRUE, nrow = length(pir), ncol = length(pic))
|
||||
|
||||
max_repetition <- 10
|
||||
|
||||
# Collections
|
||||
collections <- list(
|
||||
"iid" = generate_bipartite_collection(nr, nc,
|
||||
pir, pic,
|
||||
alpha, M,
|
||||
model = "iid",
|
||||
return_memberships = TRUE
|
||||
),
|
||||
"pi" = generate_bipartite_collection(nr, nc,
|
||||
pir, pic,
|
||||
alpha, M,
|
||||
model = "pi",
|
||||
return_memberships = TRUE
|
||||
),
|
||||
"rho" = generate_bipartite_collection(nr, nc,
|
||||
pir, pic,
|
||||
alpha, M,
|
||||
model = "rho",
|
||||
return_memberships = TRUE
|
||||
),
|
||||
"pirho" = generate_bipartite_collection(nr, nc,
|
||||
pir, pic,
|
||||
alpha, M,
|
||||
model = "pirho",
|
||||
return_memberships = TRUE
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
conditions <- expand.grid(
|
||||
prop_NAs = seq(from = 0, to = 0.9, by = 0.1),
|
||||
model = c("iid", "pi", "rho", "pirho"),
|
||||
repetition = seq.int(max_repetition)
|
||||
)
|
||||
|
||||
|
||||
# Data params
|
||||
main_dir <- file.path("code", "results", "simulations", "NA_robustness")
|
||||
|
||||
if (!dir.exists(main_dir)) {
|
||||
dir.create(main_dir, recursive = TRUE)
|
||||
}
|
||||
|
||||
start_time <- format(Sys.time(), "%d-%m-%Y_%H-%M-%S")
|
||||
temp_dir <- file.path(main_dir, paste0("tmp", start_time))
|
||||
|
||||
if (!dir.exists(temp_dir)) {
|
||||
dir.create(temp_dir, recursive = TRUE)
|
||||
}
|
||||
|
||||
file_save <- file.path(main_dir, paste0(
|
||||
"NA_robustness",
|
||||
start_time, "_1-", nrow(conditions), ".Rds"
|
||||
))
|
||||
|
||||
result_list <- parallel::mclapply(seq_len(nrow(conditions)), function(current) {
|
||||
# Looping over conditions
|
||||
prop_NAs <- conditions[current, ]$prop_NAs
|
||||
model <- as.character(conditions[current, ]$model)
|
||||
bipartite_collection <- collections[[model]]
|
||||
|
||||
# This is a list of the M incidence matrices
|
||||
bipartite_collection_incidence <- lapply(seq.int(M), function(m) {
|
||||
bipartite_collection[[m]]$incidence_matrix
|
||||
})
|
||||
|
||||
# Sampling values to replace by NAs
|
||||
NAs_index <- sample(
|
||||
seq_len(length(bipartite_collection_incidence[[1]])),
|
||||
floor(prop_NAs * length(bipartite_collection_incidence[[1]]))
|
||||
)
|
||||
|
||||
real_val_NAs <- bipartite_collection_incidence[[1]][NAs_index]
|
||||
bipartite_collection_incidence[[1]][NAs_index] <- NA
|
||||
NAs_coordinates <- which(is.na(bipartite_collection_incidence[[1]]),
|
||||
arr.ind = TRUE
|
||||
)
|
||||
|
||||
Z <- lapply(seq.int(M), function(m) {
|
||||
list(
|
||||
bipartite_collection[[m]]$row_blockmemberships,
|
||||
bipartite_collection[[m]]$col_blockmemberships
|
||||
)
|
||||
})
|
||||
|
||||
start_time <- Sys.time()
|
||||
mybisbmpop <- estimate_colBiSBM(
|
||||
netlist = bipartite_collection_incidence, colsbm_model = model,
|
||||
nb_run = 1,
|
||||
global_opts = list(
|
||||
nb_cores = parallel::detectCores() - 1, verbosity = 0
|
||||
)
|
||||
)
|
||||
stop_time <- Sys.time()
|
||||
|
||||
baseline_LBM <- estimate_colBiSBM(
|
||||
netlist = bipartite_collection_incidence[[1]], colsbm_model = model,
|
||||
nb_run = 1,
|
||||
global_opts = list(
|
||||
nb_cores = parallel::detectCores() - 1, verbosity = 0
|
||||
)
|
||||
)
|
||||
|
||||
# Predicted links
|
||||
X_hat_LBM <- baseline_LBM$best_fit$tau[[1]][[1]] %*% baseline_LBM$best_fit$alpha %*% t(baseline_LBM$best_fit$tau[[1]][[2]])
|
||||
X_hat <- mybisbmpop$best_fit$tau[[1]][[1]] %*% mybisbmpop$best_fit$alpha %*% t(mybisbmpop$best_fit$tau[[1]][[2]])
|
||||
|
||||
# Compute ROC and AUC
|
||||
auc_LBM <- auc(c(0, 1, real_val_NAs), c(0, 1, X_hat_LBM[NAs_index]))
|
||||
auc_colBiSBM <- auc(c(0, 1, real_val_NAs), c(0, 1, X_hat[NAs_index]))
|
||||
|
||||
# Computing ARI on the NAs
|
||||
out_data_frame <- data.frame(
|
||||
prop_NAs = prop_NAs,
|
||||
model = model,
|
||||
repetition = conditions[current, ]$repetition,
|
||||
auc_LBM = auc_LBM,
|
||||
auc_colBiSBM = auc_colBiSBM,
|
||||
LBM_ari_row = aricode::ARI(
|
||||
Z[[1]][[1]],
|
||||
baseline_LBM$best_fit$Z[[1]][[1]]
|
||||
),
|
||||
LBM_ari_col = aricode::ARI(
|
||||
Z[[1]][[2]],
|
||||
baseline_LBM$best_fit$Z[[1]][[2]]
|
||||
),
|
||||
NA_net_ari_row = aricode::ARI(
|
||||
Z[[1]][[1]],
|
||||
mybisbmpop$best_fit$Z[[1]][[1]]
|
||||
),
|
||||
NA_net_ari_col = aricode::ARI(
|
||||
Z[[1]][[2]],
|
||||
mybisbmpop$best_fit$Z[[1]][[2]]
|
||||
),
|
||||
elapsed_secs = difftime(stop_time, start_time, units = "sec")
|
||||
)
|
||||
|
||||
message("Finished step ", current, "/", nrow(conditions), "\n")
|
||||
|
||||
# Saving temp
|
||||
temp_file_save <- file.path(temp_dir, paste0(
|
||||
"conditions_", current, "_on_",
|
||||
nrow(conditions), ".Rds"
|
||||
))
|
||||
|
||||
saveRDS(out_data_frame, file = temp_file_save)
|
||||
|
||||
return(out_data_frame)
|
||||
},
|
||||
mc.cores = parallel::detectCores() - 1
|
||||
)
|
||||
|
||||
result_dataframe <- do.call("rbind", result_list)
|
||||
|
||||
|
||||
saveRDS(
|
||||
result_dataframe,
|
||||
file = file_save
|
||||
)
|
||||
335
code/simulations/simulations_inference_bernoulli.R
Normal file
335
code/simulations/simulations_inference_bernoulli.R
Normal file
|
|
@ -0,0 +1,335 @@
|
|||
necessary_packages <- c(
|
||||
"remotes", "tictoc", "combinat", "parallel", "colSBM"
|
||||
)
|
||||
|
||||
if (!all((necessary_packages %in% installed.packages()))) {
|
||||
install.packages(necessary_packages[-length(necessary_packages)])
|
||||
remotes::install_github(repo = "Chabert-Liddell/colSBM@merge-bipartite-2")
|
||||
}
|
||||
|
||||
# Sourcing all necessary files
|
||||
suppressPackageStartupMessages(library(colSBM))
|
||||
|
||||
set.seed(1234)
|
||||
|
||||
# Network param
|
||||
nr <- 120
|
||||
nc <- 120
|
||||
M <- 2
|
||||
|
||||
# Changing parameters
|
||||
base_alpha <- matrix(0.25, nrow = 4, ncol = 4)
|
||||
epsilon_alpha <- seq(from = 0.0, to = 0.24, by = 0.03)
|
||||
|
||||
base_pi1 <- c(0.2, 0.4, 0.4, 0)
|
||||
rho1 <- rep(0.25, 4)
|
||||
|
||||
pi2 <- rep(0.25, 4)
|
||||
base_rho2 <- c(0, 1 / 3, 1 / 3, 1 / 3)
|
||||
|
||||
pi1 <- matrix(unlist(combinat::permn(base_pi1)), byrow = TRUE, ncol = 4L)
|
||||
pi1 <- pi1[!duplicated(pi1), ]
|
||||
|
||||
rho2 <- matrix(unlist(combinat::permn(base_rho2)), byrow = TRUE, ncol = 4L)
|
||||
rho2 <- rho2[!duplicated(rho2), ]
|
||||
|
||||
repetition <- seq.int(3L)
|
||||
|
||||
conditions <- tidyr::crossing(epsilon_alpha, pi1, rho2, repetition)
|
||||
|
||||
# Filter conditions to prevent the same blocks from being empty
|
||||
conditions <- conditions[
|
||||
!apply(
|
||||
conditions[["pi1"]][, 1L:4L] == 0L &
|
||||
conditions[["rho2"]][, 1L:4L] == 0L,
|
||||
1L, any
|
||||
),
|
||||
]
|
||||
|
||||
# To speed up computations and debug adding an argument based selection
|
||||
if (!exists("arg")) {
|
||||
arg <- commandArgs(trailingOnly = TRUE)
|
||||
}
|
||||
if (identical(arg, character(0L))) {
|
||||
cat(
|
||||
"\nNo arguments provided,",
|
||||
"assuming you want to go over all the conditions."
|
||||
)
|
||||
arg <- c(1L, nrow(conditions))
|
||||
} else {
|
||||
arg <- as.numeric(arg)
|
||||
}
|
||||
if (arg[[1L]] < 1L || arg[[1L]] > nrow(conditions)) {
|
||||
warning("Arg 1 was invalid, set to 1.")
|
||||
arg[[1L]] <- 1L
|
||||
}
|
||||
if (arg[[2L]] > nrow(conditions) || arg[[2L]] < 1L) {
|
||||
warning("Arg 2 was invalid, set to ", nrow(conditions))
|
||||
arg[[2L]] <- nrow(conditions)
|
||||
}
|
||||
|
||||
choosed_conditions <- seq.int(from = arg[1], to = arg[2])
|
||||
|
||||
conditions <- conditions[choosed_conditions, ]
|
||||
|
||||
# Data params
|
||||
main_dir <- file.path("code", "results", "simulations", "inference", "bernoulli")
|
||||
|
||||
if (!dir.exists(main_dir)) {
|
||||
dir.create(main_dir, recursive = TRUE)
|
||||
}
|
||||
|
||||
start_time <- format(Sys.time(), "%d-%m-%Y_%H-%M-%S")
|
||||
temp_dir <- file.path(main_dir, paste0("tmp", start_time))
|
||||
|
||||
if (!dir.exists(temp_dir)) {
|
||||
dir.create(temp_dir, recursive = TRUE)
|
||||
}
|
||||
|
||||
file_save <- file.path(main_dir, paste0("bernoulli_inference_", start_time, "_", arg[1], "-", arg[2], ".Rds"))
|
||||
|
||||
tictoc::tic()
|
||||
|
||||
conditions_rows <- seq_len(nrow(conditions))
|
||||
results <- parallel::mclapply(conditions_rows, function(s) {
|
||||
start_time_condition <- Sys.time()
|
||||
ea <- conditions[s, ]$epsilon_alpha
|
||||
current_pi1 <- conditions[s, ]$pi1
|
||||
current_rho2 <- conditions[s, ]$rho2
|
||||
|
||||
current_alpha <- base_alpha + matrix(
|
||||
c(
|
||||
3 * ea, 2 * ea, ea, -ea,
|
||||
2 * ea, 2 * ea, -ea, ea,
|
||||
ea, -ea, ea, 2 * ea,
|
||||
-ea, ea, 2 * ea, 0
|
||||
),
|
||||
byrow = TRUE, nrow = 4, ncol = 4
|
||||
)
|
||||
|
||||
# Compute supports
|
||||
Cpi1 <- matrix(c(current_pi1, pi2), byrow = TRUE, nrow = M) > 0
|
||||
Cpi2 <- matrix(c(rho1, current_rho2), byrow = TRUE, nrow = M) > 0
|
||||
|
||||
netlist_generated <- list(
|
||||
generate_bipartite_collection(
|
||||
nr, nc, conditions[s, ]$pi1, rho1,
|
||||
current_alpha,
|
||||
M = 1, distribution = "bernoulli",
|
||||
return_memberships = TRUE
|
||||
)[[1]],
|
||||
generate_bipartite_collection(
|
||||
nr, nc, pi2, conditions[s, ]$rho2,
|
||||
current_alpha,
|
||||
distribution = "bernoulli",
|
||||
M = 1, return_memberships = TRUE
|
||||
)[[1]]
|
||||
)
|
||||
netlist <- lapply(seq_along(netlist_generated), function(m) {
|
||||
return(netlist_generated[[m]]$incidence_matrix)
|
||||
})
|
||||
|
||||
row_clusterings <- lapply(seq_along(netlist_generated), function(m) {
|
||||
return(netlist_generated[[m]]$row_blockmemberships)
|
||||
})
|
||||
|
||||
col_clusterings <- lapply(seq_along(netlist_generated), function(m) {
|
||||
return(netlist_generated[[m]]$col_blockmemberships)
|
||||
})
|
||||
|
||||
full_row_clustering <- as.vector(sapply(
|
||||
seq.int(M),
|
||||
function(m) row_clusterings[[m]]
|
||||
))
|
||||
|
||||
full_col_clustering <- as.vector(sapply(
|
||||
seq.int(M),
|
||||
function(m) col_clusterings[[m]]
|
||||
))
|
||||
|
||||
fitted_bisbmpop_iid <- estimate_colBiSBM(
|
||||
netlist = netlist,
|
||||
colsbm_model = "iid",
|
||||
nb_run = 1,
|
||||
distribution = "bernoulli",
|
||||
global_opts = list(
|
||||
verbosity = 0,
|
||||
plot_details = 0,
|
||||
nb_cores = parallel::detectCores() - 1
|
||||
)
|
||||
)
|
||||
|
||||
# Handling a problem with sep_BiSBM$M
|
||||
fitted_bisbmpop_iid$sep_BiSBM$M <- fitted_bisbmpop_iid$M
|
||||
sep_BiSBM <- fitted_bisbmpop_iid$sep_BiSBM
|
||||
|
||||
fitted_bisbmpop_pi <- estimate_colBiSBM(
|
||||
netlist = netlist,
|
||||
colsbm_model = "pi",
|
||||
nb_run = 1,
|
||||
distribution = "bernoulli",
|
||||
global_opts = list(
|
||||
verbosity = 0,
|
||||
plot_details = 0,
|
||||
nb_cores = parallel::detectCores() - 1
|
||||
),
|
||||
sep_BiSBM = sep_BiSBM
|
||||
)
|
||||
|
||||
fitted_bisbmpop_rho <- estimate_colBiSBM(
|
||||
netlist = netlist,
|
||||
colsbm_model = "rho",
|
||||
nb_run = 1,
|
||||
distribution = "bernoulli",
|
||||
global_opts = list(
|
||||
verbosity = 0,
|
||||
plot_details = 0,
|
||||
nb_cores = parallel::detectCores() - 1
|
||||
),
|
||||
sep_BiSBM = sep_BiSBM
|
||||
)
|
||||
|
||||
fitted_bisbmpop_pirho <- estimate_colBiSBM(
|
||||
netlist = netlist,
|
||||
colsbm_model = "pirho",
|
||||
nb_run = 1,
|
||||
distribution = "bernoulli",
|
||||
global_opts = list(
|
||||
verbosity = 0,
|
||||
plot_details = 0,
|
||||
nb_cores = parallel::detectCores() - 1
|
||||
),
|
||||
sep_BiSBM = sep_BiSBM
|
||||
)
|
||||
|
||||
stop_time_condition <- Sys.time()
|
||||
|
||||
## Preparing date for export
|
||||
# BICLs
|
||||
sep_BICL <- sum(sep_BiSBM$BICL)
|
||||
iid_BICL <- fitted_bisbmpop_iid$best_fit$BICL
|
||||
pi_BICL <- fitted_bisbmpop_pi$best_fit$BICL
|
||||
rho_BICL <- fitted_bisbmpop_rho$best_fit$BICL
|
||||
pirho_BICL <- fitted_bisbmpop_pirho$best_fit$BICL
|
||||
BICLs <- c(sep_BICL, iid_BICL, pi_BICL, rho_BICL, pirho_BICL)
|
||||
|
||||
# ARIs
|
||||
compute_mean_ARI <- function(model) {
|
||||
# We compute the mean amongst the two networks and return values for
|
||||
# rows and columns in a vector
|
||||
# sapply ives a matrix with in row the axis ARIs
|
||||
# and in columns the networks
|
||||
# 1 2
|
||||
# ax row1 row2
|
||||
# ay col1 col2
|
||||
rowMeans(sapply(seq.int(model$M), function(m) {
|
||||
matrix(c(
|
||||
aricode::ARI(model$Z[[m]][[1]], row_clusterings[[m]]),
|
||||
aricode::ARI(model$Z[[m]][[2]], col_clusterings[[m]])
|
||||
), nrow = 2, ncol = 1)
|
||||
}))
|
||||
}
|
||||
sep_mean_ARIs <- compute_mean_ARI(sep_BiSBM)
|
||||
iid_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_iid$best_fit)
|
||||
pi_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_pi$best_fit)
|
||||
rho_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_rho$best_fit)
|
||||
pirho_mean_ARIs <- compute_mean_ARI(fitted_bisbmpop_pirho$best_fit)
|
||||
|
||||
compute_double_ARI <- function(model) {
|
||||
model_row_Z <- as.vector(sapply(
|
||||
seq.int(model$M),
|
||||
function(m) model$Z[[m]][[1]]
|
||||
))
|
||||
|
||||
model_col_Z <- as.vector(sapply(
|
||||
seq.int(model$M),
|
||||
function(m) model$Z[[m]][[2]]
|
||||
))
|
||||
|
||||
return(list(
|
||||
aricode::ARI(model_row_Z, full_row_clustering),
|
||||
aricode::ARI(model_col_Z, full_col_clustering)
|
||||
))
|
||||
}
|
||||
|
||||
sep_double_ARIs <- compute_double_ARI(fitted_bisbmpop_iid$sep_BiSBM)
|
||||
iid_double_ARIs <- compute_double_ARI(fitted_bisbmpop_iid$best_fit)
|
||||
pi_double_ARIs <- compute_double_ARI(fitted_bisbmpop_pi$best_fit)
|
||||
rho_double_ARIs <- compute_double_ARI(fitted_bisbmpop_rho$best_fit)
|
||||
pirho_double_ARIs <- compute_double_ARI(fitted_bisbmpop_pirho$best_fit)
|
||||
|
||||
data_frame_output <- data.frame(
|
||||
# The conditions
|
||||
epsilon_alpha = ea,
|
||||
pi1 = current_pi1,
|
||||
rho2 = current_rho2,
|
||||
repetition = as.numeric(conditions[s, 4]),
|
||||
# The results
|
||||
## sep
|
||||
sep_BICL = sep_BICL,
|
||||
sep_mean_row_ARI = sep_mean_ARIs[1],
|
||||
sep_mean_col_ARI = sep_mean_ARIs[2],
|
||||
sep_double_row_ARI = sep_double_ARIs[[1]],
|
||||
sep_double_col_ARI = sep_double_ARIs[[2]],
|
||||
|
||||
## iid
|
||||
iid_BICL = iid_BICL,
|
||||
iid_mean_row_ARI = iid_mean_ARIs[1],
|
||||
iid_mean_col_ARI = iid_mean_ARIs[2],
|
||||
iid_double_row_ARI = iid_double_ARIs[[1]],
|
||||
iid_double_col_ARI = iid_double_ARIs[[2]],
|
||||
iid_Q1 = fitted_bisbmpop_iid$best_fit$Q[1],
|
||||
iid_Q2 = fitted_bisbmpop_iid$best_fit$Q[2],
|
||||
|
||||
## pi
|
||||
pi_BICL = pi_BICL,
|
||||
pi_mean_row_ARI = pi_mean_ARIs[1],
|
||||
pi_mean_col_ARI = pi_mean_ARIs[2],
|
||||
pi_double_row_ARI = pi_double_ARIs[[1]],
|
||||
pi_double_col_ARI = pi_double_ARIs[[2]],
|
||||
pi_Q1 = fitted_bisbmpop_pi$best_fit$Q[1],
|
||||
pi_Q2 = fitted_bisbmpop_pi$best_fit$Q[2],
|
||||
|
||||
## pi
|
||||
rho_BICL = rho_BICL,
|
||||
rho_mean_row_ARI = rho_mean_ARIs[1],
|
||||
rho_mean_col_ARI = rho_mean_ARIs[2],
|
||||
rho_double_row_ARI = rho_double_ARIs[[1]],
|
||||
rho_double_col_ARI = rho_double_ARIs[[2]],
|
||||
rho_Q1 = fitted_bisbmpop_rho$best_fit$Q[1],
|
||||
rho_Q2 = fitted_bisbmpop_rho$best_fit$Q[2],
|
||||
|
||||
## pirho
|
||||
pirho_BICL = pirho_BICL,
|
||||
pirho_mean_row_ARI = pirho_mean_ARIs[1],
|
||||
pirho_mean_col_ARI = pirho_mean_ARIs[2],
|
||||
pirho_double_row_ARI = pirho_double_ARIs[[1]],
|
||||
pirho_double_col_ARI = pirho_double_ARIs[[2]],
|
||||
pirho_Q1 = fitted_bisbmpop_pirho$best_fit$Q[1],
|
||||
pirho_Q2 = fitted_bisbmpop_pirho$best_fit$Q[2],
|
||||
|
||||
elapsed_secs = difftime(stop_time_condition,
|
||||
start_time_condition, units = "sec")
|
||||
)
|
||||
message("Finished step ", s, "/", nrow(conditions), "\n")
|
||||
|
||||
# Saving temp
|
||||
temp_file_save <- file.path(temp_dir, paste0(
|
||||
"conditions_", s, "_on_",
|
||||
nrow(conditions), ".Rds"
|
||||
))
|
||||
|
||||
saveRDS(object = data_frame_output, file = temp_file_save)
|
||||
|
||||
return(data_frame_output)
|
||||
},
|
||||
mc.cores = parallel::detectCores() - 1
|
||||
)
|
||||
|
||||
|
||||
tictoc::toc()
|
||||
full_data_frame <- do.call(rbind, results)
|
||||
|
||||
saveRDS(full_data_frame,
|
||||
file = file_save
|
||||
)
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
necessary_packages <- c("remotes", "tictoc", "combinat", "parallel", "colSBM")
|
||||
necessary_packages <- c(
|
||||
"remotes", "tictoc", "combinat", "parallel", "colSBM"
|
||||
)
|
||||
|
||||
if (!all((necessary_packages %in% installed.packages()))) {
|
||||
install.packages(necessary_packages[-length(necessary_packages)])
|
||||
|
|
@ -84,10 +86,13 @@ if (!dir.exists(temp_dir)) {
|
|||
dir.create(temp_dir, recursive = TRUE)
|
||||
}
|
||||
|
||||
file_save <- file.path(main_dir, paste0("poisson_inference_",start_time, "_", arg[1],"-", arg[2],".Rds"))
|
||||
file_save <- file.path(main_dir, paste0("poisson_inference_", start_time, "_", arg[1], "-", arg[2], ".Rds"))
|
||||
|
||||
tictoc::tic()
|
||||
results <- parallel::mclapply(seq_len(nrow(conditions)), function(s) {
|
||||
|
||||
conditions_rows <- seq_len(nrow(conditions))
|
||||
results <- parallel::mclapply(conditions_rows, function(s) {
|
||||
start_time_condition <- Sys.time()
|
||||
ea <- conditions[s, ]$epsilon_alpha
|
||||
current_pi1 <- conditions[s, ]$pi1
|
||||
current_rho2 <- conditions[s, ]$rho2
|
||||
|
|
@ -115,7 +120,8 @@ results <- parallel::mclapply(seq_len(nrow(conditions)), function(s) {
|
|||
)[[1]],
|
||||
generate_bipartite_collection(
|
||||
nr, nc, pi2, conditions[s, ]$rho2,
|
||||
current_alpha, distribution = "poisson",
|
||||
current_alpha,
|
||||
distribution = "poisson",
|
||||
M = 1, return_memberships = TRUE
|
||||
)[[1]]
|
||||
)
|
||||
|
|
@ -145,6 +151,7 @@ results <- parallel::mclapply(seq_len(nrow(conditions)), function(s) {
|
|||
netlist = netlist,
|
||||
colsbm_model = "iid",
|
||||
nb_run = 1,
|
||||
distribution = "poisson",
|
||||
global_opts = list(
|
||||
verbosity = 0,
|
||||
plot_details = 0,
|
||||
|
|
@ -160,6 +167,7 @@ results <- parallel::mclapply(seq_len(nrow(conditions)), function(s) {
|
|||
netlist = netlist,
|
||||
colsbm_model = "pi",
|
||||
nb_run = 1,
|
||||
distribution = "poisson",
|
||||
global_opts = list(
|
||||
verbosity = 0,
|
||||
plot_details = 0,
|
||||
|
|
@ -172,6 +180,7 @@ results <- parallel::mclapply(seq_len(nrow(conditions)), function(s) {
|
|||
netlist = netlist,
|
||||
colsbm_model = "rho",
|
||||
nb_run = 1,
|
||||
distribution = "poisson",
|
||||
global_opts = list(
|
||||
verbosity = 0,
|
||||
plot_details = 0,
|
||||
|
|
@ -184,6 +193,7 @@ results <- parallel::mclapply(seq_len(nrow(conditions)), function(s) {
|
|||
netlist = netlist,
|
||||
colsbm_model = "pirho",
|
||||
nb_run = 1,
|
||||
distribution = "poisson",
|
||||
global_opts = list(
|
||||
verbosity = 0,
|
||||
plot_details = 0,
|
||||
|
|
@ -192,6 +202,9 @@ results <- parallel::mclapply(seq_len(nrow(conditions)), function(s) {
|
|||
sep_BiSBM = sep_BiSBM
|
||||
)
|
||||
|
||||
stop_time_condition <- Sys.time()
|
||||
|
||||
## Preparing date for export
|
||||
# BICLs
|
||||
sep_BICL <- sum(sep_BiSBM$BICL)
|
||||
iid_BICL <- fitted_bisbmpop_iid$best_fit$BICL
|
||||
|
|
@ -293,12 +306,18 @@ results <- parallel::mclapply(seq_len(nrow(conditions)), function(s) {
|
|||
pirho_double_row_ARI = pirho_double_ARIs[[1]],
|
||||
pirho_double_col_ARI = pirho_double_ARIs[[2]],
|
||||
pirho_Q1 = fitted_bisbmpop_pirho$best_fit$Q[1],
|
||||
pirho_Q2 = fitted_bisbmpop_pirho$best_fit$Q[2]
|
||||
)
|
||||
pirho_Q2 = fitted_bisbmpop_pirho$best_fit$Q[2],
|
||||
|
||||
# Saving temp
|
||||
temp_file_save <- file.path(temp_dir, paste0("conditions_", s, "_on_",
|
||||
nrow(conditions),".Rds"))
|
||||
elapsed_secs = difftime(stop_time_condition,
|
||||
start_time_condition, units = "sec")
|
||||
)
|
||||
message("Finished step ", s, "/", nrow(conditions), "\n")
|
||||
|
||||
# Saving temp
|
||||
temp_file_save <- file.path(temp_dir, paste0(
|
||||
"conditions_", s, "_on_",
|
||||
nrow(conditions), ".Rds"
|
||||
))
|
||||
|
||||
saveRDS(object = data_frame_output, file = temp_file_save)
|
||||
|
||||
|
|
@ -307,6 +326,7 @@ results <- parallel::mclapply(seq_len(nrow(conditions)), function(s) {
|
|||
mc.cores = parallel::detectCores() - 1
|
||||
)
|
||||
|
||||
|
||||
tictoc::toc()
|
||||
full_data_frame <- do.call(rbind, results)
|
||||
|
||||
|
|
|
|||
233
code/simulations/simulations_network_clustering.R
Normal file
233
code/simulations/simulations_network_clustering.R
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
necessary_packages <- c("remotes", "colSBM")
|
||||
|
||||
if (!(necessary_packages %in% installed.packages())) {
|
||||
install.packages(necessary_packages[-length(necessary_packages)])
|
||||
remotes::install_github(repo = "Chabert-Liddell/colSBM@merge-bipartite-2")
|
||||
}
|
||||
suppressPackageStartupMessages(library("colSBM"))
|
||||
|
||||
set.seed(1234)
|
||||
|
||||
# Generation of conditions
|
||||
if (!exists("model_to_test")) {
|
||||
model_to_test <- "iid"
|
||||
}
|
||||
|
||||
if (!exists("repetitions")) {
|
||||
repetitions <- seq.int(30)
|
||||
}
|
||||
|
||||
nr <- 75
|
||||
nc <- 75
|
||||
|
||||
pi <- matrix(c(0.2, 0.3, 0.5), nrow = 1, byrow = TRUE)
|
||||
rho <- matrix(c(0.2, 0.3, 0.5), nrow = 1, byrow = TRUE)
|
||||
epsilons <- seq(0.1, 0.4, by = 0.1)
|
||||
|
||||
if (!exists("arg")) {
|
||||
arg <- commandArgs(trailingOnly = TRUE)
|
||||
}
|
||||
|
||||
if (identical(arg, character(0L))) {
|
||||
model_to_test <- "iid"
|
||||
} else {
|
||||
model_to_test <- arg
|
||||
}
|
||||
|
||||
conditions <- tidyr::crossing(epsilons, pi, rho, repetitions)
|
||||
|
||||
results <- bettermc::mclapply(seq_len(nrow(conditions)), function(s) {
|
||||
eps <- conditions[s, ]$epsilons
|
||||
current_pi <- conditions[s, ]$pi
|
||||
current_rho <- conditions[s, ]$rho
|
||||
|
||||
alpha_assortative <- matrix(0.3, nrow = 3, ncol = 3) +
|
||||
matrix(
|
||||
c(
|
||||
eps, -0.5 * eps, -0.5 * eps,
|
||||
-0.5 * eps, eps, -0.5 * eps,
|
||||
-0.5 * eps, -0.5 * eps, eps
|
||||
),
|
||||
nrow = 3, byrow = TRUE
|
||||
)
|
||||
|
||||
alpha_core_periphery <- matrix(0.3, nrow = 3, ncol = 3) +
|
||||
matrix(
|
||||
c(
|
||||
1.5 * eps, eps, 0.5 * eps,
|
||||
eps, 0.5 * eps, 0,
|
||||
0.5 * eps, 0, -0.5 * eps
|
||||
),
|
||||
nrow = 3, byrow = TRUE
|
||||
)
|
||||
|
||||
alpha_disassortative <- matrix(0.3, nrow = 3, ncol = 3) +
|
||||
matrix(
|
||||
c(
|
||||
-0.5 * eps, eps, eps,
|
||||
eps, -0.5 * eps, eps,
|
||||
eps, eps, -0.5 * eps
|
||||
),
|
||||
nrow = 3, byrow = TRUE
|
||||
)
|
||||
|
||||
assortative_collection <- generate_bipartite_collectionge(
|
||||
nr, nc,
|
||||
current_pi, current_rho,
|
||||
alpha_assortative, 3,
|
||||
model = model_to_test,
|
||||
return_memberships = TRUE
|
||||
)
|
||||
|
||||
assortative_incidence <- lapply(
|
||||
seq_along(assortative_collection),
|
||||
function(m) {
|
||||
return(assortative_collection[[m]]$incidence_matrix)
|
||||
}
|
||||
)
|
||||
|
||||
assortative_row_clustering <- lapply(
|
||||
seq_along(assortative_collection),
|
||||
function(m) {
|
||||
return(assortative_collection[[m]]$row_clustering)
|
||||
}
|
||||
)
|
||||
|
||||
assortative_col_clustering <- lapply(
|
||||
seq_along(assortative_collection),
|
||||
function(m) {
|
||||
return(assortative_collection[[m]]$row_clustering)
|
||||
}
|
||||
)
|
||||
|
||||
core_periphery_collection <- generate_bipartite_collection(
|
||||
nr, nc,
|
||||
current_pi, current_rho,
|
||||
alpha_core_periphery, 3,
|
||||
model = model_to_test,
|
||||
return_memberships = TRUE
|
||||
)
|
||||
|
||||
core_periphery_incidence <- lapply(
|
||||
seq_along(core_periphery_collection),
|
||||
function(m) {
|
||||
return(core_periphery_collection[[m]]$incidence_matrix)
|
||||
}
|
||||
)
|
||||
|
||||
core_periphery_row_clustering <- lapply(
|
||||
seq_along(core_periphery_collection),
|
||||
function(m) {
|
||||
return(core_periphery_collection[[m]]$row_clustering)
|
||||
}
|
||||
)
|
||||
|
||||
core_periphery_col_clustering <- lapply(
|
||||
seq_along(core_periphery_collection),
|
||||
function(m) {
|
||||
return(core_periphery_collection[[m]]$row_clustering)
|
||||
}
|
||||
)
|
||||
|
||||
disassortative_collection <- generate_bipartite_collection(
|
||||
nr, nc,
|
||||
current_pi, current_rho,
|
||||
alpha_disassortative, 3,
|
||||
model = model_to_test,
|
||||
return_memberships = TRUE
|
||||
)
|
||||
|
||||
disassortative_incidence <- lapply(
|
||||
seq_along(disassortative_collection),
|
||||
function(m) {
|
||||
return(disassortative_collection[[m]]$incidence_matrix)
|
||||
}
|
||||
)
|
||||
|
||||
disassortative_row_clustering <- lapply(
|
||||
seq_along(disassortative_collection),
|
||||
function(m) {
|
||||
return(disassortative_collection[[m]]$row_clustering)
|
||||
}
|
||||
)
|
||||
|
||||
disassortative_col_clustering <- lapply(
|
||||
seq_along(disassortative_collection),
|
||||
function(m) {
|
||||
return(disassortative_collection[[m]]$row_clustering)
|
||||
}
|
||||
)
|
||||
|
||||
real_row_clustering <- append(
|
||||
append(
|
||||
assortative_row_clustering,
|
||||
core_periphery_row_clustering
|
||||
),
|
||||
disassortative_row_clustering
|
||||
)
|
||||
|
||||
real_col_clustering <- append(
|
||||
append(
|
||||
assortative_col_clustering,
|
||||
core_periphery_col_clustering
|
||||
),
|
||||
disassortative_col_clustering
|
||||
)
|
||||
|
||||
incidence_matrices <- append(
|
||||
append(
|
||||
assortative_incidence,
|
||||
core_periphery_incidence
|
||||
),
|
||||
disassortative_incidence
|
||||
)
|
||||
|
||||
netids <- rep(c("as", "cp", "dis"), each = 3)
|
||||
|
||||
tictoc::tic()
|
||||
list_collection <- clusterize_bipartite_networks(
|
||||
netlist = incidence_matrices,
|
||||
net_id = netids,
|
||||
nb_run = 1,
|
||||
colsbm_model = model_to_test,
|
||||
global_opts = list(
|
||||
nb_cores = parallel::detectCores() - 1, verbosity = 2,
|
||||
plot_details = 0 # ,
|
||||
# parallelization_vector = c(FALSE, FALSE, FALSE)
|
||||
),
|
||||
silent_parallelization = TRUE
|
||||
)
|
||||
|
||||
best_partitions <- unlist(extract_best_bipartite_partition(list_collection))
|
||||
if (!is(best_partitions, "list")) {
|
||||
best_partitions <- list(best_partitions)
|
||||
}
|
||||
clustering <- unlist(lapply(seq_along(best_partitions), function(col_idx) {
|
||||
setNames(
|
||||
rep(col_idx, best_partitions[[col_idx]]$M),
|
||||
best_partitions[[col_idx]]$net_id
|
||||
)
|
||||
}))
|
||||
# ARI computation
|
||||
clustering <- clustering[order(names(clustering))]
|
||||
ari <- aricode::ARI(rep(c(1, 2, 3), each = 3), clustering)
|
||||
|
||||
tictoc::toc()
|
||||
return(
|
||||
data.frame(epsilon = eps, model = model_to_test, ARI = ari)
|
||||
)
|
||||
},
|
||||
mc.cores = parallel::detectCores() - 1,
|
||||
mc.progress = TRUE,
|
||||
mc.retry = -1
|
||||
)
|
||||
|
||||
data_frame_result <- do.call("rbind", results)
|
||||
|
||||
saveRDS(data_frame_result, file = paste0(
|
||||
"simulation/data/",
|
||||
"simulated_collection_data_clustering_",
|
||||
model_to_test, "_",
|
||||
format(Sys.time(), "%d-%m-%y-%X"),
|
||||
".Rds"
|
||||
))
|
||||
Loading…
Add table
Reference in a new issue