The function VarCorrCI
takes a merMod
object and returns variance components and 95% confidence intervals.
Modified from: http://rpubs.com/bbolker/varwald and various other places.
library(lme4)
The function VarCorrCI
takes a merMod
object and returns variance components and 95% confidence intervals.
Modified from: http://rpubs.com/bbolker/varwald and various other places.
library(lme4)
A function that takes a sample (rows)-by-species (columns) community matrix and uses coverage-based subsampling to identify the number of samples of individuals required to achieve a given level of coverage of total biodiversity.
From: Chao, Anne, and Lou Jost. "Coverage‐based rarefaction and extrapolation: standardizing samples by completeness rather than size." Ecology 93.12 (2012): 2533-2547.
# generate fake community matrix
vec <- sample(0:100, 100, replace = T)
Modified from:
Updated: 2016-07-27
Takes a sample-by-species abundance matrix and species-by-species functional distance matrix and returns values of Rao's quadratic entropy. Values are optionally converted into effective numbers of species through the transformation: 1/(1 - D).
# Create sample-by-species abundance matrix
abund <- matrix(sample(1:100, 100, replace = T), 10, 10)
colnames(abund) <- paste0("species", 1:10)
Compute semi-variance (partial R[2]) for GLMMs fit used lme4.
library(lme4)
example <- data.frame(
y = rnorm(100),
x = rnorm(100),
nested1 = letters[1:20],
nested2 = rep(letters[1:5], each = 4),
A function that takes individual species thermal indices (STIs) and their abundances, and partitions their contributions to the change in the community thermal index through at least two time points.
example <- data.frame(
site = "site1",
date = c(rep(as.Date("2001-01-01"), 5), rep(as.Date("2002-01-01"), 5)),
species = paste0("species", LETTERS[1:5]),
STI = c(21.2, 23.4, 19.2, 26.1, 22.0),
abundance = c(0, 0, 10, 8, 3, 1, 3, 5, 0, 0)
)