Title: Within Outlying Mean Indexes: Refining the 'OMI' Analysis
Version: 1.6
Date: 2026-01-20
Author: Stephane Karasiewicz ORCID iD [aut, cre]
Maintainer: Stephane Karasiewicz <skaraz.science@gmail.com>
BugReports: https://github.com/KarasiewiczStephane/WitOMI/issues
Description: Complementary indexes calculation to the Outlying Mean Index analysis to explore niche shift of a community and biological constraint within an Euclidean space, with graphical displays. For details see Karasiewicz 'et al.' (2017) <doi:10.7717/peerj.3364>.
Depends: R (≥ 3.5.0)
Imports: ade4, polyclip, wordcloud
Suggests: adegraphics, ape, CircStats, deldir, lattice, MASS, pixmap, spdep, splancs, waveslim
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
RoxygenNote: 7.3.3
Encoding: UTF-8
NeedsCompilation: no
LazyData: true
Packaged: 2026-01-20 13:44:56 UTC; skaraz
Repository: CRAN
Date/Publication: 2026-01-23 21:20:02 UTC

Temporal data

Description

The ardecheinv data are the temporal example used as an ecological application of the WitOMI calculations in Karasiewicz et al. (2017).

Usage

data(ardecheinv)

Format

The ardecheinv is a list of 3 components.

env is a dataframe of 67 rows with 5 environmental tables, collected in spring and autumn.

Invertebrates is a dataframe of 67 rows and 57 species of invertebrates.

code is a dataframe with 57 rows and 2 columns, the species scientific name and their respective code.

Source

Merigoux, S. and Doledec, S. (2004). Hydraulic requirements of stream communities: A case study on invertebrates. Freshwater Biology, 49(5), 600-613. doi:10.1111/j.1365-2427.2004.01214.x.

References

Karasiewicz S.,Doledec S.and Lefebvre S. (2017). Within outlying mean indexes: refining the OMI analysis for the realized niche decomposition. PeerJ 5:e3364. doi:10.7717/peerj.3364.


Calculate Convex Hull

Description

Internal function to calculate 2D convex hull coordinates and area. This function replaces the dependency on SIBER::siberConvexhull.

Usage

convexhull(x, y)

Arguments

x

numeric vector of x-coordinates

y

numeric vector of y-coordinates

Value

A list containing:

TA

Total area of the convex hull

x

x-coordinates of hull vertices

y

y-coordinates of hull vertices

xcoords

x-coordinates of hull vertices (alternative name for compatibility)

ycoords

y-coordinates of hull vertices (alternative name for compatibility)

samples

Row names of points on the hull


Spatial data

Description

The drome data are the spatial example used as an ecological application of the WitOMI calculations in Karasiewicz et al. (2017).

Usage

data(drome)

Format

The drome is a list of 3 components.

env is a dataframe with 64 rows with 6 environmental tables, collected in 10 different rivers.

fish is a dataframe with 64 rows and 13 columns (12 fish species, including young and older trouts).

code is a dataframe with 13 rows and 2 columns, the species, common and scientific, name and their respective code.

Source

Doledec S., Chessel D. and Gimaret C. (2000). Niche separation in community analysis: a new method. Ecology,81(10), 2914-1927.doi:10.2307/177351.

References

Karasiewicz S.,Doledec S.and Lefebvre S. (2017). Within outlying mean indexes: refining the OMI analysis for the realized niche decomposition. PeerJ 5:e3364.doi:10.7717/peerj.3364.


The eigenvalue of the OMI analysis

Description

The function plot the eigenvalues of the OMI analysis

Usage

eigenbar(
  subnic,
  col.sel = "black",
  col.unsel = "grey",
  ylab = "Eigen values in %",
  names.arg = NULL,
  main = NA,
  ...
)

Arguments

subnic

an object of class subniche.

col.sel

the color of the selected axes

col.unsel

the color of the other axes

ylab

label for y-axis, see title for more details.

names.arg

a vector of names to be plotted below each bar or group of bars. If this argument is omitted, then the names are taken from the names attribute of height if this is a vector, or the column names if it is a matrix.

main

a main title for the plot, see title for more details.

...

further arguments passed to or from other methods see barplot

Details

The black bars represents the selected axes for the OMI analysis See doi:10.7717/peerj.3364 for more details on the subniche concept.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
eigenbar(subnic1)

Summarizes the results of the species subniche

Description

The function plot the resulting species subniche of the WitOMI calculation.

Usage

## S3 method for class 'subniche'
plot(
  x,
  xax = 1,
  yax = 2,
  ax.angle.arrow = 20,
  ax.col.arrow = "black",
  ax.length.arrow = 0.1,
  ax.lwd.arrow = 1,
  ax.leg.posi = "bottomleft",
  ax.leg.cex = 1.2,
  eig.col.chos = "black",
  eig.col.left = "gray",
  eig.leg.posi = "topright",
  eig.leg.cex = 1.2,
  su.leg.posi = "bottomleft",
  su.leg.cex = 1.2,
  col.axis = "azure3",
  lty.axis = 2,
  lwd.axis = 2,
  var.col.arrow = "black",
  var.length.arrow = 0.1,
  var.lwd.arrow = 1,
  var.angle.arrow = 20,
  var.leg.posi = "bottomleft",
  var.leg.cex = 1.2,
  fac.var.lab = 1.2,
  col.var = "black",
  col.su = "black",
  col.G_k = "red",
  nic.leg.posi = "bottomleft",
  nic.leg.cex = 1.2,
  sub.leg.cex = 1.2,
  sub.leg.posi = "bottomleft",
  pch.su = 16,
  cex.su = 1,
  border.E = "#92c5de",
  col.E = "#92c5de",
  lty.E = 1,
  border.K = "black",
  col.K = "#2c7fb8",
  lty.K = 1,
  show.lines = FALSE,
  ...
)

Arguments

x

an object of class subniche.

xax

column for abscissas.

yax

column for ordinate.

ax.angle.arrow

arrow angle head for plot labeled "Axes", see arrows for more details.

ax.col.arrow

arrow color for plot labeled "Axes", see arrows for more details.

ax.length.arrow

arrow head length for plot labeled "Axes", see arrows for more details.

ax.lwd.arrow

arrow width for plot labeled "Axes", see arrows for more details.

ax.leg.posi

legend position for plot labeled "Axes", see legend for more details.

ax.leg.cex

legend size label for plot labeled "Axes", see legend for more details.

eig.col.chos

bar color for the selected components for plot labeled "Eigenvalues".

eig.col.left

bar color for the component leftover for plot labeled "Eigenvalues".

eig.leg.posi

legend position for plot labeled "Eigenvalues", see legend for more details.

eig.leg.cex

legend size label for plot labeled "Eigenvalues"", see legend for more details.

su.leg.posi

legend position for plot labeled "SU", see legend for more details.

su.leg.cex

legend size label for plot labeled "SU", see legend for more details.

col.axis

axis color, see par for more details.

lty.axis

axis line type, see par for more details.

lwd.axis

axis width, see par for more details.

var.col.arrow

variables arrow color for plot labeled "Variables and Species", see arrows for more details.

var.length.arrow

variables arrow length of the edges of the arrow head (in inches).

var.lwd.arrow

variables arrow width for plot labeled "Variables and Species", see arrows for more details.

var.angle.arrow

variables arrow angle head for plot labeled "Variables and Species", see arrows for more details.

var.leg.posi

legend position for plot labeled "Variables and Species", see legend for more details.

var.leg.cex

legend size label for plot labeled "Variables and Species", see legend for more details.

fac.var.lab

factor for moving the variable labels from its original coordinates for clarity, by defaults they are multiply 1.2

col.var

color variables labels, see textplot for more details.

col.su

color of sampling units, see points for more details.

col.G_k

color label G_k, see textplot for more details.

nic.leg.posi

legend position for plot labeled "Niches", see legend for more details.

nic.leg.cex

legend size label for plot labeled "Niches", see legend for more details.

sub.leg.cex

legend size label for plot labeled "Subsets"", see legend for more details.

sub.leg.posi

legend position for plot labeled "Subsets", see legend for more details.

pch.su

type of the points representing the sampling units (SU), see points for more details.

cex.su

size of the points representing the sampling units (SU), see points for more details.

border.E

color border of E polygon, see polygon for more details.

col.E

inside color of E polygon, see polygon for more details.

lty.E

line type for the E border, see polygon for more details.

border.K

color border of K polygon, see polygon for more details.

col.K

inside color of K polygon, see polygon for more details.

lty.K

line type for the K border, see polygon for more details.

show.lines

if true, then lines are plotted between x,y and the word, for those words not covering their x,y coordinates. See textplot for more details.

...

further arguments passed to or from other methods.

Details

The function illustrate the results of subniche calculation with a great deal of customization parameters.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
plot(subnic1)

Community niche distribution

Description

The function represents the species' niche NR position within the environmental space E.

Usage

plot_NR(
  subnic,
  sig = NULL,
  sig_thres = 0.05,
  xlab = NULL,
  ylab = NULL,
  main = NA,
  col.axis = "azure3",
  lty.axis = 2,
  lwd.axis = 2,
  border.E = "black",
  col.E = "#92c5de",
  lty.E = 1,
  lwd.E = 1,
  pch.NR.pos = 21,
  cex.NR.pos = 1,
  col.NR.pos = "#a1d99b",
  col.NR.pt = "black",
  col.NR.lab = "black",
  cex.NR.lab = NA,
  fac.NR.lab = 1.2,
  col.arrow = "black",
  angle.arrow = 20,
  lwd.arrow = 2,
  length.arrow = 0.1,
  font.sp = 2,
  leg = TRUE,
  posi.leg = "topleft",
  bty.leg = "n",
  ...
)

Arguments

subnic

an object of class subniche.

sig

a factor defining the significance species, default NULL.

sig_thres

value for minimum significance, default 0.05

xlab

label for x-axis, see title for more details.

ylab

label for y-axis, see title for more details.

main

a main title for the plot, see title for more details.

col.axis

axis color, see par for more details.

lty.axis

axis line type, see par for more details.

lwd.axis

axis width, see par for more details.

border.E

color border of E polygon, see polygon for more details.

col.E

inside color of E polygon, see polygon for more details.

lty.E

line type for the E border, see polygon for more details.

lwd.E

line width for the E border, see polygon for more details.

pch.NR.pos

type of points representing the NR position, see points for more details.

cex.NR.pos

size of points representing the NR position, see points for more details.

col.NR.pos

color of points representing the NR position, see points for more details.

col.NR.pt

point color contour if pch=21:25.

col.NR.lab

color of the species labels, see see text for more details.

cex.NR.lab

size of the species labels defautls NA for no labels, see see text for more details.

fac.NR.lab

factor for moving the NR labels from its original coordinates for clarity, by defaults they are multiply 1.2

col.arrow

arrow color, see arrows for more details.

angle.arrow

arrow angle head, see arrows for more details.

lwd.arrow

arrow width, see arrows for more details.

length.arrow

arrow head length, see arrows for more details.

font.sp

An integer which specifies which font to use for species label. 1 corresponds to plain text (the default), 2 to bold face, 3 to italic and 4 to bold italic, see par for more details.

leg

a logical option for legend to be plotted or not, default leg=TRUE.

posi.leg

setting legend positions with the following keywords "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center", see legend for more details.

bty.leg

the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n", see legend for more details.

...

further arguments passed to or from other methods.

Details

The convex hulls measured is E is the environmental space. The arrows represent the species' NR marginality from the origin G. See doi:10.7717/peerj.3364 for more details on the subniche concept.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
sigi <- rtest(nic1,10)
M <- length(sigi$pvalue)
plot_NR(subnic1, sig=sigi$pvalue[-M], sig_thres= 0.1)

Species niche

Description

The function represents the species' niche NR within the environmental space E.

Usage

plot_NR_sp(
  subnic,
  sp,
  xlab = NULL,
  ylab = NULL,
  main = NA,
  col.axis = "azure3",
  lty.axis = 2,
  lwd.axis = 2,
  border.E = "black",
  col.E = "#92c5de",
  lty.E = 1,
  lwd.E = 1,
  border.NR = "black",
  col.NR = "#fdb462",
  lty.NR = 1,
  lwd.NR = 1,
  pch.NR.pos = 21,
  cex.NR.pos = 1,
  col.NR.pos = "#a1d99b",
  col.NR.pt = "black",
  col.NR.lab = "black",
  cex.NR.lab = NA,
  fac.NR.lab = 1.2,
  col.arrow = "black",
  angle.arrow = 20,
  lwd.arrow = 2,
  length.arrow = 0.1,
  font.sp = 2,
  leg = TRUE,
  posi.leg = "topleft",
  bty.leg = "n",
  ...
)

Arguments

subnic

an object of class subniche.

sp

a character string of the species name, default rownames(subnic$li)

xlab

label for x-axis, see title for more details.

ylab

label for y-axis, see title for more details.

main

a main title for the plot, see title for more details.

col.axis

axis color, see par for more details.

lty.axis

axis line type, see par for more details.

lwd.axis

axis width, see par for more details.

border.E

color border of E polygon, see polygon for more details.

col.E

inside color of E polygon, see polygon for more details.

lty.E

line type for the E border, see polygon for more details.

lwd.E

line width for the E border, see polygon for more details.

border.NR

color border of NR polygon, see polygon for more details.

col.NR

inside color of NR polygon, see polygon for more details.

lty.NR

line type for the NR border, see polygon for more details.

lwd.NR

line width for the NR border, see polygon for more details.

pch.NR.pos

type of points representing the NR position, see points for more details.

cex.NR.pos

size of points representing the NR position, see points for more details.

col.NR.pos

color of points representing the NR position, see points for more details.

col.NR.pt

point color contour if pch=21:25.

col.NR.lab

color of the species labels, see see text for more details.

cex.NR.lab

size of the species labels defaults NA for no labels, see see text for more details.

fac.NR.lab

factor for moving the NR labels from its original coordinates for clarity, by defaults they are multiply 1.2

col.arrow

arrow color, see arrows for more details.

angle.arrow

arrow angle head, see arrows for more details.

lwd.arrow

arrow width, see arrows for more details.

length.arrow

arrow head length, see arrows for more details.

font.sp

An integer which specifies which font to use for species label. 1 corresponds to plain text (the default), 2 to bold face, 3 to italic and 4 to bold italic, see par for more details.

leg

a logical option for legend to be plotted or not, default leg=TRUE.

posi.leg

setting legend positions with the following keywords "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center", see legend for more details.

bty.leg

the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n", see legend for more details.

...

further arguments passed to or from other methods.

Details

The convex hulls measured is E is the environmental space. The arrows represent the species' NR marginality from the origin G. See doi:10.7717/peerj.3364 for more details on the subniche concept.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
plot_NR_sp(subnic1, "Neba")

Communities subniches dynamic

Description

The function represents the species' subniches SR position within the environmental space E.

Usage

plot_dym(
  subnic,
  sig = NULL,
  sig_thres = 0.05,
  xlab = NULL,
  ylab = NULL,
  main = NA,
  col.axis = "azure3",
  lty.axis = 2,
  lwd.axis = 2,
  border.E = "black",
  col.E = "#92c5de",
  lty.E = 1,
  lwd.E = 1,
  pch.SR.pos = 21,
  cex.SR.pos = 1,
  col.SR.pos = "#ffa600",
  col.SR.pt = "black",
  col.SR.lab = "black",
  cex.SR.lab = NA,
  fac.SR.lab = 1.2,
  col.arrow = "black",
  angle.arrow = 20,
  lwd.arrow = 2,
  length.arrow = 0.1,
  font.sp = 2,
  leg = TRUE,
  posi.leg = "topleft",
  bty.leg = "n",
  ...
)

Arguments

subnic

an object of class subniche.

sig

a factor defining the significance species, default NULL.

sig_thres

value for minimum significance, default 0.05

xlab

label for x-axis, see title for more details.

ylab

label for y-axis, see title for more details.

main

a main title for the plot, see title for more details.

col.axis

axis color, see par for more details.

lty.axis

axis line type, see par for more details.

lwd.axis

axis width, see par for more details.

border.E

color border of E polygon, see polygon for more details.

col.E

inside color of E polygon, see polygon for more details.

lty.E

line type for the E border, see polygon for more details.

lwd.E

line width for the E border, see polygon for more details.

pch.SR.pos

type of points representing the SR position, see points for more details.

cex.SR.pos

size of points representing the SR position, see points for more details.

col.SR.pos

color of points representing the SR position, see points for more details.

col.SR.pt

point color contour if pch=21:25.

col.SR.lab

color of the species labels, see see text for more details.

cex.SR.lab

size of the species labels defautls NA for no labels, see see text for more details.

fac.SR.lab

factor for moving the SR labels from its original coordinates for clarity, by defaults they are multiply 1.2

col.arrow

arrow color, see arrows for more details.

angle.arrow

arrow angle head, see arrows for more details.

lwd.arrow

arrow width, see arrows for more details.

length.arrow

arrow head length, see arrows for more details.

font.sp

An integer which specifies which font to use for species label. 1 corresponds to plain text (the default), 2 to bold face, 3 to italic and 4 to bold italic, see par for more details.

leg

a logical option for legend to be plotted or not, default leg=TRUE.

posi.leg

setting legend positions with the following keywords "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center", see legend for more details.

bty.leg

the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n", see legend for more details.

...

further arguments passed to or from other methods.

Details

The convex hulls measured is E is the environmental space. The arrows represent the species' subniche marginality from the origin G. See doi:10.7717/peerj.3364 for more details on the subniche concept.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
sigg <- rtestrefor(subnic1,10)
sig = c(sigg$`1`$witomigtest$subni.pvalue[-28],sigg$`2`$witomigtest$subni.pvalue[-28])
plot_dym(subnic1, sig=sig, sig_thres= 0.1)

Species subniches dynamic

Description

The function represents the species' subniches SR within its realized niche NR.

Usage

plot_dym_sp(
  subnic,
  sp,
  xlab = NULL,
  ylab = NULL,
  main = NA,
  col.axis = "azure3",
  lty.axis = 2,
  lwd.axis = 2,
  border.E = "black",
  col.E = "#92c5de",
  lty.E = 1,
  lwd.E = 1,
  col.NR = "#fdb462",
  border.NR = "black",
  lty.NR = 1,
  lwd.NR = 1,
  col.NR.lab = "black",
  cex.NR.lab = 0.7,
  pch.NR.pos = 21,
  col.NR.pos = "black",
  col.NR.pt = "black",
  cex.NR.pos = 1,
  border.SR = "black",
  col.SR = "#a1d99b",
  lty.SR = 1,
  lwd.SR = 1,
  col.SR.lab = "black",
  cex.SR.lab = 0.7,
  fac.SR.lab = 1.2,
  pch.SR.pos = 21,
  col.SR.pos = "#ffa600",
  col.SR.pt = "black",
  cex.SR.pos = 1,
  col.arrow = "black",
  angle.arrow = 20,
  lwd.arrow = 2,
  length.arrow = 0.1,
  font.sp = 2,
  leg = TRUE,
  posi.leg = "topleft",
  bty.leg = "n",
  ...
)

Arguments

subnic

an object of class subniche.

sp

a character string of the species name.

xlab

label for x-axis, see title for more details.

ylab

label for y-axis, see title for more details.

main

a main title for the plot, see title for more details.

col.axis

axis color, see par for more details.

lty.axis

axis line type, see par for more details.

lwd.axis

axis width, see par for more details.

border.E

color border of E polygon, see polygon for more details.

col.E

inside color of E polygon, see polygon for more details.

lty.E

line type for the E border, see polygon for more details.

lwd.E

line width for the E border, see polygon for more details.

col.NR

inside color of NR polygon, see polygon for more details.

border.NR

color border of NR polygon, see polygon for more details.

lty.NR

line type for the NR border, see polygon for more details.

lwd.NR

line width for the NR border, see polygon for more details.

col.NR.lab

color of the species label representing the NR position, see textplot for more details.

cex.NR.lab

size of the species label representing the NR position, see textplot for more details.

pch.NR.pos

the type of points representing the NR position, see points for more details.

col.NR.pos

the color of points representing the NR position, see points for more details.

col.NR.pt

point color contour if pch=21:25.

cex.NR.pos

size of points representing the SR position, see points for more details.

border.SR

color border of SR polygon, see polygon for more details.

col.SR

inside color of SR polygon, see polygon for more details.

lty.SR

line type for the SR border, see polygon for more details.

lwd.SR

line width for the SR border, see polygon for more details.

col.SR.lab

color of the species label representing the SR position, see text for more details.

cex.SR.lab

size of the species label representing the SR position, see text for more details.

fac.SR.lab

factor for moving the SR labels from its original coordinates for clarity, by defaults they are multiply 1.2

pch.SR.pos

type of points representing the SR position, see points for more details.

col.SR.pos

color of points representing the SR position, see points for more details.

col.SR.pt

point color contour if pch=21:25.

cex.SR.pos

size of points representing the SR position, see points for more details.

col.arrow

arrow color, see arrows for more details.

angle.arrow

arrow angle head, see arrows for more details.

lwd.arrow

arrow width, see arrows for more details.

length.arrow

arrow head length, see arrows for more details.

font.sp

An integer which specifies which font to use for species label. 1 corresponds to plain text (the default), 2 to bold face, 3 to italic and 4 to bold italic, see par for more details.

leg

a logical option for legend to be plotted or not, default leg=TRUE.

posi.leg

setting legend positions with the following keywords "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center", see legend for more details.

bty.leg

the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n", see legend for more details.

...

further arguments passed to or from other methods.

Details

The convex hulls measured are :

  1. E is the environmental space.

  2. NR the realized subniche.

  3. SR the species realized subniche.

The arrows represent the species' subniche marginality from the origin G. See doi:10.7717/peerj.3364 for more details on the subniche concept.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
plot_dym_sp(subnic1, "Neba")

A function to seperate a matrix, by row, into submatrices.

Description

separate matrix by rows into submatrices

Usage

sep.factor.row (x,factor)

Arguments

x

a matrix.

factor

a factor of the same length as the number of row in the matrix.

Value

list of submatrices


Convex hull decomposition

Description

The function is used to calculate the coordinates and area of each convex hull from E environmental space to SR subniche.

Usage

subarea(subnic)

Arguments

subnic

an object of class subniche.

Details

The convex hulls measured are :

  1. E is the environmental space.

  2. K the sub-environmental space.

  3. NR the realized subniche.

  4. SP the existing fundamental subniche.

  5. SB the area of the biological constraint reducing SP.

  6. SR the species realized subniche.

See doi:10.7717/peerj.3364 for more details on the subniche concept.

Value

A list containing the coordinates and area of each convex hulls

References

Karasiewicz S.,Doledec S.and Lefebvre S. (2017). Within outlying mean indexes: refining the OMI analysis for the realized niche decomposition. PeerJ 5:e3364. doi:10.7717/peerj.3364.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
area_sub <- subarea(subnic1)

The Within Outlying Mean Indexes calculation

Description

The indexes allows to divide the niche, estimated from the niche function in the ade4 package into subniches defined by a factor, which creates the subsets. See details for more information.

Usage

subniche(nic, factor)

## S3 method for class 'subkrandtest'
print(x, ...)

## S3 method for class 'subnikrandtest'
print(x, ...)

## S3 method for class 'subniche'
print(x, ...)

## S3 method for class 'subniche'
summary(object, ...)

refparam(x)

## S3 method for class 'subniche'
rtest(xtest, nrepet = 99, ...)

subparam.refor(x)

rtestrefor(x, nrepet)

subparam.subor(x)

rtestsubor(x, nrepet)

subkrandtest(
  sim,
  obs,
  alter = "greater",
  call = match.call(),
  names = colnames(sim),
  p.adjust.method = "none"
)

subnikrandtest(
  sim,
  obs,
  alter = "greater",
  subpvalue,
  call = match.call(),
  names = colnames(sim),
  p.adjust.method = "none"
)

Arguments

nic

an object of class niche.

factor

a factor which will defined the subsets within which the subniches will be calculated (the same length of the number of sites)

x

an object of class subniche.

...

further arguments passed to or from other methods

object

an object of class subniche.

xtest

an object of class subniche.

nrepet

the number of permutations for the testing procedure

sim

a numeric vector of simulated values

obs

a numeric vector of an observed value

alter

a character string specifying the alternative hypothesis, must be one of "greater" (default), "less" or "two-sided".he length must be equal to the length of the vector obs, values are recycled if shorter.

call

a call order

names

a vector of names for tests

p.adjust.method

a string indicating a method for multiple adjustment, see p.adjust.methods for possible choices.

subpvalue

the subset pvalue resulting from subkrandtest function

Details

The Within Outlying Mean Index analysis is a statistical exploratory niche analysis which provides observation of niche shift and/or conservatism, of an entire community,at different subcales (temporal ,spatial and/or finer biological organisation level), and comparable under the same environmental gradients. This hindcasting multivariate analysis is based on the OMI analysis (Doledec et al. 2000) which is used as reference. The niches refinement is inspired by the K-select (Calenge et al. 2005) which emphasizes the limiting factors in habitat use in design II and III (Thomas and Taylor, 1990).The different estimations should help understand:

1. the environmental factors defining a species' reference niche, under on the full scale, within a community.

2. the environmental factors defining a species' subniches, under each subsets, within a community.

The subniches parameters can be calculated from both the reference origin,G, which corresponds to the reference plan origin, and from G_k, which corresponds to the suborigins. G is the graphical representation of the mean environmental conditions encountered over the full scale of the data. G_k is the mean environmental conditions encountered at a subset defined by the factor. They are complementary has you can compare:

1. a single species' subniches to G.

2. the community' subniches to G_k at a specific subset.

The subniches of a single species can only be compared to G as it is the common origin to all subsets. Whereas G_k is only common to the species found within the subset. So comparing different subniches of one species, found within different subsets, is only relevant to G. The community's subniches can be compared to both G and G_k, but G, being the mean environmental conditions found within the full scale, will not express the specificity of the environmental conditions that the species encountered at the subset. G_k, being the mean environmental conditions of the subset, will reflect the atypical value of the environmental condition, making the comparison of the community's subniches parameters more relevant. More information on the ecological concept can be found in Karasiewicz et al. 2017.

For more details description on the package use:https://github.com/KarasiewiczStephane/WitOMI.

Value

Adds items in the niche list and changing the class into subniche containing:

factor the factor use to divide the environmental and species matrix into submatrices.

G_k a dataframe with the sub-origins, G_k.

sub a dataframe with the species subniche coordinates

Author(s)

Stephane Karasiewicz, skaraz.science@gmail.fr

References

Karasiewicz S.,Doledec S.and Lefebvre S. (2017). Within outlying mean indexes: refining the OMI analysis for the realized niche decomposition. PeerJ 5:e3364. doi:10.7717/peerj.3364.

Calenge C., Dufour A.B. and Maillard D. (2005). K-select analysis: a new method to analyze habitat selection in radio-tracking studies. Ecological modelling, 186, 143-153. doi:10.1016/j.ecolmodel.2004.12.005.

Doledec S., Chessel D. and Gimaret C. (2000). Niche separation in community analysis: a new method. Ecology,81, 2914-1927. doi:10.2307/177351

Thomas, D.L., Taylor, E.J. (1990). Study Designs and Tests for Comparing Resource Use and Availability II. Natl. Widl. 54(2), 322-330.

See Also

niche niche.param

Examples

library(ade4)
library(subniche)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
# the following two functions do the same display, plot.refniche is adapted to subniche objects
plot(nic1)
plot(subnic1)
#Display the marginality vector of the suborigins and the species subniche
#Display the subset's polygon, found within the overall environment's chull,
#and the corresponding species positions
subplot(subnic1)
# The following two functions do the same display, refparam is adapted to subniche objects
niche.param(nic1)
refparam(subnic1)
# The following two functions do the same display, rtest is adapted to subniche objects
rtest(nic1,10)
rtest(subnic1,10)
#Calculates the subniches' parameters from G with the corresponding rtest
subparam.refor(subnic1)
rtestrefor(subnic1,10)
#Calculates the subniches' parameters from G_k with the corresponding rtest
subparam.subor(subnic1)
rtestsubor(subnic1,10)

Sub-community plot under each sub-environmental space K

Description

The function to represent the community subniche position under each subenvironment K with their respective marginality from Gk.

Usage

subplot(
  subnic,
  main = NULL,
  sig = NULL,
  sig_thres = 0.05,
  xlab = NULL,
  ylab = NULL,
  col.axis = "azure3",
  lty.axis = 2,
  lwd.axis = 2,
  pch.SR.pos = 21,
  cex.SR.pos = 1,
  col.SR.pt = "black",
  col.SR.pos = "#ffa600",
  col.SR.lab = "black",
  cex.SR.lab = NA,
  fac.SR.lab = 1.2,
  border.E = "black",
  col.E = "#92c5de",
  lty.E = 1,
  lwd.E = 1,
  border.K = "black",
  col.K = "#2c7fb8",
  lty.K = 1,
  lwd.K = 1,
  col.arrow = "black",
  angle.arrow = 20,
  lwd.arrow = 2,
  length.arrow = 0.1,
  col.Gk.pos = "red",
  col.Gk.pt = "black",
  cex.Gk.pos = 1,
  pch.Gk.pos = 21,
  col.su = "#b35806",
  pt.su = "black",
  cex.su = 0.7,
  pch.su = 1,
  font.sp = 2,
  leg = TRUE,
  posi.leg = "topleft",
  bty.leg = "n",
  ...
)

Arguments

subnic

an object of class subniche.

main

a main title for the plot, see title for more details.

sig

a factor defining the significance species, default NULL.

sig_thres

value for minimum significance, default 0.05

xlab

a label for the x axis, defaults to a description of x, see title for more details.

ylab

a label for the y axis, defaults to a description of y, see title for more details.

col.axis

axis color, see par for more details.

lty.axis

axis line type, see par for more details.

lwd.axis

axis width, see par for more details.

pch.SR.pos

type of the point representing SR position, see points for more details.

cex.SR.pos

size of the point representing SR position, see points for more details.

col.SR.pt

point color contour if pch=21:25.

col.SR.pos

color of the point representing SR position, see points for more details.

col.SR.lab

color of the species labels, see see text for more details.

cex.SR.lab

size of the species labels defautls NA for no labels, see see text for more details.

fac.SR.lab

factor for moving the SR labels from its original coordinates for clarity, by defaults they are multiply 1.2

border.E

color border of E polygon, see polygon for more details.

col.E

inside color of E polygon, see polygon for more details.

lty.E

line type for the E border, see polygon for more details.

lwd.E

line width for the E border, see polygon for more details.

border.K

color border of K polygon, see polygon for more details.

col.K

inside color of K polygon, see polygon for more details.

lty.K

line type for the K border, see polygon for more details.

lwd.K

line width for the K border, see polygon for more details.

col.arrow

arrow color, see arrows for more details.

angle.arrow

arrow angle head, see arrows for more details.

lwd.arrow

arrow width, see arrows for more details.

length.arrow

arrow head length, see arrows for more details.

col.Gk.pos

color of the point representing Gk, see points for more details.

col.Gk.pt

point color contour if pch=21:25.

cex.Gk.pos

size of the point representing Gk, see points for more details.

pch.Gk.pos

type of the point representing Gk, see points for more details.

col.su

color of the points representing the sampling units (SU), see points for more details.

pt.su

point color contour if pch=21:25.

cex.su

size of the points representing the sampling units (SU), see points for more details.

pch.su

type of the points representing the sampling units (SU), see points for more details.

font.sp

font of the species labels, see see text for more details.

leg

a logical option for legend to be plotted or not, default leg=TRUE.

posi.leg

legend location in the graph, see legend for more details.

bty.leg

the type of box to be drawn around the legends. The allowed values are "o" (the default) and "n". See legend for more details

...

further arguments passed to or from other methods.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
#Two graphs are drawn one after the other
siggk <- rtestsubor(subnic1,10)
sig = c(siggk$`1`$witomigktest$subni.pvalue[-28],siggk$`2`$witomigktest$subni.pvalue[-28])
subplot(subnic1, sig = sig, sig_thres= 0.1)


Plot sub-environmental space K in E

Description

The function to represent the sub-environment K in E.

Usage

subplot_K(
  subnic,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  col.axis = "azure3",
  lty.axis = 2,
  lwd.axis = 2,
  border.E = "black",
  col.E = "#92c5de",
  lty.E = 1,
  lwd.E = 1,
  border.K = "black",
  col.K = "#2c7fb8",
  lty.K = 1,
  lwd.K = 1,
  col.Gk.pos = "red",
  col.Gk.pt = "black",
  cex.Gk.pos = 1,
  pch.Gk.pos = 21,
  col.Gk.lab = "black",
  cex.Gk.lab = 0.8,
  fac.Gk.lab = 1.5,
  col.su = "#b35806",
  pt.su = "black",
  cex.su = 0.7,
  pch.su = 1,
  leg = TRUE,
  posi.leg = "topleft",
  bty.leg = "n",
  ...
)

Arguments

subnic

an object of class subniche.

main

a main title for the plot, see title for more details.

xlab

label for x-axis, see title for more details.

ylab

label for y-axis, see title for more details.

col.axis

axis color, see par for more details.

lty.axis

axis line type, see par for more details.

lwd.axis

axis width, see par for more details.

border.E

color border of E polygon, see polygon for more details.

col.E

inside color of E polygon, see polygon for more details.

lty.E

line type for the E border, see polygon for more details.

lwd.E

line width for the E border, see polygon for more details.

border.K

color border of K polygon, see polygon for more details.

col.K

inside color of K polygon, see polygon for more details.

lty.K

line type for the K border, see polygon for more details.

lwd.K

line width for the K border, see polygon for more details.

col.Gk.pos

color of the point representing Gk, see points for more details.

col.Gk.pt

point color contour if pch=21:25.

cex.Gk.pos

size of the point representing Gk, see points for more details.

pch.Gk.pos

type of the point representing Gk, see points for more details.

col.Gk.lab

color of the Gk labels, see see text for more details.

cex.Gk.lab

size of the Gk labels defaults NA for no labels, see see text for more details.

fac.Gk.lab

factor for moving the Gk labels from its original coordinates for clarity, by defaults they are multiply 1.2

col.su

color of the points representing the sampling units (SU), see points for more details.

pt.su

point color contour if pch=21:25.

cex.su

size of the points representing the sampling units (SU), see points for more details.

pch.su

type of the points representing the sampling units (SU), see points for more details.

leg

a logical option for legend to be plotted or not, default leg=TRUE.

posi.leg

legend location in the graph, see legend for more details.

bty.leg

the type of box to be drawn around the legends. The allowed values are "o" (the default) and "n". See legend for more details

...

further arguments passed to or from other methods.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
#Plot K in E
subplot_K(subnic1)


Plot a species subniche under each sub-environmental space K

Description

The function to represent the species subniche under each subenvironment K with their respective marginality from G_K.

Usage

subplot_sp(
  subnic,
  sp,
  main = NULL,
  col.axis = "azure3",
  lty.axis = 2,
  lwd.axis = 2,
  xlab = NULL,
  ylab = NULL,
  border.E = "black",
  col.E = "#92c5de",
  lty.E = 1,
  lwd.E = 1,
  border.K = "black",
  lwd.K = 1,
  col.K = "#2c7fb8",
  lty.K = 1,
  col.Gk.pos = "red",
  col.Gk.pt = "black",
  cex.Gk.pos = 1,
  pch.Gk.pos = 21,
  border.SP = "#bc5090",
  col.SB = "#ffff99",
  lty.SP = 1,
  lwd.SP = 2,
  border.NR = "#fdb462",
  col.NR = NA,
  lty.NR = 1,
  lwd.NR = 2,
  border.SR = "#a1d99b",
  col.SR = "#a1d99b",
  lty.SR = 1,
  lwd.SR = 1,
  pch.SR.pos = 19,
  cex.SR.pos = 1,
  col.SR.pt = "black",
  col.SR.pos = "black",
  cex.SR.lab = 0.7,
  col.SR.lab = "black",
  fac.SR.lab = 1.2,
  font.sp = 2,
  col.arrow = "black",
  angle.arrow = 20,
  lwd.arrow = 2,
  length.arrow = 0.1,
  leg = TRUE,
  posi.leg = "topleft",
  bty.leg = "n",
  ...
)

Arguments

subnic

an object of class subniche.

sp

a character string of the species name.

main

a main title for the plot, see title for more details.

col.axis

axis color, see par for more details.

lty.axis

axis line type, see par for more details.

lwd.axis

axis width, see par for more details.

xlab

label for x-axis, see title for more details.

ylab

label for y-axis, see title for more details.

border.E

color border of E polygon, see polygon for more details.

col.E

inside color of E polygon, see polygon for more details.

lty.E

line type for the E border, see polygon for more details.

lwd.E

line width for the E border, see polygon for more details.

border.K

color border of K polygon, see polygon for more details.

lwd.K

line width for the K border, see polygon for more details.

col.K

inside color of K polygon, see polygon for more details.

lty.K

line type for the K border, see polygon for more details.

col.Gk.pos

color of the point representing G_k, see points for more details.

col.Gk.pt

point color contour if pch=21:25.

cex.Gk.pos

size of the point representing G_k, see points for more details.

pch.Gk.pos

type of the point representing G_k, see points for more details.

border.SP

color border of species subniche polygon, see polygon for more details.

col.SB

color of the SB area.

lty.SP

line type for the SP border, see polygon for more details.

lwd.SP

line width for the SP border, see polygon for more details.

border.NR

color border of NR polygon, see polygon for more details.

col.NR

inside color of NR polygon, see polygon for more details.

lty.NR

line type for the NR border, see polygon for more details.

lwd.NR

line width for the NR border, see polygon for more details.

border.SR

color border of SR polygon, see polygon for more details.

col.SR

inside color of SR polygon, see polygon for more details.

lty.SR

line type for the SR border, see polygon for more details.

lwd.SR

line width for the SR border, see polygon for more details.

pch.SR.pos

type of points representing the SR position, see points for more details.

cex.SR.pos

size of points representing the SR position, see points for more details.

col.SR.pt

point color contour if pch=21:25.

col.SR.pos

color of points representing the SR position, see points for more details.

cex.SR.lab

size of the species label representing the SR position, see text for more details.

col.SR.lab

color of the species label representing the SR position, see text for more details.

fac.SR.lab

factor for moving the SR labels from its original coordinates for clarity, by defaults they are multiply 1.2

font.sp

An integer which specifies which font to use for species label. 1 corresponds to plain text (the default), 2 to bold face, 3 to italic and 4 to bold italic, see par for more details.

col.arrow

arrow color, see arrows for more details.

angle.arrow

arrow angle head, see arrows for more details.

lwd.arrow

arrow width, see arrows for more details.

length.arrow

arrow head length, see arrows for more details.

leg

a logical option for legend to be plotted or not, default leg=TRUE.

posi.leg

legend location in the graph, see legend for more details.

bty.leg

the type of box to be drawn around the legends. The allowed values are "o" (the default) and "n". See legend for more details

...

further arguments passed to or from other methods.

Examples

library(subniche)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
# number of sites
N <- dim(nic1$ls)[1]
#Create a factor which defines the subsets
fact <- factor(c(rep(1,N/2),rep(2,N/2)))
# nic1 will be use as reference and fact will be use to define the subniches environment
subnic1 <- subniche(nic1, fact)
eig <- round(subnic1$eig/sum(subnic1$eig)*100,2)[1:2]
#Two graphs are drawn one after the other
subplot_sp(subnic1,"Neba")