View source: R/postregression_functions.R
diff_AME | R Documentation |
Computes the differences between AME between two groups with an accompanying standard error.
diff_AME(object, AME, baseline_group, plot = TRUE)
object |
An object from |
AME |
An object containing the average marginal effects estimated using
|
baseline_group |
An integer that denotes the baseline group. The
function will show the difference in AMEs from this group, i.e. Group
|
plot |
A logical value as to whether the function should print the plot
immediately or quietly provide an object containing the plot and data. The
default is |
Returns a named list with the underlying data ("data"
) and the
plot ("plot"
).
# Fit with two groups and fixed lambda for quick illustration
data(immigration)
set.seed(15)
fit <- FactorHet(formula = Chosen_Immigrant ~ Country + Ed,
design = immigration, group = ~ CaseID, task = ~ contest_no,
choice_order = ~ choice_id, lambda = 1e-2,
control = FactorHet_control(init_method = 'random_member'),
K = 2)
fit_AME <- AME(fit)
diff_AME(fit, fit_AME, baseline_group = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.