diff --git a/.Rbuildignore b/.Rbuildignore index 4c0cdcd2..8b6f88f9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -21,3 +21,4 @@ ^tests/testthat/Rplots\.pdf$ ^tests/local$ ^memcheck\.R$ +^\.gcda$ diff --git a/.gitignore b/.gitignore index 09be2d9e..6ace983a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ Meta /Meta/ desktop.ini ^cran-comments\.md$ +^\.gcda$ diff --git a/man/jsdgam.Rd b/man/jsdgam.Rd index 1e378328..3ecfae31 100644 --- a/man/jsdgam.Rd +++ b/man/jsdgam.Rd @@ -335,6 +335,7 @@ priors <- get_mvgam_priors(formula = count ~ # Poisson observations family = poisson()) +priors # Fit a JSDM that estimates a hierarchical temperature responses # and that uses three latent spatial factors @@ -349,6 +350,9 @@ mod <- jsdgam(formula = count ~ factor_formula = ~ te(lat, lon, k = 5, by = trend) - 1, n_lv = 3, + # Change default priors for fixed effect betas to standard normal + priors = prior(std_normal(), class = b), + # The data and the grouping variables data = dat, unit = site, diff --git a/man/mvgam_marginaleffects.Rd b/man/mvgam_marginaleffects.Rd index 16e6648e..5564cfdb 100644 --- a/man/mvgam_marginaleffects.Rd +++ b/man/mvgam_marginaleffects.Rd @@ -86,8 +86,6 @@ arguments.} \item \code{newdata = datagrid(cyl = c(4, 6))}: \code{cyl} variable equal to 4 and 6 and other regressors fixed at their means or modes. \item See the Examples section and the \code{\link[marginaleffects:datagrid]{datagrid()}} documentation. } -\item \code{\link[=subset]{subset()}} call with a single argument to select a subset of the dataset used to fit the model, ex: \code{newdata = subset(treatment == 1)} -\item \code{\link[dplyr:filter]{dplyr::filter()}} call with a single argument to select a subset of the dataset used to fit the model, ex: \code{newdata = filter(treatment == 1)} \item string: \itemize{ \item "mean": Marginal Effects at the Mean. Slopes when each predictor is held at its mean or mode. diff --git a/src/RcppExports.gcda b/src/RcppExports.gcda new file mode 100644 index 00000000..45a4db90 Binary files /dev/null and b/src/RcppExports.gcda differ diff --git a/src/trend_funs.gcda b/src/trend_funs.gcda new file mode 100644 index 00000000..886dad8f Binary files /dev/null and b/src/trend_funs.gcda differ diff --git a/tests/testthat/test-jsdgam.R b/tests/testthat/test-jsdgam.R index d22068b8..dc1f25f4 100644 --- a/tests/testthat/test-jsdgam.R +++ b/tests/testthat/test-jsdgam.R @@ -410,6 +410,22 @@ test_that("unit must be a numeric / integer in data", { 'Variable "site" must be either numeric or integer type') }) +test_that("n_lv must be <= number of subgroups", { + expect_error(jsdgam(formula = abundance ~ + # Environmental model includes species-level interecepts + # and random slopes for a linear effect of reflection + s(taxon, bs = 're') + + s(taxon, bs = 're', by = reflection), + # Each factor estimates a different, possibly nonlinear effect of soil.dry + factor_formula = ~ s(soil.dry, k = 5, by = trend) - 1, + data = spiderdat, + unit = site, + subgr = taxon, + n_lv = 15, + family = nb()), + 'Number of factors must be <= number of levels in subgr') +}) + test_that("knots must be a list", { expect_error(jsdgam(formula = abundance ~ # Environmental model includes species-level interecepts @@ -429,7 +445,6 @@ test_that("knots must be a list", { family = nb(), run_model = FALSE), 'all "knot" arguments must be supplied as lists') - }) test_that("errors about knot lengths should be propagated from mgcv", { diff --git a/tests/testthat/test-nmixture.R b/tests/testthat/test-nmixture.R index fc80a80f..085eb552 100644 --- a/tests/testthat/test-nmixture.R +++ b/tests/testthat/test-nmixture.R @@ -194,6 +194,8 @@ test_that("nmix() post-processing works", { silent = 2)) expect_no_error(capture_output(summary(mod))) + expect_no_error(capture_output(plot(mod, type = 'pterms'))) + expect_no_error(capture_output(plot(mod, type = 'pterms', trend_effects = TRUE))) expect_no_error(capture_output(print(mod))) expect_true(inherits(hindcast(mod), 'mvgam_forecast')) expect_true(inherits(hindcast(mod,