Description Usage Arguments Details Value Author(s) See Also Examples
Tests for preference heterogeneity in conjoint experiments
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | amce_diffs(
data,
formula,
by,
id = ~0,
weights = NULL,
feature_order = NULL,
feature_labels = NULL,
level_order = c("ascending", "descending"),
alpha = 0.05,
...
)
cj_anova(data, formula, id = NULL, weights = NULL, by = NULL, ...)
mm_diffs(
data,
formula,
by,
id = ~0,
weights = NULL,
feature_order = NULL,
feature_labels = NULL,
level_order = c("ascending", "descending"),
alpha = 0.05,
h0 = 0,
...
)
|
data |
A data frame containing variables specified in |
formula |
A formula specifying a model to be estimated. All variables should be factors; all levels across features should be unique. |
by |
A formula containing only RHS variables, specifying grouping factors over which to perform estimation. For |
id |
Ignored. |
weights |
An (optional) RHS formula specifying a variable holding survey weights. |
feature_order |
An (optional) character vector specifying the names of feature (RHS) variables in the order they should be encoded in the resulting data frame. |
feature_labels |
A named list of “fancy” feature labels to be used in output. By default, the function looks for a “label” attribute on each variable in |
level_order |
A character string specifying levels (within each feature) should be ordered increasing or decreasing in the final output. This is mostly only consequential for plotting via |
alpha |
A numeric value indicating the significance level at which to calculate confidence intervals for the MMs (by default 0.95, meaning 95-percent CIs are returned). |
... |
Additional arguments to |
h0 |
A numeric value specifying a null hypothesis value to use when generating z-statistics and p-values (only used for |
cj_anova
takes a model formula (“reduced” model) and generates a “full” model with two-way interactions between the variables specified in by
and all RHS variables in formula
, then computes an F-test comparing the two models, providing a test for whether preferences vary across levels of by
. This is, in essence, a test of whether all such interaction coefficients are distinguishable from zero. (Because the test depends on overall model fit, not the coefficient variances, clustering is irrelevant.)
mm_diffs
provides a data frame of differences in marginal means (literally differencing the results from mm
across levels of by
. This provides the clearest direct measure of preference differences from a conjoint design.
amce_diffs
provides a data frame of differences in AMCEs (the coefficient on an interaction between each RHS factor and the variable in by
). This provides an estimate of the difference in causal effects of each factor level relative to the baseline level (i.e., the difference in conditional AMCEs). This quantity is easily misinterpreted as the difference in preferences, which it is not. Rather it is a difference in the effect of the factor on preferences relative to the baseline/reference category of that feature. If preferences in the reference category differ across levels of by
, the the difference in conditional AMCEs will have an unpredictable sign and significance, making differences in marginal means a more sensible quantity of interest. See amce_by_reference
for a diagnostic.
Note: amce_diffs
does not work with constrained designs. To obtain such differences, subset the design by constraints and calculate differences within each subset.
amce_diffs
and mm_diffs
return a data frame similar to the one returned by cj
, including a BY
column (with the value “Difference”) for easy merging with results returned by that function.
cj_anova
returns an anova
object.
Thomas J. Leeper <thosjleeper@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | data("immigration")
immigration$contest_no <- factor(immigration$contest_no)
# Test for heterogeneity by profile order
cj_anova(immigration, ChosenImmigrant ~ Gender + Education + LanguageSkills, by = ~ contest_no)
# Test for heterogeneity by CountryOfOrigin feature
cj_anova(immigration, ChosenImmigrant ~ Gender + Education, by = ~ CountryOfOrigin)
# Differences in MMs by Gender feature
mm_diffs(immigration, ChosenImmigrant ~ LanguageSkills + Education, ~ Gender, id = ~ CaseID)
# Differences in AMCEs by Gender feature (i.e., feature interactions)
amce_diffs(immigration, ChosenImmigrant ~ LanguageSkills + Education, ~ Gender, id = ~ CaseID)
# preferences differ for Male and Female immigrants with 'Broken English' ability
(m1 <- mm_diffs(immigration, ChosenImmigrant ~ LanguageSkills, ~ Gender, id = ~ CaseID))
# yet differences in conditional AMCEs depend on the reference category
amce_diffs(immigration, ChosenImmigrant ~ LanguageSkills, ~ Gender, id = ~ CaseID)
immigration$LanguageSkills2 <- relevel(immigration$LanguageSkills, "Used Interpreter")
amce_diffs(immigration, ChosenImmigrant ~ LanguageSkills2, ~ Gender, id = ~ CaseID)
# while differences in MMs do not depend on the reference cateory
(m2 <- mm_diffs(immigration, ChosenImmigrant ~ LanguageSkills2, ~ Gender, id = ~ CaseID))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.