(EXPERIMENTAL) Complex aggregation and test functions for the hypothesis
argument
Description
Warning: This function is experimental. It may be renamed, the user interface may change, or the functionality may migrate to arguments in other marginaleffects
functions.
This function creates aggregation and test functions for use with the hypothesis
argument in marginaleffects
functions like predictions()
, slopes()
, and comparisons()
. The benefit of this function is that it handles a lot of the "boilerplate" code such as label creation and transformations by subgroups.
Usage
specify_hypothesis(
hypothesis = "reference",
label = NULL,
label_columns = NULL,
by = c("term", "group", "contrast")
)
Arguments
hypothesis
|
String or Function. Compute a test statistic.
|
label
|
Function. Accepts a vector of row labels and combines them to create hypothesis labels. |
label_columns
|
Character vector. Column names to use for hypothesis labels. Default is c(“group”, “term”, “rowid”, attr(x, “variables_datagrid”), attr(x, “by”)) .
|
by
|
Character vector. Variable names which indicate subgroups in which the hypothesis function should be applied.
|
Value
specify_hypothesis()
is a "function factory", which means that executing it will return a function suitable for use in the hypothesis
argument of a marginaleffects
function.