Learn R Programming

cjoint (version 2.0.3)

amce: 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 formula object specifying the name of the outcome variable on the left-hand side and the attributes for which effects are to be estimated on the right-hand side. RHS attributes should be separated by + signs. Interaction effect
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 "uniform" or a conjointDesign object created by the makeDesign function. If a conjointDesign is not passed, the function will assume all
respondent.varying
A vector of character strings giving the names of any respondent-varying characteristics being interacted with AMCEs or ACIEs in the formula.
subset
A logical vector with length nrow(data) denoting which rows in data should be included in estimation. This can for example be used to subset the data along respondent-level covariates. Defaults to NULL.
respondent.id
A character string indicating the column of data containing a unique identifier for each respondent. Defaults to NULL.
cluster
A logical indicating whether estimated standard errors should be clustered on respondent.id. Defaults to TRUE.
na.ignore
A logical indicating whether the function should ignore missing rows in data. If FALSE, amce() will raise an error if there are rows with missing values. Defaults to FALSE.
weights
A character string giving the name of the column in the data containing any survey weights. See documentation for survey package for more information.
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 base

Value

  • An object of class "amce" containing:
  • attributesA list containing the names of attributes.
  • baselinesBaseline levels for each attribute in estimates. Baselines determined using the first element of levels(). If a different baseline level is desired for an attribute, use the relevel() function on the variable prior to calling the amce() routine or supply an alternative baseline in baselines argument.
  • continuousList of quantiles for any non-factor variables, whether attributes or respondent varying.
  • dataThe original data.
  • estimatesA list containing AMCE and ACIE estimates for each attribute in formula. Each element of estimates corresponds to a single attribute or interaction.
  • formulaThe formula passed to the amce() routine.
  • samplesize_profThe number of valid profiles (rows) in the dataset
  • user.namesA vector with the original user supplied names for any attributes. These may differ from the attribute names in estimates if the original names contain spaces.
  • vcov.profThe modified variance-covariance matrix for AMCE and ACIE estimates. Incorporates cluster corrections as well as attribute dependencies. Profile varying attributes only.
  • numrespondentsThe number of respondents in the dataset (if respondent.id is not NULL).
  • respondent.varyingNames of respondent-varying variables, if any.
  • cond.formulaThe formula used for calculating estimates conditional on respondent varying characteristics. Only returned when respondent-varying characteristics are present.
  • cond.estimatesA list containing AMCE and ACIE estimates conditional on the values of the respondent-varying characteristics. Each element of cond.estimates corresponds to a single attribute or interaction. Only returned when respondent-varying characteristics are present
  • samplesize_fullThe number of valid profiles (rows) in the dataset when respondent varying characteristics are included. Only returned when respondent-varying characteristics are present.
  • vcov.respThe 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

Run this code
# 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)

Run the code above in your browser using DataLab