https://github.com/psolymos/resourceselection
Resource Selection (Probability) Functions for Use-Availability Data in R
https://github.com/psolymos/resourceselection
cran ecology estimation lele r rsf rspf solymos weighted-distributions
Last synced: about 1 year ago
JSON representation
Resource Selection (Probability) Functions for Use-Availability Data in R
- Host: GitHub
- URL: https://github.com/psolymos/resourceselection
- Owner: psolymos
- Created: 2014-10-21T03:07:55.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-05-21T16:26:28.000Z (about 2 years ago)
- Last Synced: 2025-04-13T02:13:09.600Z (about 1 year ago)
- Topics: cran, ecology, estimation, lele, r, rsf, rspf, solymos, weighted-distributions
- Language: R
- Homepage: https://peter.solymos.org/ResourceSelection/
- Size: 14.9 MB
- Stars: 8
- Watchers: 5
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ResourceSelection: Resource Selection (Probability) Functions for Use-Availability Data
[](https://CRAN.R-project.org/package=ResourceSelection)
[](https://www.rdocumentation.org/packages/ResourceSelection/)
[](https://github.com/psolymos/ResourceSelection/actions/workflows/check.yml)
Resource Selection (Probability) Functions
for use-availability wildlife data
based on weighted distributions as described in
Lele and Keim (2006), Lele (2009), and Solymos & Lele (2016).
## Install
CRAN version:
```R
install.packages("ResourceSelection")
```
Development version:
```R
devtools::install_github("psolymos/ResourceSelection")
```
User visible changes in the package are listed in the [NEWS](https://github.com/psolymos/ResourceSelection/blob/master/NEWS.md) file.
## Report a problem
Use the [issue tracker](https://github.com/psolymos/ResourceSelection/issues)
to report a problem.
## Example
```R
## Some data processing
goats$exp.HLI <- exp(goats$HLI)
goats$sin.SLOPE <- sin(pi * goats$SLOPE / 180)
goats$ELEVATION <- scale(goats$ELEVATION)
goats$ET <- scale(goats$ET)
goats$TASP <- scale(goats$TASP)
## Fit two RSPF models:
## global availability (m=0) and bootstrap (B=99)
m1 <- rspf(STATUS ~ TASP + sin.SLOPE + ELEVATION, goats, m=0, B = 99)
m2 <- rspf(STATUS ~ TASP + ELEVATION, goats, m=0, B = 99)
## Inspect the summaries
summary(m1)
# Call:
# rspf(formula = STATUS ~ TASP + sin.SLOPE + ELEVATION, data = goats, m = 0,
# B = 99)
#
# Resource Selection Probability Function (Logistic RSPF) model
# Non-matched Used-Available design
# Maximum Likelihood estimates
# with Nonparametric Bootstrap standard errors (B = 99)
#
# Fitted probabilities:
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 1.947e-08 4.280e-07 9.977e-07 1.376e-06 1.924e-06 8.793e-06
#
# Coefficients (logit link):
# Estimate Std. Error z value Pr(>|z|)
# (Intercept) -16.89454 0.26284 -64.276 <2e-16 ***
# TASP 0.39116 0.01396 28.011 <2e-16 ***
# sin.SLOPE 5.36640 0.09740 55.098 <2e-16 ***
# ELEVATION 0.09829 0.01165 8.439 <2e-16 ***
# ---
# Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#
# Log-likelihood: -5.729e+04
# BIC = 1.146e+05
#
# Hosmer and Lemeshow goodness of fit (GOF) test:
# X-squared = 152.4, df = 8, p-value < 2.2e-16
summary(m2)
# Call:
# rspf(formula = STATUS ~ TASP + ELEVATION, data = goats, m = 0, B = 99)
#
# Resource Selection Probability Function (Logistic RSPF) model
# Non-matched Used-Available design
# Maximum Likelihood estimates
# with Nonparametric Bootstrap standard errors (B = 99)
#
# Fitted probabilities:
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 0.01194 0.58010 0.86180 0.73660 0.95710 0.99830
#
# Coefficients (logit link):
# Estimate Std. Error z value Pr(>|z|)
# (Intercept) 1.62906 0.10110 16.11 <2e-16 ***
# TASP 1.86071 0.07751 24.01 <2e-16 ***
# ELEVATION 1.14338 0.08315 13.75 <2e-16 ***
# ---
# Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#
# Log-likelihood: -5.91e+04
# BIC = 1.182e+05
#
# Hosmer and Lemeshow goodness of fit (GOF) test:
# X-squared = 174.3, df = 8, p-value < 2.2e-16
## Compare models: looks like m1 is better supported
CAIC(m1, m2)
# df CAIC
# m1 4 114591.7
# m2 3 118225.2
## Visualize the relationships
plot(m1)
mep(m1) # marginal effects similar to plot but with CIs
kdepairs(m1) # 2D kernel density estimates
plot(m2)
kdepairs(m2)
mep(m2)
```
#### Marginal effect plots

#### Scatterplot matrix with 2D kernel density estimates

## References
Lele, S.R. (2009)
A new method for estimation of resource selection probability function.
_Journal of Wildlife Management_ 73, 122--127. [[link](https://doi.org/10.2193/2007-535)]
Lele, S. R. & Keim, J. L. (2006)
Weighted distributions and estimation of resource selection probability functions.
_Ecology_ 87, 3021--3028. [[link](https://doi.org/10.1890/0012-9658(2006)87%5B3021:WDAEOR%5D2.0.CO;2)]
Solymos, P. & Lele, S. R. (2016) Revisiting resource selection probability functions and single-visit methods: clarification and extensions. _Methods in Ecology and Evolution_ 7, 196--205. [[link](https://doi.org/10.1111/2041-210X.12432), [preprint](https://arxiv.org/abs/1501.05880)]