virtualNicheR: generating virtual fundamental and realised niches for use in virtual ecology experiments

Models of species-environment relationships (such as: habitat suitability models, species distribution models, resource selection functions, or ecological niche models) are an important part of ecological science (Elith & Leathwick, 2009). The foundation of many of these models is the concept of fundamental and realised ecological niches that delineate the combinations of abiotic and biotic conditions under which a species can persist indefinitely (Hutchinson, 1957).


Introduction
Models of species-environment relationships (such as: habitat suitability models, species distribution models, resource selection functions, or ecological niche models) are an important part of ecological science (Elith & Leathwick, 2009). The foundation of many of these models is the concept of fundamental and realised ecological niches that delineate the combinations of abiotic and biotic conditions under which a species can persist indefinitely (Hutchinson, 1957).
To evaluate how well species-environment models perform in different situations, modellers need the ability to generate virtual, or imaginary, niches with known properties. There are a variety of existing software tools that aim to do this (Duan, Kong, Huang, Wu, & Wang, 2015;Leroy, Meynard, Bellard, & Courchamp, 2016;Qiao et al., 2016), but none of the existing software differentiate between fundamental and realised niches, which is important given differences in possible complexity of shape (Blonder, 2016). The virtualNicheR software that we have developed is therefore unique in that it provides an integrated framework that is needed to generate both fundamental and realised virtual niches. We envisage that the ability to generate integrated fundamental and realised virtual niches will enable modellers to improve the virtual ecology experiments (Zurell et al., 2010) that have been advocated for evaluating species-environment relationship models (Miller, 2014). Hutchinson (1957) introduced the concept of fundamental N F and realised N R ecological niches using set theory terminology. Given n environmental variables an n-dimensional hypervolume can be defined within which conditions would allow a species to exist indefinitely. If A is the set of abiotic conditions (moisture, temperature, etc) required, then N F = A, and if B is the set of biotic conditions (presence of: prey, hosts, mutualists, etc; and absence of: competitors, predators, diseases, etc) required, then the realised niche is the intersection of the set of abiotic and biotic conditions, N R = A ∩ B, and therefore the realised niche is a subset of the fundamental niche, N R ⊆ N F (Soberón & Peterson, 2005).

Virtual niche framework -from sets to continuums
However, Hutchinson (1957) immediately recognised the limitations of expressing niches from set-theoretic perspective, as niches will ordinarily occur along a gradient of optimal to suboptimal conditions, but with set theory you are either inside or outside of the niche. In addition, as N R ⊆ N F , a set-theoretic perspective of the realised niche only works when fundamental niches are reduced in size through interspecific species competition, which is how Hutchinson (1957) first described the realised niche. But interspecific species interactions may not just be a the pair-wise negative interaction of species competition (−−), as there are other interactions that include positive or asymmetrical interactions: predator-prey or parasite-host (+−), commensalism (+0), amensalism (−0), or mutualism (++), though some of these have received almost no attention in niche theory (Chase & Leibold, 2003). Recognising that an important host, prey, or mutualist could result in a realised niche larger than a fundamental niche the virtualNicheR software does not use the traditional set-theoretic framework.
An alternative niche framework was presented by Maguire (1973) who extended the niche to a continuous model based on population growth rates, which Hutchinson (1978) himself considered to be a "considerable extension to the multidimensional niche". Representing niches as a continuum using a species population's finite rate of increase λ, where λ ≥ 1 results in a species existing indefinitely, has supported more recent modelling that has developed niche theory (Pulliam, 2000) and as such is how we choose to model niches in virtualNicheR.

Fundamental niches
The niche modelling of virtualNicheR follows a similar approach to that of Gauch and Whittaker (1972) who based their virtual species on normal distributions, and as such that a fundamental niche is unimodal and convex. However, we have extended this principle to use multivariate normal distributions such that n-dimensional niches can be defined.
In virtualNicheR the starting point for computing virtual niches is an m × n matrix that defines m niche coordinates in n dimensions of environmental space for which virtual niche values are required.
The fundamental niche of a virtual species is defined by three parameters: • λ max , the species' maximum finite rate of increase at the fundamental niche optimum, • µ, a n × 1 column vector of means that gives the optimum location of the niche in each dimension, and • Σ, a n × n variance-covariance matrix that gives the size and orientation of the niche in each dimension.
In virtualNicheR a virtual species is represented as a set of these variables, so S = {λ max , µ, Σ}.
For a coordinate column vector x m = [x m,1 , x m,2 , x m,3 , . . . , x m,n ] T , the fundamental niche finite rate of increase λ F (x) of a virtual species for that coordinate is then calculated as: To illustrate how the defining parameters interact to create λ F (x) , consider three virtual species defined as: ] , When the λ F values for a systematic grid of coordinates across environmental space are visualised it becomes clear that each of these virtual species fundamental niche occupies a slightly different part of niche space, with λ F varying by location, size, orientation, and magnitude ( Figure 1).

Realised niches
While the fundamental niche is essentially static for a species, only changing through evolution, the realised niche is a dynamic realisation of niche space as it will fluctuate with changes in species populations which in some systems will be cyclical or even chaotic. Therefore, we model realised niches as viewed as a static point in time, and do so by defining a square matrix I that quantifies the pair-wise interspecific species interactions in the virtual community as if all interacting + and − interactions have been balanced out. The diagonal of the matrix is zero, so species do not affect themselves, and the remainder of the matrix has values that represent positive and negative effects, where I ij is the effect of species j on species i. For example, the interactions matrix represents a community of three species in which: I 1,2 = 0.2 and I 2,1 = −1.0 so S 1 is a predator of S 2 , I 1,3 = −0.4 and I 3,1 = −0.6 so S 1 and S 3 are competitors, and I 2,3 = −1.0 and I 3,2 = 0.3 so S 3 is also a predator of S 2 (Figure 2). Species S1 and S3 are both predators of their prey S2, and S1 and S3 are competitors.
Given a vector f (x) of fundamental niche values λ F for n species in a community, so , then a vector of realised niches . . . , λ Rn(x) ] can be calculated as: Returning to our three example virtual species, we begin by creating a community C of species that is represented in virtualNicheR as a set of species, so C = {S 1 , S 2 , S 3 }. Then we can use I to calculate the realised niches of this community (Figure 3). We can see that the realised niches can take very complex shapes that have varying degrees of difference from the fundamental niches. S 1 has a realised niche that is both skewed and concave and results from the negative affect from S 3 and the positive affect of S 2 that expands the realised niche beyond fundamental niche (Figure 3a). S 2 has a realised niche that is bimodal and an overall reduction from the fundamental niche due to the negative effects of S 1 and S 3 (Figure 3b). S 3 has the simplest shaped realised niche that is still somewhat normally distributed, but with the negative effects of S 1 and the positive effects of S 2 having shifted and elongated the realised niche relative to the fundamental niche.

From environmental to geographic space
While virtualNicheR fundamental and realised niches are defined in environmental space, it is quite straightforward to use virtualNicheR to map out niches in geographic space. This can be useful as not all environmental conditions within a niche may exist in geographic space at a given time, leading to a potential niche (λ P ) that is always smaller than a fundamental niche (Jackson & Overpeck, 2000). Mapping niches could either be done using neutral landscape models (Etherington, Holland, & O'Sullivan, 2015;Sciaini, Fritsch, Scherer, & Simpkins, 2018) to create virtual geographic data (Figure 4) or for real geographic data depending on a user's need. Given maps of virtual environmental gradients in geographic space for (a) temperature and (b) rainfall, the fundamental niche of S1 can be calculated in geographic space to map the potential niche.

Availability
virtualNicheR is open source software made available under the MIT license. Installation instructions can be found at the GitHub repository https://github.com/manaakiwhenua/ virtualNicheR.