Skip to content

Commit

Permalink
Merge pull request #47 from bbsBayes/documentation_update
Browse files Browse the repository at this point in the history
Documentation update
  • Loading branch information
AdamCSmithCWS authored Jul 28, 2023
2 parents 0648cc8 + 3242711 commit 0e14cb7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 25 deletions.
5 changes: 1 addition & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ Description: The North American Breeding Bird Survey (BBS) is a long-running
hierarchical Bayesian analysis of BBS data. You can run a full
model analysis for one or more species that you choose, or you can take
more control and specify how the data should be stratified, prepared
for 'JAGS', or modelled. The functions provided here allow you to replicate
analyses performed by the United State Geological Survey (USGS, see Link
and Sauer (2011) <doi:10.1525/auk.2010.09220>) and Canadian Wildlife Service
(CWS, see Smith and Edwards (2020) <doi:10.1101/2020.03.26.010215>).
for 'Stan', or modelled.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Expand Down
6 changes: 3 additions & 3 deletions R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ check_model <- function(model, model_variant) {
if(model_variant == "nonhier") {
if(model != "first_diff") stop("`model_variant` 'nonhier' only allowed ",
"for `first_diff` models", call. = FALSE)
warning("Non-hierarchial models are generally not recommended ",
"(see ?bbs_models), but provided for compatibility with USGS ",
"methods", call. = FALSE, immediate. = TRUE)
# warning("Non-hierarchial models are generally not recommended ",
# "(see ?bbs_models), but provided for compatibility with USGS ",
# "methods", call. = FALSE, immediate. = TRUE)
}

model
Expand Down
7 changes: 7 additions & 0 deletions R/prepare-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ prepare_data <- function(strata_data,
check_numeric(min_year, max_year, allow_null = TRUE)
check_numeric(min_n_routes, min_max_route_years, min_mean_route_years)
check_logical(quiet)
#warning if stratification == latlong and min_n_routes > 1
if(strata_data$meta_data$stratify_by == "latlong" & min_n_routes == 3){
warning("Many strata with data may have been excluded ",
"With latlong stratification, most strata have ",
"only 1 route. You may wish to set min_n_routes = 1",
call. = FALSE, immediate. = TRUE)
}

# Get observations of interest
obs <- strata_data$birds_strata %>%
Expand Down
17 changes: 2 additions & 15 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
citHeader("To cite bbsBayes2 in publication, please use both:")
citHeader("To cite bbsBayes2 in publication, please use both: Edwards et al. 2023 and Smith et al. 2023")

citEntry(
entry = "misc",
Expand All @@ -18,7 +18,7 @@ citEntry(
textVersion = "Smith, A.C., Binley, A., Daly, L., Edwards, B.P.M., Ethier, D., Frei, B., Iles, D., Meehan, T.D., and Michel, N.L., and Smith, P.A. (2023). Spatially explicit Bayesian hierarchical models for avian population status and trends. https://doi.org/10.32942/X2088D"
)

citHeader("To cite the Breeding Bird Survey data in publication, please use:")
citHeader("To cite the Breeding Bird Survey data in publication, please use Ziolkowski et al. 2022")

citEntry(
entry = "misc",
Expand All @@ -29,16 +29,3 @@ citEntry(
textVersion = "Ziolkowski Jr., D.J., Lutmerding, M., Aponte, V.I., and Hudson, M-A.R., 2022, North American Breeding Bird Survey Dataset 1966 - 2021: U.S. Geological Survey data release, https://doi.org/10.5066/P97WAZE5."
)

citHeader("To cite the original bbsBayes package in publication, please use:")

citEntry(
entry = "article",
title = "bbsBayes: An R Package for Hierarchical Bayesian Analysis of North American Breeding Bird Survey Data",
year = "2021",
journal = "Journal of Open Research Software",
volume = "9",
issue = "1",
url = "https://doi.org/10.5334/jors.329",
author = "Edwards, Brandon PM and Smith, Adam C",
textVersion = "Edwards, B.P.M and A.C. Smith. (2021). bbsBayes: An R Package for Hierarchical Bayesian Analysis of North American Breeding Bird Survey Data. Journal of Open Research Software 9(1), p.19. https://doi.org/10.5334/jors.329"
)
2 changes: 1 addition & 1 deletion man/bbsBayes2-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-01_checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ test_that("model/model_file/model_variant checks", {
for(i in unique(bbs_models$variant)) expect_silent(check_model_variant(i))
for(i in seq_len(nrow(bbs_models))) {
if(bbs_models$variant[i] == "nonhier") {
expect_warning(check_model(bbs_models$model[i], bbs_models$variant[i]))
#expect_warning(check_model(bbs_models$model[i], bbs_models$variant[i]))
} else {
expect_silent(check_model(bbs_models$model[i], bbs_models$variant[i]))
}
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-07_prepare_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ test_that("prepare_model() first_diff / slope", {

for(i in seq_len(nrow(m))) {

if(m$variant[i] == "nonhier") ex <- expect_warning else ex <- expect_silent
#if(m$variant[i] == "nonhier") ex <- expect_warning else
ex <- expect_silent
ex(md <- prepare_model(p,
model = m$model[!!i],
model_variant = m$variant[!!i],
Expand Down

0 comments on commit 0e14cb7

Please sign in to comment.