Description Usage Arguments Details Value See Also Examples
Estimate AMCEs for a conjoint analysis and return a tidy data frame of results
1 2 3 4 5 6 7 8 9 10 11 12 13 |
data |
A data frame containing variables specified in |
formula |
A formula specifying an AMCE model to be estimated. All variables should be factors; all levels across features should be unique. Two-way constraints can be specified with an asterisk (*) between RHS features. The specific constrained level pairs within these features are then detected automatically. Higher-order constraints are not allowed. |
id |
An RHS formula specifying a variable holding respondent identifiers, to be used for clustering standard errors. By default, data are unclustered. |
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). |
... |
For |
variable |
An RHS formula containing a single factor variable from |
amce provides estimates of AMCEs (or rather, average marginal effects for each feature level). Two-way constraints can be specified with an asterisk (*) between features. The specific constrained level pairs within these features are then detected automatically. The function can also be used for calculating average component interaction effects when combined with interaction, and for balance testing by specifying a covariate rather outcome on the left-hand side of formula. See examples.
amce_by_reference provides a tool for quick sensitivity analysis. AMCEs are defined relative to an arbitrary reference category (i.e., feature level). This function will loop over all feature levels (for a specified feature) to show how interpretation will be affected by choice of reference category. The resulting data frame will be a stacked result from amce, containing an additional REFERENCE column specifying which level of variable was used as the reference category. In unconstrained conjoint designs, only AMCEs for variable will vary by reference category; in constrained designs, AMCEs for any factor constrained by variable may also vary.
Users may desire to specify a family argument via ..., which should be a “family” object such as gaussian. Sensible alternatives are binomial (for binary outcomes) and quasibinomial (for weighted survey data). See family for details. In such cases, effects are always reported on the link (not outcome) scale.
A data frame of class “cj_amce”
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 | data("taxes")
# estimating AMCEs
amce(taxes, chose_plan ~ taxrate1 + taxrate2 + taxrate3 +
taxrate4 + taxrate5 + taxrate6 + taxrev, id = ~ ID)
data("immigration")
# estimating AMCEs with constraints
amce(immigration, ChosenImmigrant ~ Gender + ReasonForApplication * CountryOfOrigin,
id = ~CaseID)
# estimating average component interaction effects (AMCEs of feature combinations)
immigration$language_entry <- interaction(immigration$LanguageSkills,
immigration$PriorEntry, sep = "_")
amce(immigration,ChosenImmigrant ~ language_entry, id = ~CaseID)
# balance testing example
plot(amce(immigration[!is.na(immigration$ethnocentrism),],
ethnocentrism ~ Gender + Education + LanguageSkills, id = ~ CaseID))
# reference category sensitivity
x <- amce_by_reference(immigration, ChosenImmigrant ~ LanguageSkills + Education,
variable = ~ LanguageSkills, id = ~ CaseID)
# plot
plot(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.