Skip to content

Commit

Permalink
dook
Browse files Browse the repository at this point in the history
  • Loading branch information
juniperlsimonis committed Apr 15, 2023
1 parent 6e236cb commit a81a4be
Show file tree
Hide file tree
Showing 17 changed files with 262 additions and 223 deletions.
5 changes: 5 additions & 0 deletions .github/404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Page not found (404)

The page you requested was not found.

Please use the links in the navigation bar.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CODEOWNERS for testthat
# https://www.tidyverse.org/development/understudies
.github/CODEOWNERS @juniperlsimonis @ethanwhite @weecology
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Authors@R: c(
comment = c(ORCID = "0000-0002-8630-1458")),
person(c("Ethan", "P."), "White", role = c("aut"),
comment = c(ORCID = "0000-0001-6728-7745")),
person(c("S.K.", "Morgan"), "Ernest", role = c("aut"),
person(c("S. K.", "Morgan"), "Ernest", role = c("aut"),
comment = c(ORCID = "0000-0002-6026-8530")))
Description: Create a directory, populate it with data, build models, forecast rodent populations, and visualize the results. This package provides the functionality underlying the Portal Predictions Project <https://github.com/weecology/portalpredictions> as well as support for exploring and developing new models in sandbox environments.
URL: https://weecology.github.io/portalcasting, https://github.com/weecology/portalcasting
Expand Down
350 changes: 175 additions & 175 deletions NEWS.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions R/evaluate.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
#'
#' evaluate_forecasts(main = main1)
#'
#' ids <- select_forecasts(main = main1)
#' ids <- select_forecasts(main = main1)$forecast_id
#'
#' evaluate_forecast(main = main1,
#' forecast_id = ids[1])
#'
#' read_forecast_evaluations(main = main1)
#' read_forecasts_evaluations(main = main1)
#'
#' unlink(main1, recursive = TRUE)
#' }
Expand Down
8 changes: 4 additions & 4 deletions R/figures.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ plot_forecasts_error_lead <- function (main = ".",
if (nmodels == 1 & nspecies == 1) {

yy <- round(evals_in$error, 3)
yrange <- range(c(0, yy), na.rm = TRUE)
yrange <- range(c(-1, yy, 1), na.rm = TRUE)
xrange <- c(max(evals_in$lead_time_newmoons) + 0.25, 0)

oldpar <- par(no.readonly = TRUE)
Expand Down Expand Up @@ -165,7 +165,7 @@ plot_forecasts_error_lead <- function (main = ".",

species_in <- evals_in$species %in% species[j]
yy <- round(evals_in$error[species_in], 3)
yrange <- range(c(0, yy), na.rm = TRUE)
yrange <- range(c(-1, yy, 1), na.rm = TRUE)

for(i in 1:nmodels){

Expand Down Expand Up @@ -417,7 +417,7 @@ plot_forecasts_cov_RMSE <- function (main = ".",
abline(h = 0.95, lwd = 2, lty = 3)

in_i <- which(forecast_species == species[i])
ymax <- max(forecast_RMSE[in_i], na.rm = TRUE)
ymax <- max(c(0, forecast_RMSE[in_i]), na.rm = TRUE)
x1 <- 0.5
x2 <- 1
y1 <- 0 + (i - 1) * 1 * (1/nspecies)
Expand Down Expand Up @@ -446,7 +446,7 @@ plot_forecasts_cov_RMSE <- function (main = ".",
rect(j - 0.1, quants[2], j + 0.1, quants[4], col = "white")
points(c(j - 0.1, j + 0.1), rep(quants[3], 2), type = "l", lwd = 2)
points(xs, ys2, col = rgb(0.3, 0.3, 0.3, 0.4), pch = 1, cex = 0.5)
axis(2, labels = FALSE, tck = 0, at = seq(min(ys) - 2, max(ys) + 2, 0.1))
axis(2, labels = FALSE, tck = 0, at = seq(min(c(0, ys)) - 2, max(c(1,ys)) + 2, 0.1))

if (nmodels > 1) {
axis(1, at = 1:nmodels, labels = models, cex.axis = 1.125, xpd = TRUE)
Expand Down
28 changes: 17 additions & 11 deletions R/models_jags.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#'
#' @param inits `list` of model parameter initializer functions. See [`prefab_models_controls`].
#'
#' @param model `character` value of the model file name. See [`prefab_models_controls`].
#' @param model_file `character` value of the model file name. See [`prefab_models_controls`].
#'
#' @param data_names `character` vector of data values to include in the data `list`. See [`prefab_models_controls`].
#'
Expand Down Expand Up @@ -75,9 +75,11 @@
#' main1 <- file.path(tempdir(), "runjags")
#'
#' setup_dir(main = main1)
#' dataset <- "all"
#' species <- "DM"
#' model <- "jags_RW"
#' dataset <- "all"
#' species <- "DM"
#' model <- "jags_RW"
#' model_file <- gsub("'", "",
#' models_controls(main)[[model]]$fit$full_model_file)
#'
#' abundance <- prepare_abundance(main = main1,
#' dataset = dataset,
Expand All @@ -88,7 +90,11 @@
#' metadata <- read_metadata(main = main1)
#' newmoons <- read_newmoons(main = main1)
#' covariates <- read_covariates(main = main1)
#' control_runjags <- runjags_controls( )
#' control_runjags <- runjags_controls(nchains = 3,
#' adapt = 1e3,
#' burnin = 1e3,
#' sample = 1e3,
#' thin = 1)
#' data_names <- c("count", "N", "log_mean_count")
#'
#' runjags_model(model = model)
Expand All @@ -110,11 +116,11 @@
#' monitors = c("mu", "sigma"),
#' inits = list(mu = rnorm(1, data$log_mean_count, 0.1),
#' sigma = runif(1, 0.01, 0.5)),
#' model = model,
#' model_file = model_file,
#' data_names = data_names,
#' control_runjags = control_runjags)
#'
#' forecast(object = fit_runjags,
#' forecast(object = fit,
#' h = metadata$time$lead_time_newmoons,
#' level = metadata$confidence_level,
#' nsamples = metadata$nsamples)
Expand Down Expand Up @@ -157,9 +163,9 @@ runjags_inits <- function (inits) {
#'
#' @export
#'
runjags_model <- function (model) {
runjags_model <- function (model_file) {

scan(file = model,
scan(file = model_file,
what = "character",
quiet = TRUE)

Expand Down Expand Up @@ -221,14 +227,14 @@ fit_runjags <- function (abundance,
covariates,
monitors,
inits,
model,
model_file,
data_names,
control_runjags = runjags_controls( )) {

monitor <- runjags_monitors(monitors = monitors,
metadata = metadata)
init <- runjags_inits(inits = inits)
jags_model <- runjags_model(model = model)
jags_model <- runjags_model(model_file = model_file)
data <- runjags_data(data_names = data_names,
abundance = abundance,
metadata = metadata,
Expand Down
2 changes: 1 addition & 1 deletion R/models_tsglm.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#' \dontrun{
#' main1 <- file.path(tempdir(), "metatsglm")
#'
#' setup_dir(main = main1)
#' setup_production(main = main1)
#' dataset <- "all"
#' species <- "DM"
#' model <- "pevGARCH"
Expand Down
7 changes: 3 additions & 4 deletions R/process_casts.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@
#' args = fit_args)
#'
#'
#' forecast_args <- named_null_list(element_names = names(model_controls$cast$args))
#' forecast_args <- named_null_list(element_names = names(model_controls$forecast$args))
#' for (i in 1:length(forecast_args)) {
#' forecast_args[[i]] <- eval(parse(text = model_controls$cast$args[i]))
#' forecast_args[[i]] <- eval(parse(text = model_controls$forecast$args[i]))
#' }
#'
#' model_forecast <- do.call(what = model_controls$cast$fun,
#' model_forecast <- do.call(what = model_controls$forecast$fun,
#' args = forecast_args)
#'
#' process_model_output(main = main1,
Expand All @@ -91,7 +91,6 @@
#' forecast_table = cast_table)
#' cast_tables <- read_forecast_tables(main = main1)
#' cast_metadata <- read_forecast_metadata(main = main1)
#' cast_fit <- read_model_fit(main = main1)
#' cast_forecast <- read_model_forecast(main = main1)
#'
#' casts_metadata <- read_forecasts_metadata(main = main1)
Expand Down
37 changes: 29 additions & 8 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,34 @@ development:
mode: auto

template:
bootstrap: 5
bootstrap: 5

news:
releases:
- text: "Version 0.50.0"
href: https://github.com/weecology/portalcasting/releases/tag/v0.50.0

home:
strip_header: true

authors:
Juniper L. Simonis:
href: https://www.dapperstats.com/author/dr.-juniper-l.-simonis/
Glenda M. Yenni:
href: https://www.weecology.org/author/glenda-m.-yenni/
Ellen K. Bledsoe:
href: https://nature.arizona.edu/ellen-bledsoe
Erica M. Christensen:
href: https://scholar.google.com/citations?user=_cBpCegAAAAJ&hl=en
Henry Senyondo:
href: https://www.weecology.org/author/henry-senyondo/
Hao Ye:
href: https://haoye.us/
Ethan P. White:
href: https://www.weecology.org/author/ethan-white/
S. K. Morgan Ernest:
href: https://www.weecology.org/author/morgan-ernest/


navbar:
title: "portalcasting"
Expand All @@ -13,7 +40,7 @@ navbar:
right: [twitter, github, website]
components:
articles:
text: "Vignettes"
text: "Articles"
menu:
- text: "Current Models"
href: articles/current_models.html
Expand All @@ -23,12 +50,6 @@ navbar:
href: articles/adding_model_and_data.html
- text: "Codebase"
href: articles/codebase.html
reference:
text: "Reference"
href: reference/index.html
news:
text: "News"
href: news/index.html
twitter:
icon: fa-twitter
href: https://twitter.com/weecology
Expand Down
4 changes: 2 additions & 2 deletions man/evaluate-forecasts.Rd

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

2 changes: 1 addition & 1 deletion man/portalcasting-package.Rd

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

7 changes: 3 additions & 4 deletions man/process-forecast-output.Rd

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

24 changes: 15 additions & 9 deletions man/runjags-models.Rd

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

2 changes: 1 addition & 1 deletion man/tsglm-models.Rd

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

0 comments on commit a81a4be

Please sign in to comment.