From 8825f7187d2c7a806fffe2f807c0bab50eb65192 Mon Sep 17 00:00:00 2001 From: Paul-Carvalho Date: Wed, 15 Jan 2025 09:49:47 -0800 Subject: [PATCH] added a statement to check if likelihood is zonal logit and expected catch not equal to NULL, this generates an error instead of allowing users to create a model design that will fail at run --- R/make_model_design.R | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/R/make_model_design.R b/R/make_model_design.R index 65f7d72d..686dc37a 100644 --- a/R/make_model_design.R +++ b/R/make_model_design.R @@ -281,12 +281,16 @@ make_model_design <- port <- pt$dataset # used in create_distance_matrix() }, error = function(cond){ message("Port table not used.") - } - ) + }) # check args ---- - if (likelihood == "logit_c") { + # Expected catch input != NULL will generate errors when running models + if(likelihood == "logit_zonal" && !is.null(expectcatchmodels)){ + stop("Expected catch input must be NULL for zonal logit models") + } + + if(likelihood == "logit_c") { column_check(dataset, c(catchID, vars1, priceCol, startloc)) @@ -301,7 +305,6 @@ make_model_design <- column_check(dataset, c(catchID, vars1, vars2, priceCol, startloc)) } - ll_funs <- c("logit_c", "logit_zonal", "logit_correction", "epm_normal", "epm_lognormal", "epm_weibull")