sbd

Non-negative size biased distributions and models. Developed for estimating animal speed from camera trap observations, where slower speeds are less likely to be observed. Includes a simple harmonic mean function.

https://github.com/marcusrowcliffe/sbd

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: wiley.com
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.1%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Non-negative size biased distributions and models. Developed for estimating animal speed from camera trap observations, where slower speeds are less likely to be observed. Includes a simple harmonic mean function.

Basic Info
  • Host: GitHub
  • Owner: MarcusRowcliffe
  • Language: R
  • Default Branch: main
  • Size: 95.7 KB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Created over 2 years ago · Last pushed 11 months ago
Metadata Files
Readme

README.Rmd

---
title: "sbd"
output: github_document
always_allow_html: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Size Biased Distributions

An R package for fitting and plotting size-biased non-negative distributions. Size-biased distributions occur when the probability of observing something is proportional to its size. The example motivating this package is observations of animal speeds made by camera traps, where faster moving animals are more likely to encounter camera traps and hence be recorded, with probability of observation expected to be proportional to speed ([Rowcliffe et al. 2016](https://zslpublications.onlinelibrary.wiley.com/doi/full/10.1002/rse2.17)).

The core function is `sbm`, which performs model fitting and estimates the underlying average of a set of size biased data, given a model formula and a dataframe containing the variables named in the formula. Default usage is non-parametric, providing the harmonic mean as the estimator of underlying average:

```{r}
library(sbd)
data("BCI_speed_data")
agoutiData <- subset(BCI_speed_data, species=="agouti")
mod <- sbm(speed~1, agoutiData)
mod
```

The distribution can be plotted using the `hist` method:

```{r}
hist(mod)
```

Three parametric distributions are also available - log-normal, gamma, and Weibull. These can be selected using the `pdf` argument, and model support can be evaluated using the `AIC` method:

```{r}
lmod <- sbm(speed~1, agoutiData, pdf = "lnorm")
gmod <- sbm(speed~1, agoutiData, pdf = "gamma")
wmod <- sbm(speed~1, agoutiData, pdf = "weibull")
AIC(lmod, gmod, wmod)
```

For parametric models without covariates, a fitted probability density function is added to the data distribution when it is plotted:

```{r}
hist(lmod)
```

Parametric models can accept covariates, for example, testing the effect of species body mass on average speed:

```{r}
lmod_null <- sbm(speed~1, BCI_speed_data, "lnorm")
lmod_mass <- sbm(speed~mass, BCI_speed_data, "lnorm")
AIC(lmod_null, lmod_mass)
```

The parameters of the underlying linear model can be inspected using the `summary` method, where `lmean` is the natural log of the underlying mean, and `lsig` is the natural log of the underlying standard deviation:

```{r}
summary(lmod_mass)
```

The `predict` method can be used to calculate estimated averages and their standard errors for any desired predictor value, for example:

```{r}
nd <- data.frame(mass = c(1,10,100))
predict(lmod_mass, newdata = nd)
```

Owner

  • Login: MarcusRowcliffe
  • Kind: user

GitHub Events

Total
  • Push event: 1
Last Year
  • Push event: 1

Packages

  • Total packages: 1
  • Total downloads:
    • cran 180 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: sbd

Size Biased Distributions

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 180 Last month
Rankings
Dependent packages count: 28.8%
Dependent repos count: 35.4%
Average: 49.9%
Downloads: 85.6%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • MASS * imports
  • bbmle * imports
  • dplyr * imports