Adding Fungus Tree data

This commit is contained in:
Louis 2026-02-11 17:36:50 +01:00
parent 40068f8d00
commit 09bcd00d6a

26
multipartite_fungustree.R Normal file
View file

@ -0,0 +1,26 @@
library(GREMLINS) # Load the custom GREMLINS
library(sbm)
data(fungusTreeNetwork)
tree_genetic_dist_matrix <- fungusTreeNetwork$covar_tree$genetic_dist
tree_genet_sbm <- estimateSimpleSBM(netMat = tree_genetic_dist_matrix, model = "gaussian", estimOptions = list(plot = FALSE))
plot(tree_genet_sbm)
tree_geo_sbm <- estimateSimpleSBM(netMat = fungusTreeNetwork$covar_tree$geographic_dist, model = "gaussian", estimOptions = list(plot = FALSE))
plot(tree_geo_sbm)
fungus_tree_sbm <- estimateBipartiteSBM(netMat = fungusTreeNetwork$fungus_tree, model = "bernoulli", estimOptions = list(plot = FALSE))
Tree_Geo_dist <- defineNetwork(fungusTreeNetwork$covar_tree$geographic_dist, type = "adj", "Tree", "Tree")
Tree_Genet_dist <- defineNetwork(fungusTreeNetwork$covar_tree$genetic_dist, type = "adj", "Tree", "Tree")
FungusTree_Count <- defineNetwork(fungusTreeNetwork$fungus_tree, type = "inc", "Fungus", "Tree")
list_Net <- list(Tree_Geo_dist, FungusTree_Count)
v_distrib <- c("gaussian", "bernoulli")
namesFG <- c("Tree", "Fungus")
givenclassif <- list(tree_geo_sbm$memberships, fungus_tree_sbm$memberships[["row"]])
geo_multi_noinit <- multipartiteBM(list_Net = list_Net, v_distrib = v_distrib, namesFG = namesFG, givenclassif = NULL)
geo_multi_init <- multipartiteBM(list_Net = list_Net, v_distrib = v_distrib, namesFG = namesFG, givenclassif = givenclassif)
dataR6 <- formattingData(list_Net, v_distrib)