Oleksii Dubovyk, Ella DiPetto, Chi Wei, Iroshmal Peiris, Eric L. Walters
Data and analyses for the VAS 2024 annual meeting presentation (and subsequent pubs, hopefully) on observed avian and mammalian diversity of shorelines in coastal Virginia. Data privided by Ella DiPetto.
The data collected during the dissertation research of Ella DiPetto.
The main dataset containing the data on wildlife observations - request from Ella (gdipe001@odu.edu).
Supplementary dataset on duration of each deployment of trail cameras.
The dataset used was EltonTraits 1.01.
The data on tides from the NOAA.
The main script, all analyses are here.
A function to find a local time of sunrise and sunset for a given date and coordinates. Based on the USGS calculator.
Arguments
date
- chr, date of interest in "yyyy-mm-dd" formatlat
- num, decimal latitudelon
- num, decimal longitudeutc_offset
- num, time zone offset relative to the UTC: e.g., EDT is-4
, EST is-5
, PST is-8
.
Usage
To calculate the sunrise and sunset time for Norfolk on Apr 2nd 2024, we call
suntime(date = "2024-04-02", lat = 36.8794, lon = -76.2892, utc_offset = -4)
## [1] "06:48:22" "19:28:38"
A group of functions to build rarefaction curves through interpolation or extrapolation procedures. interpolation(..., mode = "l")
is built to handle large numbers.
It is assumed that for a community with
and extrapolated values are estimated through Chao1 estimator2,
All questions regarding this section should be addressed to Oleksii, oadubovyk@gmail.com
Desperate attempts to go away from the singleton/doubleton-based Chao2 approximations of extrapolated rarefaction curves. Use at your own risk: the approach has not been peer reviewed and mostly relies on thoughts and prayers.
The notation is the following: N
denotes a vector of values representing abundances of different species within a community.
prob_same(N, m)
estimates the expected probability of getting an unobserved before species in a sample drawn from community N
at m
th individual with replacement (therefore, inaccurate). If we let
Again, this estimation is inaccurate.
probs_roll(N)
estimates the expected probabilities when drawing a sequence of individuals from a community simply applying prob_same(N, m)
to the sequence of individuals
probs_combin(n, k = 1)
uses combinatorics to estimate said probabilities. I honestly don't remember how I came up with that four years ago, I might have looked it up in some of the Chao papers, all I remember is that it is somehow related to the hypergeometric distribution. If an m
th individual is drawn from a community, then the probability of this individual representing a new species not previously observed with
The k
parameter specifies a step size with the number of individuals: the formula can be elaborated to estimate the probability of getting a new species when
beyond_combin(N, ceil, burnin)
tries to estimate how would the sequence of probs_combin(N)
behave once probs_roll(N)
(ignoring some first burnin
values and all the way until ceil
). We can then use beyond_combin(N, ceil, burnin) %>% sum()
to estinmate the species richness including the unobserved part without relying on singleton-based Chao1 estimator (hint: the absence of singletons still creates problems since the last values of the probs_combin()
are zeros; zeros are ignored in beyond_combin()
).
Useful functions to compare models within the AIC framework.
metaAIC(model)
extracts some AIC information from a model and returns a named vector: formula
- model formula, AIC
- AIC value, logLik
- log-likelihood, df
- degrees of freedom.
rankAIC(list(model1, model2, ...))
returns a list of input models ranked by $\delta$AIC with the following columns: model
- model formula, AIC
- AIC value, delta_AIC
- $\delta$AIC, weight
- AIC weight, logLik
- log-likelihood, df
- degrees of freedom.
- The latest R version
- Posit/RStudio
- Install
tidyverse
,lubridate
,data.table
,caret
:
packages <- c("tidyverse", "lubridate", "data.table", "caret")
installed_packages <- packages %in% rownames(installed.packages())
if (any(installed_packages == FALSE)) {
install.packages(packages[!installed_packages])
}
invisible(lapply(packages, library, character.only = TRUE))
- Install Git Bash
- Open the folder you want our repository to be copied to, e.g.,
cd /c/Users/username/CoastalDiversity
- Let the Git know who you are
git config --global user.name "Your Name" git config --global user.email "youremail@domain.com"
- Type
git clone https://github.com/OleksiiDubovyk/CoastalDiversity
- Whenever you want to get the newest code, type
git pull
- Create a GitHub account
- Install GitHub CLI
- Open Windows PowerShell and run
winget install --id GitHub.cli
- Restart Git Bash, navigate to the working directory, an run
gh auth login
- Follow the prompts: GitHub.com -> HTTPS -> Y -> Login with a web browser
- Open Git Bash, run
git remote set-url origin https://{TOKEN}@github.com/OleksiiDubovyk/CoastalDiversity.git/
- Whenever you want to edit the code, type
git pull git add filename.extension # specify the file you have just changed git commit -m "Your comments on what you've added" git push
Footnotes
-
Wilman, H., J. Belmaker, J. Simpson, C. de la Rosa, M. M. Rivadeneira, and W. Jetz. 2014. EltonTraits 1.0: species-level foraging attributes of the world’s birds and mammals. Ecology 95:2027–2027. https://doi.org/10.1890/13-1917.1 ↩
-
Chao, A., N. J. Gotelli, T. C. Hsieh, E. L. Sander, K. H. Ma, R. K. Colwell, and A. M. Ellison. 2014. Rarefaction and extrapolation with Hill numbers: a framework for sampling and estimation in species diversity studies. Ecological Monographs 84:45–67. https://doi.org/10.1890/13-0133.1 ↩ ↩2