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 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 effects can be specified using standard interaction syntax - joining attribute names using either : or *. However using the : syntax will produce the same results as * since missing base terms are automatically added to the formula. For example Y ~ X1 + X2 will return AMCEs for X1 and X2. Y ~ X1 + X2 + X1:X2 will return AMCEs for X1 and X2 along with an ACIE for X1/X2. Y ~ X1*X2 and Y ~ X1:X2 will produce identical results to Y ~ X1 + X2 + X1:X2. Note that you can place backticks around a variable name containing spaces in order to have formula interpret it as a single variable name. Any respondent characteristics must be designated as such in redpondent.varying.

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 attribute levels have an equal probability of being presented to a respondent and that no profiles are restricted. Defaults to "uniform".

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 baseline.

Value

An object of class "amce" containing:

attributes

A list containing the names of attributes.

baselines

Baseline 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.

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. Each element of estimates corresponds to a single attribute or interaction.

formula

The formula passed to the amce() routine.

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 estimates if the original names contain spaces.

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.id is not NULL).

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 cond.estimates corresponds to a single attribute or interaction. Only returned when respondent-varying characteristics are present. To obtain AMCE and ACIE estimates conditional on the values of the respondent-varying characteristics see summary.amce

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)


[Package cjoint version 2.1.1 Index]