Skip to content

lava::estimate.default: cannot use f and type argument in the same call #22

@benesom

Description

@benesom
library(lava)
n <- 300
d <- data.frame(x = rnorm(n), a = rbinom(n, 1, 0.5), y = rnorm(n))

est <- targeted::cate(y ~ a * x, a ~ 1, data = d)
f <- function(p) p["E[y(1)]"] - p["E[y(0)]"]
e0 <- estimate(est, f = f)
e1 <- estimate(est, f = f, type = "HC3")

e0$coefmat == e1$coefmat # type argument has no effect
e2 <- estimate(est, f = f) |> estimate(type = "HC3")
e0$coefmat == e2$coefmat # works now

@kkholst, we should discuss whether we want to fix this or if we should otherwise simply cast a warning when both f and type are supplied.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions