diff options
author | Ken Kellner <ken@kenkellner.com> | 2024-01-30 15:48:24 -0500 |
---|---|---|
committer | Ken Kellner <ken@kenkellner.com> | 2024-01-30 15:48:24 -0500 |
commit | 20a7cae2d08dc9390f7110eed20288751d4266cf (patch) | |
tree | 5bafabb8fb03a3c422187cb60f4f318a736767a0 | |
parent | 717c6c7ae895e9f742fbe25b5c9cb10057daa439 (diff) |
Fix occuCOP and IDSremove_lme4
-rw-r--r-- | R/IDS.R | 2 | ||||
-rw-r--r-- | R/occuCOP.R | 4 | ||||
-rw-r--r-- | tests/testthat/test_IDS.R | 3 |
3 files changed, 7 insertions, 2 deletions
@@ -73,6 +73,8 @@ IDS <- function(lambdaformula = ~1, formlist <- list(lam=lambdaformula, ds=form_hds, pc=form_pc, oc=form_oc, phi=availformula) + check_no_support(formlist) + stopifnot(inherits(dataDS, "unmarkedFrameDS")) stopifnot(inherits(dataPC, c("unmarkedFramePCount", "NULL"))) stopifnot(inherits(dataOC, c("unmarkedFrameOccu", "NULL"))) diff --git a/R/occuCOP.R b/R/occuCOP.R index f22c235..07875e3 100644 --- a/R/occuCOP.R +++ b/R/occuCOP.R @@ -79,7 +79,7 @@ setMethod( # Occupancy submodel ------------------------------------------------------- # Retrieve the fixed-effects part of the formula - psiformula <- lme4::nobars(as.formula(formlist$psiformula)) + psiformula <- remove_bars(as.formula(formlist$psiformula)) psiVars <- all.vars(psiformula) # Retrieve the site covariates @@ -109,7 +109,7 @@ setMethod( # Detection submodel ------------------------------------------------------- # Retrieve the fixed-effects part of the formula - lambdaformula <- lme4::nobars(as.formula(formlist$lambdaformula)) + lambdaformula <- remove_bars(as.formula(formlist$lambdaformula)) lambdaVars <- all.vars(lambdaformula) # Retrieve the observation covariates diff --git a/tests/testthat/test_IDS.R b/tests/testthat/test_IDS.R index 61d348d..7565b25 100644 --- a/tests/testthat/test_IDS.R +++ b/tests/testthat/test_IDS.R @@ -72,6 +72,9 @@ test_that("IDS can fit models with covariates", { unitsOut="kmsq") expect_equal(length(coef(mod_sim)), 4) expect_equal(length(coef(mod_sep)), 5) + + # Doesn't support random effects + expect_error(update(mod_sep, lambdaformula = ~elev + (1|group))) }) test_that("IDS can fit models with occupancy data", { |