subnet_cor {ILSM}R Documentation

Correlation of the Structural indices between Subnetworks

Description

Calculating correlation of interconnecting species generalism among Subnetworks ("general_'~'cor") and correlation between similarities of interconnecing species interaction partners in two subnetworks ("similar_'~'cor").

Usage

subnet_cor(network.or.subnet_mat1, subnet_mat2 = NULL, weighted = FALSE)

Arguments

network.or.subnet_mat1

Either a multilayer(tripartite) network of 'igraph' class which contains three groups of species and interactions within layers without interactions between each group of species, or a numeric matrix(or data.frame) representing interactions between two groups of species. Each row and column of matrix represents single species in the second and first groups of the tripartite network respectively. Elements of matrix are non-zero numbers if the two groups of species are connected, and 0 otherwise.

subnet_mat2

A numeric matrix(or data.frame) representing interactions between two groups of species. Each row and column of matrix represents single species in the second and third groups of the tripartite network respectively. Elements of matrix are non-zero numbers if the two groups of species are connected, and 0 otherwise. If network.or.subnet_mat1 is "igraph", subnet_mat2 defaults to NULL.

weighted

Logical. should elements of matrix be fractional? Default to FALSE. Generally, 'igraph' network represent a spare matrix, so weighted is FALSE. While elements of matrix represent interaction strength, weighted is TRUE.

Details

weighted

If the weighted = FALSE, the input for the parameter can be:

If the weighted = TRUE, the input for the parameter can be:

network.or.subnet_mat1 and subnet_mat2

There are two types of network.or.subnet_mat1 that can be processed:

If the type of inputting is data frame or matrix, please make sure the row of network.or.subnet_mat1 and subnet_mat2 correspond with the second group of species that both belong to two subnetworks and interact with other groups of species.

About a network of type "igraph", It can be obtained from the connection matrices of subnetworks by the function igraph_from_matrices.

Value

Return a numeric vector of two elements representing correlation of interconnecting species generalism among Subnetworks and correlation between similarities of interconnecing species interaction partners in two subnetworks.

If weighted = FALSE, the results will show "general_cor= ;similar_cor= ;" and If weighted = TRUE, the results will show "general_weight_cor= ;similar_weight_cor= ;"

References

Sauve, A. M., Thébault, E., Pocock, M. J., & Fontaine, C. (2016). How plants connect pollination and herbivory networks and their contribution to community stability. Ecology, 97(4), 908-917.

Examples


set.seed(12)
d <- build_net(11,15,17,0.2)
subnet_cor(d)

md1<-matrix(sample(c(0,1),110,replace=TRUE),10,11)
md2<-matrix(sample(c(0,1),120,replace=TRUE),10,12)
subnet_cor(md1,md2)
subnet_cor(md1,md2,weighted=TRUE)

md1<-matrix(sample(c(0,1),80,replace=TRUE),8,10)
md2<-matrix(sample(c(0,1),120,replace=TRUE),10,12)
subnet_cor(md1,md2)

mdw1<-matrix(runif(110,0,1),10,11)
mdw2<-matrix(runif(120,0,1),10,12)
subnet_cor(mdw1,mdw2,weighted=TRUE)

set.seed(1)
mdw1<-matrix(runif(80,0,1),8,10)
mdw2<-matrix(runif(120,0,1),10,12)
subnet_cor(mdw1,mdw2,weighted=TRUE)



[Package ILSM version 1.0.3.1 Index]