tests/testthat/_snaps/assume.md

assume errors with bad arguments

Code
  gss %>% specify(age ~ college) %>% hypothesize(null = "independence") %>%
    assume("boop", nrow(gss) - 1)
Condition
  Error in `assume()`:
  ! The distribution argument must be one of "Chisq", "F", "t", or "z".
Code
  gss %>% specify(age ~ college) %>% hypothesize(null = "independence") %>%
    assume("t", c(nrow(gss) - 1, 2))
Condition
  Error in `assume()`:
  ! A T distribution requires 1 degrees of freedom argument, but 2 were supplied.
Code
  gss %>% specify(age ~ partyid) %>% hypothesize(null = "independence") %>%
    assume("F", nrow(gss) - 1)
Message
  Dropping unused factor levels DK from the supplied explanatory variable 'partyid'.
Condition
  Error in `assume()`:
  ! An F distribution requires 2 degrees of freedom arguments, but 1 was supplied.
Code
  gss %>% specify(age ~ partyid) %>% hypothesize(null = "independence") %>%
    assume("F", "boop")
Message
  Dropping unused factor levels DK from the supplied explanatory variable 'partyid'.
Condition
  Error in `assume()`:
  ! `assume()` expects the `df` argument to be a numeric vector, but you supplied a character object.
Code
  gss %>% specify(age ~ partyid) %>% hypothesize(null = "independence") %>%
    assume("F", nrow(gss) - 1, 1)
Message
  Dropping unused factor levels DK from the supplied explanatory variable 'partyid'.
Condition
  Error in `assume()`:
  ! `assume()` ignores the dots `...` argument, though the argument `list(1)` was supplied. Did you forget to concatenate the `df` argument with `c()`?
Code
  gss %>% specify(age ~ partyid) %>% hypothesize(null = "independence") %>%
    assume("F", nrow(gss) - 1, 1, 2)
Message
  Dropping unused factor levels DK from the supplied explanatory variable 'partyid'.
Condition
  Error in `assume()`:
  ! `assume()` ignores the dots `...` argument, though the arguments `list(1, 2)` were supplied. Did you forget to concatenate the `df` argument with `c()`?
Code
  gss %>% specify(age ~ finrela) %>% hypothesize(null = "independence") %>%
    assume("t", nrow(gss) - 1)
Condition
  Error in `assume()`:
  ! The supplied distribution "t" is not well-defined for a numeric response variable (age) and a multinomial categorical explanatory variable (finrela).
Code
  gss %>% specify(age ~ finrela) %>% hypothesize(null = "independence") %>%
    assume("z", nrow(gss) - 1)
Condition
  Error in `assume()`:
  ! The supplied distribution "z" is not well-defined for a numeric response variable (age) and a multinomial categorical explanatory variable (finrela).
Code
  gss %>% specify(age ~ NULL) %>% hypothesize(null = "point", mu = 40) %>% assume(
    "z", nrow(gss) - 1)
Condition
  Error in `assume()`:
  ! The supplied distribution "z" is not well-defined for a numeric response variable (age) and no explanatory variable.
Code
  gss %>% assume("z", nrow(gss) - 1)
Condition
  Error in `assume()`:
  ! The `x` argument must be the output of a core infer function, likely `specify()` or `hypothesize()`.
Code
  "boop" %>% assume("z", nrow(gss) - 1)
Condition
  Error in `assume()`:
  ! The `x` argument must be the output of a core infer function, likely `specify()` or `hypothesize()`.

assume() handles automatic df gracefully

Code
  res_ <- gss %>% specify(response = hours) %>% hypothesize(null = "point", mu = 40) %>%
    assume("t", nrow(gss) - 2)
Message
  Message: The supplied `df` argument does not match its expected value. If this is unexpected, ensure that your calculation for `df` is correct (see `?assume` for recognized values) or supply `df = NULL` to `assume()`.


Try the infer package in your browser

Any scripts or data that you put into this service are public.

infer documentation built on Sept. 8, 2023, 6:22 p.m.