Skip to content

Commit

Permalink
Started the simulate extinction function
Browse files Browse the repository at this point in the history
  • Loading branch information
derek-corcoran-barrios committed Dec 28, 2020
1 parent 343a8e4 commit b330da3
Show file tree
Hide file tree
Showing 18 changed files with 354 additions and 90 deletions.
40 changes: 36 additions & 4 deletions R/Extintions.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
#' Extinctions analysis from most connected to less conected nodes in the network
#' Extinctions analysis for trophic networks
#'
#' It takes a network and it calculates wich node is the most conected
#' The SimulateExtinctions function, can be used to test how the order of species
#' extinctions might affect the stability of the network by comparing The extintion history
#' and checking for secondary extinctions.
#'
#' @param Method a character with the options Mostconnected, Oredered, or Random
#' @param Network a trophic network of class network
#' @return exports data frame with the characteristics of the network after every
#' extintion. The resulting data frame contains 11 columns that incorporate the
#' topological index, the secondary extinctions, predation release, and total extinctions of the network
#' in each primary extinction.
#'
#' @details When method is Mostconnected, it takes a network and it calculates wich node is the most connected
#' of the network, using total degree. Then remove the most connected node,
#' and calculates the the topological indexes of the network and the number of
#' secundary extintions (how many species have indegree 0, without considered
#' primary producers). After that, remove the nodes that were secondarily extinct
#' in the previous step and recalculate which is the new most connected
#' node and so on, until the number of links in the network is zero.
#'
#' @examples
#' data("net")
#' SimulateExtinctions(Network = net, Method = "Mostconnected")


SimulateExtinctions <- function(Network, Method){
if(Method == "Mostconnected"){
Mostconnected(Network = Network)
}
}

#' Extinctions analysis from most connected to less connected nodes in the network
#'
#' It takes a network and it calculates wich node is the most connected
#' of the network, using total degree. Then remove the most connected node,
#' and calculates the the topological indexes of the network and the number of
#' secundary extintions (how many species have indegree 0, without considered
Expand Down Expand Up @@ -325,12 +357,12 @@ RandomExtinctions <- function(Network, nsim = 10, parallel = FALSE, ncores, Reco

#' Comparison of Null hypothesis with other extinction histories
#'
#' It compares an object genrated either by the Mostconected or ExtinctionOrder functions
#' It compares an object genrated either by the Mostconnected or ExtinctionOrder functions
#' with a null hypothesis generated by the RandomExtinctions function and it tests weather
#' they are significantly different.
#'
#' @param Nullmodel an object generated by the RandomExtinctions
#' @param Hypothesis Extinction history generated by the Mostconected or ExtinctionOrder
#' @param Hypothesis Extinction history generated by the Mostconnected or ExtinctionOrder
#' fuction
#' @return a plot comparing the expected value of secondary extinctions originated at random
#' with the observed extinction history.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b330da3

Please sign in to comment.