diff_AME {FactorHet}R Documentation

Difference between AMEs in each group

Description

Computes the differences between AME between two groups with an accompanying standard error.

Usage

diff_AME(object, AME, baseline_group, plot = TRUE)

Arguments

object

An object from FactorHet or FactorHet_mbo.

AME

An object containing the average marginal effects estimated using AME.

baseline_group

An integer that denotes the baseline group. The function will show the difference in AMEs from this group, i.e. Group k - Group baseline_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 TRUE.

Value

Returns a named list with the underlying data ("data") and the plot ("plot").

Examples

  # 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)
  

[Package FactorHet version 1.0.0 Index]