I’d like to use the inferences
function to do some bootstrapping for a quantity which requires me to use comparison
and transform
arguments in avg_comparisons
.
However, when I pass the output of avg_comparisons
to inferences
, I’m met with an assertion error. Here is a minimal example
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'
Created on 2024-05-04 with reprex v2.1.0
What are these assertion errors referring to and how can I achieve what I want?