Skip to content

Arguments to targeted::design are not passed on to fitfun when using ml_model$estimate #49

@benesom

Description

@benesom

All tests pass for

  # specials are correctly handled for estimating method with x, y arguments
  m4 <- ml_model$new(formula = y ~ x + offset(log(w)), estimate = glm.fit,
    intercept = TRUE, specials = "offset", family = poisson())
  m4$estimate(ddata_count)
  fit <- glm(y ~ x + offset(log(w)), data = ddata_count, family = poisson())
  expect_equal(coef(fit), coef(m4$fit))

  # it is currently not possible for the estimate method call to pass arguments
  # to targeted::design inside the fitfun
  m4 <- ml_model$new(formula = y ~ x + offset(log(w)), estimate = glm.fit,
    intercept = TRUE, family = poisson())
  m4$estimate(ddata_count, specials = c("offset"))
  expect_true(all(coef(fit) != coef(m4$fit)))

The specials argument is not passed on to targeted::design because of

          private$fitfun <- function(data, ...) {
            xx <- do.call(
              targeted::design,
              c(list(formula = self$formula, data = data), private$des.args)
            )
            args <- private$update_args(self$args, ...)
            args <- c(list(xx$x), args)

Is this something we would like to fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions