-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
#' Simulated catch of lobsters per pot | ||
#' Simulated CPUE data | ||
#' | ||
#' Simulated catch of lobsters per pot. | ||
#' | ||
#' @format A data.frame with four fields: | ||
#' @format a \code{tibble} containing 5 fields including: | ||
#' \describe{ | ||
#' \item{lobsters}{Age in years.} | ||
#' \item{year}{Standard deviation of length at age.} | ||
#' \item{month}{Standard deviation of length at age.} | ||
#' \item{depth}{Standard deviation of length at age.} | ||
#' \item{soak}{Standard deviation of length at age.} | ||
#' } | ||
#' | ||
"lobsters_per_pot" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
#' Logit | ||
#' | ||
#' @return a \code{data.frame} or a \code{ggplot} object. | ||
#' | ||
#' @author Darcy Webber \email{[email protected]} | ||
#' | ||
#' @inheritParams stats::qlogis | ||
#' @return the density. | ||
#' @importFrom stats qlogis | ||
#' @export | ||
#' | ||
logit <- qlogis | ||
logit <- function(p, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE) { | ||
qlogis(p = p, location = location, scale = scale, lower.tail = lower.tail, log.p = log.p) | ||
} | ||
|
||
|
||
#' Logistic | ||
#' | ||
#' @return a \code{data.frame} or a \code{ggplot} object. | ||
#' | ||
#' @author Darcy Webber \email{[email protected]} | ||
#' | ||
#' @param q vector of quantiles. | ||
#' @inheritParams stats::plogis | ||
#' @param log.p logical; if TRUE, probabilities p are given as log(p). | ||
#' @return gives the distribution function. | ||
#' @importFrom stats plogis | ||
#' @export | ||
#' | ||
logistic <- plogis | ||
logistic <- function(q, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE) { | ||
plogis(q = q, location = location, scale = scale, lower.tail = lower.tail, log.p = log.p) | ||
} | ||
|
||
|
||
#' Get the unstandardised indices | ||
|
@@ -26,9 +30,6 @@ logistic <- plogis | |
#' @param year The year or time label (e.g. year, Year, fishing_year, etc). | ||
#' @param rescale How to re-scale the series. Choose from "raw" to retain the raw unstandardised series, or a number to re-scale by. | ||
#' @return a \code{data.frame} or a \code{ggplot} object. | ||
#' | ||
#' @author Darcy Webber \email{[email protected]} | ||
#' | ||
#' @import brms | ||
#' @import dplyr | ||
#' @export | ||
|
@@ -57,8 +58,8 @@ get_unstandarsied <- function(fit, year = "year", rescale = 1) { | |
gm <- geo_mean(unstd$cpue) | ||
|
||
fout <- unstd %>% | ||
mutate(Mean = cpue, Median = cpue) %>% | ||
select(-cpue) | ||
mutate(Mean = .data$cpue, Median = .data$cpue) %>% | ||
select(-.data$cpue) | ||
|
||
# Rescale the series | ||
if (rescale == "raw") { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,6 @@ | |
#' @param group the variable to obtain | ||
#' @param hurdle if a hurdle model then use the hurdle | ||
#' @return a \code{data.frame}. | ||
#' | ||
#' @author Darcy Webber \email{[email protected]} | ||
#' | ||
#' @importFrom reshape2 melt | ||
#' @importFrom readr parse_number | ||
#' @importFrom stringr str_split str_detect | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,16 @@ | |
#' @param criterion the criterion to use | ||
#' @param sort to sort the table with the best models at the top | ||
#' @param ... additional parameters passed to \code{add_criterion} | ||
#' | ||
#' @author Darcy Webber \email{[email protected]} | ||
#' | ||
#' @import brms | ||
#' @import dplyr | ||
#' @importFrom rstan get_elapsed_time get_num_upars | ||
#' @importFrom lubridate seconds_to_period hour minute second | ||
#' @importFrom stats setNames | ||
#' @export | ||
#' | ||
table_criterion <- function(fits, criterion = c("loo", "loo_R2", "bayes_R2", "log_lik"), sort = TRUE, ...) { | ||
table_criterion <- function(fits, | ||
criterion = c("loo", "loo_R2", "bayes_R2", "log_lik"), | ||
sort = TRUE, ...) { | ||
|
||
n <- length(fits) | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
library(testthat) | ||
|
||
test_check("influ2") |