我想使用
inferences
函数对某个数量进行一些引导,这需要我在 comparison
中使用 transform
和 avg_comparisons
参数。
但是,当我将
avg_comparisons
的输出传递给 inferences
时,我遇到了断言错误。这是一个最小的例子
library(tidyverse)
library(marginaleffects)
set.seed(0)
n <- 500
trt <- rep(0:1, each=500)
x <- rnorm(n)
y <- 2*x + 1 + 0.5*trt + rnorm(n, 0, 0.3)
d <- data.frame(x, trt, y)
fit <- lm(y~trt + x, data=d)
avg_comparisons(
fit,
variables = 'trt',
comparison = 'lnratioavg',
transform = 'exp'
) %>%
inferences(method='boot')
#> Error: Assertion failed. One of the following must apply:
#> * checkmate::check_choice(x): Must be element of set {'exp','ln'}, but
#> * is not atomic scalar
#> * checkmate::check_function(x): Must be a function, not 'list'
创建于 2024-05-04,使用 reprex v2.1.0
这些断言错误指的是什么?我怎样才能实现我想要的?
这是一个错误。它应该在 Github 上的 0.19.0.8 版本中修复。
参见:https://github.com/vincentarelbundock/marginaleffects/issues/1115