anniejw6/modmarg

write any test involving continuous_wrap

anniejw6 opened this issue · 4 comments

write any test involving continuous_wrap

@nathanielolin : trying to get this to work (in stata)

#' data(mtcars)
#' mtcars$gear <- factor(mtcars$gear)
#' mm <- glm(vs ~ gear + mpg * disp, mtcars, family = 'binomial')
#' # apply at transformations
#' df <- at_transforms(mm$model, list("mpg" = c(15, 21)))
#' df <- df[[1]]
#' continuous_wrap(df, var_interest = 'gear', model = mm, vcov_mat = vcov(mm))

this does not work:

z <- aiEstimation::mod_marg(
  model = 'logit vs c.mpg##c.disp i.gear',
  margs = list(levels = 'margins c.mpg, at(disp = (70(5)475) mpg = (15 21))'),
  df = mtcars)

Nevermind, @nathanielolin --- what I should actually be testing is

z <- aiEstimation::mod_marg(
  model = 'logit vs c.mpg##c.disp i.gear',
  margs = list(levels = 'margins c.mpg, at(mpg = (15 21))'),
  df = mtcars)

and

#' data(mtcars)
#' mtcars$gear <- factor(mtcars$gear)
#' mm <- glm(vs ~ gear + mpg * disp, mtcars, family = 'binomial')
#' continuous_wrap(mm$model, var_interest = 'mpg',
#'                 at_var_interest = c(15, 21), model = mm,
#'                 vcov_mat = vcov(mm))

This works now, writing tests.

See #45

Test passes :)