amce {cjoint} | R Documentation |
Estimating Causal Effects in Conjoint Experiments
Description
This function takes a dataset and a conjoint design and returns Average Marginal Component Effects (AMCEs) and Average Component Interaction Effects (ACIE) for the attributes specified in the formula. By default, this function assumes uniform randomization of attribute levels and no profile restrictions. If your design incorporates weighted randomization or restrictions on displayable profiles, first generate a design object using makeDesign
. Interactions with respondent-level characteristics are handled by identifying relevant variables as respondent-varying.
Usage
amce(formula, data, design = "uniform",
respondent.varying = NULL, subset = NULL,
respondent.id = NULL, cluster = TRUE, na.ignore=FALSE,
weights = NULL, baselines = NULL)
Arguments
formula |
A |
data |
A dataframe containing the outcome variable, attributes, respondent identifiers, respondent covariate data and sampling weights from a conjoint experiment. |
design |
Either the character string |
respondent.varying |
A vector of character strings giving the names of any respondent-varying characteristics being interacted with AMCEs or ACIEs in the |
subset |
A logical vector with length |
respondent.id |
A character string indicating the column of |
cluster |
A logical indicating whether estimated standard errors should be clustered on |
na.ignore |
A logical indicating whether the function should ignore missing rows in |
weights |
A character string giving the name of the column in the data containing any survey weights. See documentation for |
baselines |
Manually adjust the baselines of select factor variables (either attributes or respondent varying) by supplying a list. Names of list entries should correspond with variable names. The content of each entry should be a character string giving the new baseline. |
Value
An object of class "amce" containing:
attributes |
A list containing the names of attributes. |
baselines |
Baseline levels for each attribute in |
continuous |
List of quantiles for any non-factor variables, whether attributes or respondent varying. |
data |
The original data. |
estimates |
A list containing AMCE and ACIE estimates for each attribute in |
formula |
The |
samplesize_prof |
The number of valid profiles (rows) in the dataset |
user.names |
A vector with the original user supplied names for any attributes. These may differ from the attribute names in |
vcov.prof |
The modified variance-covariance matrix for AMCE and ACIE estimates. Incorporates cluster corrections as well as attribute dependencies. Profile varying attributes only. |
numrespondents |
The number of respondents in the dataset (if |
respondent.varying |
Names of respondent-varying variables, if any. |
cond.formula |
The formula used for calculating estimates conditional on respondent varying characteristics. Only returned when respondent-varying characteristics are present. |
cond.estimates |
A list containing estimated effects of respondent-varying characteristics conditional on attribute values. Each element of |
samplesize_full |
The number of valid profiles (rows) in the dataset when respondent varying characteristics are included. Only returned when respondent-varying characteristics are present. |
vcov.resp |
The modified variance-covariance matrix for effect estimates conditional on respondent-varying characteristics, where dependent relationships have been incorporated into variances and covariances. Only returned when respondent-varying characteristics are present. |
References
Hainmueller, J., Hopkins, D., and Yamamoto T. (2014) Causal Inference in Conjoint Analysis: Understanding Multi-Dimensional Choices via Stated Preference Experiments. Political Analysis 22(1):1-30
See Also
summary.amce
for summaries and plot.amce
for generating a coefficient plot using ggplot2
.
makeDesign
to create conjointDesign
objects.
Examples
## Not run:
# Immigration Choice Conjoint Experiment Data from Hainmueller et. al. (2014).
data("immigrationconjoint")
data("immigrationdesign")
# Run AMCE estimator using all attributes in the design
results <- amce(Chosen_Immigrant ~ Gender + Education + `Language Skills` +
`Country of Origin` + Job + `Job Experience` + `Job Plans` +
`Reason for Application` + `Prior Entry`, data=immigrationconjoint,
cluster=TRUE, respondent.id="CaseID", design=immigrationdesign)
# Print summary
summary(results)
# Run AMCE estimator using all attributes in the design with interactions
interaction_results <- amce(Chosen_Immigrant ~ Gender + Education + `Language Skills` +
`Country of Origin` + Job + `Job Experience` + `Job Plans` +
`Reason for Application` + `Prior Entry` + Education:`Language Skills` +
Job: `Job Experience` + `Job Plans`:`Reason for Application`,
data=immigrationconjoint, cluster=TRUE, respondent.id="CaseID",
design=immigrationdesign)
# Print summary
summary(interaction_results)
# create weights in data
weights <- runif(nrow(immigrationconjoint))
immigrationconjoint$weights <- weights
# Run AMCE estimator using weights
results <- amce(Chosen_Immigrant ~ Gender + Education + `Language Skills` +
`Country of Origin` + Job + `Job Experience` + `Job Plans` +
`Reason for Application` + `Prior Entry`, data=immigrationconjoint,
cluster=TRUE, respondent.id="CaseID", design=immigrationdesign,
weights = "weights")
# Print summary
summary(results)
# Include a respondent-varying interaction
results <- amce(Chosen_Immigrant ~ Gender + Education + Job +
ethnocentrism:Job + Education:Job,
data=immigrationconjoint, na.ignore = TRUE,
cluster=FALSE,design=immigrationdesign,
respondent.varying = "ethnocentrism")
# Print summary
summary(results)
# Change the baseline for "Education"
baselines <- list()
baselines$Education <- "graduate degree"
results <- amce(Chosen_Immigrant ~ Gender + Education + Job +
Education:Job, data=immigrationconjoint,
cluster=FALSE,design=immigrationdesign,
baselines=baselines)
# Print summary
summary(results)
## End(Not run)