diff --git a/R/data_mile1.R b/R/data_mile1.R index 060e2fa00..a986d7604 100644 --- a/R/data_mile1.R +++ b/R/data_mile1.R @@ -24,7 +24,11 @@ #' viable units for the composition data, where the former is the preferred #' unit of measurement.} #' \item{uncertainty}{A real value providing a measurement of uncertainty -#' for value.} +#' for value. For catches and survey indices of abundance this should be +#' the standard deviation of the logged observations if you are using the +#' lognormal distribution to fit your data. For composition data it will +#' be your input sample size. +#' } #' } #' @source \url{www.github.com/Bai-Li-NOAA/Age_Structured_Stock_Assessment_Model_Comparison} "data_mile1" diff --git a/data-raw/data_mile1.R b/data-raw/data_mile1.R index 0d50638ff..9326d30f7 100644 --- a/data-raw/data_mile1.R +++ b/data-raw/data_mile1.R @@ -15,6 +15,10 @@ ############################################################################### # Helper functions and load packages ############################################################################### +cv_2_sd <- function(x) { + sqrt(log(x^2 + 1)) +} + check_ASSAMC <- function() { packages_all <- .packages(all.available = TRUE) if (!"ASSAMC" %in% packages_all) { @@ -25,6 +29,7 @@ check_ASSAMC <- function() { library("ASSAMC") return(TRUE) } + check_ASSAMC() library(dplyr) @@ -52,11 +57,7 @@ landings_data <- data.frame( ), value = returnedom[["em_input"]]$L.obs[[1]], unit = "mt", # metric tons - # TODO: discuss if CV the appropriate input here given that landings will be - # modeled with a lognormal or similar likelihood. Just because previous - # models have used CV doesn't mean we have to continue to use it. - # E.g., `dlnorm(sdlog = )` uses a standard deviation on the log scale. - uncertainty = returnedom[["em_input"]]$cv.L[[1]] + uncertainty = cv_2_sd(returnedom[["em_input"]]$cv.L[[1]]) ) ############################################################################### @@ -76,7 +77,7 @@ index_data <- data.frame( ), value = returnedom[["em_input"]]$surveyB.obs[[1]], unit = "mt", - uncertainty = returnedom[["em_input"]]$cv.survey[[1]] + uncertainty = cv_2_sd(returnedom[["em_input"]]$cv.survey[[1]]) ) ############################################################################### @@ -164,7 +165,7 @@ unlink("FIMS_input_data.csv") usethis::use_data(data_mile1, overwrite = TRUE) rm( - check_ASSAMC, + check_ASSAMC, cv_2_sd, age_data, landings_data, index_data, weightatage_data, timingfishery, weightsfishery, data_mile1, returnedom, diff --git a/data/data_mile1.rda b/data/data_mile1.rda index d631bca5b..cfdec993a 100644 Binary files a/data/data_mile1.rda and b/data/data_mile1.rda differ diff --git a/man/data_mile1.Rd b/man/data_mile1.Rd index c27b9c86a..fd5fe1406 100644 --- a/man/data_mile1.Rd +++ b/man/data_mile1.Rd @@ -24,7 +24,11 @@ units for each data type are as follows. \code{mt} is used for \code{index}, viable units for the composition data, where the former is the preferred unit of measurement.} \item{uncertainty}{A real value providing a measurement of uncertainty -for value.} +for value. For catches and survey indices of abundance this should be +the standard deviation of the logged observations if you are using the +lognormal distribution to fit your data. For composition data it will +be your input sample size. +} } } \source{