- using R Under development (unstable) (2025-12-20 r89211)
- using platform: x86_64-pc-linux-gnu
- R was compiled by
clang version 21.1.8
flang version 21.1.8
- running under: Fedora Linux 42 (Workstation Edition)
- using session charset: UTF-8
- using option ‘--no-stop-on-test-error’
- checking for file ‘modelbased/DESCRIPTION’ ... OK
- checking extension type ... Package
- this is package ‘modelbased’ version ‘0.13.1’
- package encoding: UTF-8
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking whether package ‘modelbased’ can be installed ... [16s/45s] OK
See the install log for details.
- checking installed package size ... OK
- checking package directory ... OK
- checking ‘build’ directory ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking code files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... OK
- checking whether the package can be loaded with stated dependencies ... OK
- checking whether the package can be unloaded cleanly ... OK
- checking whether the namespace can be loaded with stated dependencies ... OK
- checking whether the namespace can be unloaded cleanly ... OK
- checking loading without being on the library search path ... OK
- checking whether startup messages can be suppressed ... OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [41s/104s] OK
- checking Rd files ... OK
- checking Rd metadata ... OK
- checking Rd line widths ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking contents of ‘data’ directory ... OK
- checking data for non-ASCII characters ... OK
- checking LazyData ... OK
- checking data for ASCII and uncompressed saves ... OK
- checking installed files from ‘inst/doc’ ... OK
- checking files in ‘vignettes’ ... OK
- checking examples ... [31s/101s] ERROR
Running examples in ‘modelbased-Ex.R’ failed
The error most likely occurred in:
> ### Name: estimate_slopes
> ### Title: Estimate Marginal Effects
> ### Aliases: estimate_slopes
>
> ### ** Examples
>
> ## Don't show:
> if (all(insight::check_if_installed(c("marginaleffects", "emmeans", "effectsize", "mgcv", "ggplot2", "see"), quietly = TRUE))) withAutoprint({ # examplesIf
+ ## End(Don't show)
+ library(ggplot2)
+ # Get an idea of the data
+ ggplot(iris, aes(x = Petal.Length, y = Sepal.Width)) +
+ geom_point(aes(color = Species)) +
+ geom_smooth(color = "black", se = FALSE) +
+ geom_smooth(aes(color = Species), linetype = "dotted", se = FALSE) +
+ geom_smooth(aes(color = Species), method = "lm", se = FALSE)
+
+ # Model it
+ model <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)
+ # Compute the marginal effect of Petal.Length at each level of Species
+ slopes <- estimate_slopes(model, trend = "Petal.Length", by = "Species")
+ slopes
+
+ # What is the *average* slope of Petal.Length? This can be calculated by
+ # taking the average of the slopes across all Species, using `comparison`.
+ # We pass a function to `comparison` that calculates the mean of the slopes.
+ estimate_slopes(
+ model,
+ trend = "Petal.Length",
+ by = "Species",
+ comparison = ~I(mean(x))
+ )
+
+ ## Not run:
+ ##D # Plot it
+ ##D plot(slopes)
+ ##D standardize(slopes)
+ ##D
+ ##D model <- mgcv::gam(Sepal.Width ~ s(Petal.Length), data = iris)
+ ##D slopes <- estimate_slopes(model, by = "Petal.Length", length = 50)
+ ##D summary(slopes)
+ ##D plot(slopes)
+ ##D
+ ##D model <- mgcv::gam(Sepal.Width ~ s(Petal.Length, by = Species), data = iris)
+ ##D slopes <- estimate_slopes(model,
+ ##D trend = "Petal.Length",
+ ##D by = c("Petal.Length", "Species"), length = 20
+ ##D )
+ ##D summary(slopes)
+ ##D plot(slopes)
+ ##D
+ ##D # marginal effects, grouped by Species, at different values of Petal.Length
+ ##D estimate_slopes(model,
+ ##D trend = "Petal.Length",
+ ##D by = c("Petal.Length", "Species"), length = 10
+ ##D )
+ ##D
+ ##D # marginal effects at different values of Petal.Length
+ ##D estimate_slopes(model, trend = "Petal.Length", by = "Petal.Length", length = 10)
+ ##D
+ ##D # marginal effects at very specific values of Petal.Length
+ ##D estimate_slopes(model, trend = "Petal.Length", by = "Petal.Length=c(1, 3, 5)")
+ ##D
+ ##D # average marginal effects of Petal.Length,
+ ##D # just for the trend within a certain range
+ ##D estimate_slopes(model, trend = "Petal.Length=seq(2, 4, 0.01)")
+ ## End(Not run)
+ ## Don't show:
+ }) # examplesIf
> library(ggplot2)
> ggplot(iris, aes(x = Petal.Length, y = Sepal.Width)) + geom_point(aes(color = Species)) +
+ geom_smooth(color = "black", se = FALSE) + geom_smooth(aes(color = Species),
+ linetype = "dotted", se = FALSE) + geom_smooth(aes(color = Species), method = "lm",
+ se = FALSE)
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'
> model <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)
> slopes <- estimate_slopes(model, trend = "Petal.Length", by = "Species")
Error in `[.data.table`(out, , `:=`(tmp_idx, seq_len(.N)), by = tmp) :
attempt access index 10/10 in VECTOR_ELT
Calls: withAutoprint ... eval -> eval -> estimate_slopes -> get_marginaltrends
Execution halted
- checking for unstated dependencies in ‘tests’ ... OK
- checking tests ... [105s/183s] ERROR
Running ‘testthat.R’ [105s/181s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> #
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
> library(testthat)
> library(modelbased)
>
> test_check("modelbased")
Starting 2 test processes.
Saving _problems/test-attributes_estimatefun-108.R
Saving _problems/test-estimate_slopes-10.R
Saving _problems/test-estimate_slopes-63.R
Saving _problems/test-estimate_slopes-124.R
> test-multivariate_response.R: Confidence intervals are not yet supported for models of class `mlm`.
> test-multivariate_response.R: Confidence intervals are not yet supported for models of class `mlm`.
Saving _problems/test-transform_response-65.R
Saving _problems/test-visualisation_recipe-151.R
[ FAIL 6 | WARN 0 | SKIP 54 | PASS 194 ]
══ Skipped tests (54) ══════════════════════════════════════════════════════════
• .Platform$OS.type == "windows" is not TRUE (1):
'test-estimate_predicted.R:58:3'
• On CRAN (45): 'test-backtransform_invlink.R:1:1', 'test-betareg.R:1:1',
'test-bias_correction.R:1:1', 'test-brms-marginaleffects.R:1:1',
'test-brms.R:1:1', 'test-equivalence.R:1:1',
'test-estimate_contrasts-average.R:1:1', 'test-estimate_contrasts.R:1:1',
'test-estimate_contrasts_bookexamples.R:1:1',
'test-estimate_contrasts_counterfactual.R:1:1',
'test-estimate_contrasts_effectsize.R:1:1',
'test-estimate_contrasts_inequality.R:1:1',
'test-estimate_contrasts_methods.R:1:1', 'test-estimate_filter.R:1:1',
'test-estimate_means-average.R:1:1', 'test-estimate_means.R:1:1',
'test-estimate_means_ci.R:1:1', 'test-estimate_means_counterfactuals.R:1:1',
'test-estimate_grouplevel.R:54:3', 'test-estimate_grouplevel.R:72:3',
'test-estimate_grouplevel.R:93:3', 'test-estimate_grouplevel.R:123:3',
'test-estimate_grouplevel.R:150:5', 'test-estimate_grouplevel.R:182:3',
'test-estimate_grouplevel.R:261:3', 'test-estimate_grouplevel.R:308:3',
'test-estimate_means_dotargs.R:1:1', 'test-estimate_means_mixed.R:1:1',
'test-estimate_means_marginalization.R:1:1', 'test-estimate_slopes.R:129:1',
'test-g_computation.R:1:1', 'test-get_marginaltrends.R:1:1',
'test-glmmTMB.R:1:1', 'test-joint_test.R:1:1', 'test-keep_iterations.R:1:1',
'test-maihda.R:1:1', 'test-mice.R:1:1', 'test-ordinal.R:1:1',
'test-plot-grouplevel.R:1:1', 'test-predict-dpar.R:1:1',
'test-standardize.R:1:1', 'test-summary_estimate_slopes.R:3:1',
'test-transform_response.R:3:1', 'test-vcov.R:1:1', 'test-zeroinfl.R:1:1'
• On Linux (8): 'test-plot-facet.R:1:1', 'test-plot-flexible_numeric.R:1:1',
'test-plot-ordinal.R:1:1', 'test-plot-slopes.R:1:1', 'test-plot.R:1:1',
'test-print.R:1:1', 'test-residualize_over_grid.R:1:1',
'test-scoping_issues.R:1:1'
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-attributes_estimatefun.R:108:3'): attributes_means, slopes ─────
Error in ``[.data.table`(out, , `:=`(tmp_idx, seq_len(.N)), by = tmp)`: attempt access index 13/13 in VECTOR_ELT
Backtrace:
▆
1. ├─base::suppressMessages(...) at test-attributes_estimatefun.R:108:3
2. │ └─base::withCallingHandlers(...)
3. └─modelbased::estimate_slopes(model, "Sepal.Width", backend = "marginaleffects")
4. └─modelbased::get_marginaltrends(...)
5. ├─base::suppressWarnings(do.call(marginaleffects::avg_slopes, fun_args))
6. │ └─base::withCallingHandlers(...)
7. ├─base::do.call(marginaleffects::avg_slopes, fun_args)
8. ├─marginaleffects (local) `<fn>`(...)
9. │ └─base::eval.parent(call_attr)
10. │ └─base::eval(expr, p)
11. │ └─base::eval(expr, p)
12. ├─marginaleffects::slopes(...)
13. │ └─base::eval.parent(call_attr_c)
14. │ └─base::eval(expr, p)
15. │ └─base::eval(expr, p)
16. └─marginaleffects::comparisons(...)
17. ├─base::do.call("get_comparisons", args)
18. └─marginaleffects:::get_comparisons(...)
19. ├─out[, `:=`(tmp_idx, seq_len(.N)), by = tmp]
20. └─data.table:::`[.data.table`(...)
── Error ('test-estimate_slopes.R:10:3'): estimate_slopes ──────────────────────
Error in ``[.data.table`(out, , `:=`(tmp_idx, seq_len(.N)), by = tmp)`: attempt access index 13/13 in VECTOR_ELT
Backtrace:
▆
1. ├─base::suppressMessages(estimate_slopes(model, backend = "marginaleffects")) at test-estimate_slopes.R:10:3
2. │ └─base::withCallingHandlers(...)
3. └─modelbased::estimate_slopes(model, backend = "marginaleffects")
4. └─modelbased::get_marginaltrends(...)
5. ├─base::suppressWarnings(do.call(marginaleffects::avg_slopes, fun_args))
6. │ └─base::withCallingHandlers(...)
7. ├─base::do.call(marginaleffects::avg_slopes, fun_args)
8. ├─marginaleffects (local) `<fn>`(...)
9. │ └─base::eval.parent(call_attr)
10. │ └─base::eval(expr, p)
11. │ └─base::eval(expr, p)
12. ├─marginaleffects::slopes(...)
13. │ └─base::eval.parent(call_attr_c)
14. │ └─base::eval(expr, p)
15. │ └─base::eval(expr, p)
16. └─marginaleffects::comparisons(...)
17. ├─base::do.call("get_comparisons", args)
18. └─marginaleffects:::get_comparisons(...)
19. ├─out[, `:=`(tmp_idx, seq_len(.N)), by = tmp]
20. └─data.table:::`[.data.table`(...)
── Error ('test-estimate_slopes.R:63:3'): estimate_slopes, johnson-neyman p-adjust ──
Error in ``[.data.table`(out, , `:=`(tmp_idx, seq_len(.N)), by = tmp)`: attempt access index 10/10 in VECTOR_ELT
Backtrace:
▆
1. └─modelbased::estimate_slopes(model, "Petal.Width", by = "Petal.Length") at test-estimate_slopes.R:63:3
2. └─modelbased::get_marginaltrends(...)
3. ├─base::suppressWarnings(do.call(marginaleffects::avg_slopes, fun_args))
4. │ └─base::withCallingHandlers(...)
5. ├─base::do.call(marginaleffects::avg_slopes, fun_args)
6. ├─marginaleffects (local) `<fn>`(...)
7. │ └─base::eval.parent(call_attr)
8. │ └─base::eval(expr, p)
9. │ └─base::eval(expr, p)
10. ├─marginaleffects::slopes(...)
11. │ └─base::eval.parent(call_attr_c)
12. │ └─base::eval(expr, p)
13. │ └─base::eval(expr, p)
14. └─marginaleffects::comparisons(...)
15. ├─base::do.call("get_comparisons", args)
16. └─marginaleffects:::get_comparisons(...)
17. ├─out[, `:=`(tmp_idx, seq_len(.N)), by = tmp]
18. └─data.table:::`[.data.table`(...)
── Error ('test-estimate_slopes.R:124:3'): estimate_slopes, custom comparison ──
Error in ``[.data.table`(out, , `:=`(tmp_idx, seq_len(.N)), by = tmp)`: attempt access index 10/10 in VECTOR_ELT
Backtrace:
▆
1. ├─modelbased::estimate_contrasts(...) at test-estimate_slopes.R:124:3
2. └─modelbased:::estimate_contrasts.default(...)
3. └─modelbased::get_marginalcontrasts(...)
4. └─modelbased::estimate_slopes(...)
5. └─modelbased::get_marginaltrends(...)
6. ├─base::suppressWarnings(do.call(marginaleffects::avg_slopes, fun_args))
7. │ └─base::withCallingHandlers(...)
8. ├─base::do.call(marginaleffects::avg_slopes, fun_args)
9. ├─marginaleffects (local) `<fn>`(...)
10. │ └─base::eval.parent(call_attr)
11. │ └─base::eval(expr, p)
12. │ └─base::eval(expr, p)
13. ├─marginaleffects::slopes(...)
14. │ └─base::eval.parent(call_attr_c)
15. │ └─base::eval(expr, p)
16. │ └─base::eval(expr, p)
17. └─marginaleffects::comparisons(...)
18. ├─base::do.call("get_comparisons", args)
19. └─marginaleffects:::get_comparisons(...)
20. ├─out[, `:=`(tmp_idx, seq_len(.N)), by = tmp]
21. └─data.table:::`[.data.table`(...)
── Error ('test-transform_response.R:65:3'): estimate_slopes, transform ────────
Error in ``[.data.table`(out, , `:=`(tmp_idx, seq_len(.N)), by = tmp)`: attempt access index 10/10 in VECTOR_ELT
Backtrace:
▆
1. └─modelbased::estimate_slopes(mod, trend = "Sepal.Width", by = "Species") at test-transform_response.R:65:3
2. └─modelbased::get_marginaltrends(...)
3. ├─base::suppressWarnings(do.call(marginaleffects::avg_slopes, fun_args))
4. │ └─base::withCallingHandlers(...)
5. ├─base::do.call(marginaleffects::avg_slopes, fun_args)
6. ├─marginaleffects (local) `<fn>`(...)
7. │ └─base::eval.parent(call_attr)
8. │ └─base::eval(expr, p)
9. │ └─base::eval(expr, p)
10. ├─marginaleffects::slopes(...)
11. │ └─base::eval.parent(call_attr_c)
12. │ └─base::eval(expr, p)
13. │ └─base::eval(expr, p)
14. └─marginaleffects::comparisons(...)
15. ├─base::do.call("get_comparisons", args)
16. └─marginaleffects:::get_comparisons(...)
17. ├─out[, `:=`(tmp_idx, seq_len(.N)), by = tmp]
18. └─data.table:::`[.data.table`(...)
── Error ('test-visualisation_recipe.R:151:3'): visualization_recipe ───────────
Error in ``[.data.table`(out, , `:=`(tmp_idx, seq_len(.N)), by = tmp)`: attempt access index 15/15 in VECTOR_ELT
Backtrace:
▆
1. └─modelbased::estimate_slopes(model, trend = "Sepal.Width") at test-visualisation_recipe.R:151:3
2. └─modelbased::get_marginaltrends(...)
3. ├─base::suppressWarnings(do.call(marginaleffects::avg_slopes, fun_args))
4. │ └─base::withCallingHandlers(...)
5. ├─base::do.call(marginaleffects::avg_slopes, fun_args)
6. ├─marginaleffects (local) `<fn>`(...)
7. │ └─base::eval.parent(call_attr)
8. │ └─base::eval(expr, p)
9. │ └─base::eval(expr, p)
10. ├─marginaleffects::slopes(...)
11. │ └─base::eval.parent(call_attr_c)
12. │ └─base::eval(expr, p)
13. │ └─base::eval(expr, p)
14. └─marginaleffects::comparisons(...)
15. ├─base::do.call("get_comparisons", args)
16. └─marginaleffects:::get_comparisons(...)
17. ├─out[, `:=`(tmp_idx, seq_len(.N)), by = tmp]
18. └─data.table:::`[.data.table`(...)
[ FAIL 6 | WARN 0 | SKIP 54 | PASS 194 ]
Error:
! Test failures.
Execution halted
- checking for unstated dependencies in vignettes ... OK
- checking package vignettes ... OK
- checking re-building of vignette outputs ... OK
- checking PDF version of manual ... [11s/25s] OK
- checking HTML version of manual ... [11s/34s] OK
- checking for non-standard things in the check directory ... OK
- checking for detritus in the temp directory ... OK
- DONE
Status: 2 ERRORs