R: Data from conjoint analysis in Hainmueller and Hopkins (2014)...
Immigration
R Documentation
Data from conjoint analysis in Hainmueller and Hopkins (2014) and Hainmueller, Hopkins and Yamamoto (2014).
Description
This data set gives the outcomes a well as treatment assignments the conjoint analysis in Hainmueller and Hopkins (2014) and Hainmueller, Hopkins and Yamamoto (2014).
Usage
data
Format
A data frame consisting of 6 columns and 6980 observations (5 profiles for each 1396 respondents).
outcome
integer
whether a profile is chosen
0,1
Education
factor
education
7 levels
Gender
factor
gender
male or female
Origin
factor
origin
10 levels
Experience
factor
job experience
4 levels
Plans
factor
job plans
4 levels
Source
Data from the conjoint analysis in Hainmueller and Hopkins (2014) and Hainmueller, Hopkins and Yamamoto (2014). Because of pairings, we randomly select one profile within each pair and define a binary outcome variable for that pair, which is equal to 1 if this profile is chosen and to 0 if the other profile is selected. Columns contain 5 factors from the original conjoint analysis. The details of levels of each factor are described in Hainmueller and Hopkins (2014) and Egami and Imai (2015).
References
Hainmueller, J. and Hopkins, D. J. 2014. “The hidden american immigration consensus: A conjoint analysis of attitudes toward immigrants.” American Journal of Political Science Forthcoming.
Hainmueller, J., Hopkins, D. J., and Yamamoto, T. 2014. “Causal inference in conjoint analysis: Understanding multidimensional choices via stated preference experiments.” Political Analysis, Vol.22, No.1, pp. 1-30.
Imai, Kosuke and Marc Ratkovic. 2013. “Estimating Treatment Effect Heterogeneity in Randomized Program Evaluation.” Annals of Applied Statistics, Vol.7, No.1(March), pp. 443-470. http://imai.princeton.edu/research/files/svm.pdf
###################################################
## Conjoint Analysis: Causal Interaction.
###################################################
data(Immigration)
## Not run:
## The SVM classifier with a lasso constraint is estimated.
## The model includes all three-way and two-way interactions as
## well as main effects of five factorial treatments.
## Run to search for lambdas.
F.conjoint<- FindIt(model.treat= outcome ~
Education+Gender+Origin+Experience+Plans,
nway=3,
data = Immigration,
type="binary",
treat.type="multiple")
## Make the full factorial design matrix as the target population.
full <- full.FindIt(F.conjoint)
## Compute the predicted potential outcomes for the target population.
Unifdata <- predict(F.conjoint,newdata=full,sort=FALSE)$data
## End(Not run)
## load pre-computed F.conjoint and Unifdata
data(F.conjoint)
data(Unifdata)
## Compute AMTEs, ATCEs, and AMTIEs
## Range of each factor interaction.
## The range of the AMTEs for all factors
compare1 <- INT(F.conjoint,target.data=Unifdata,compare=TRUE,order=1)
compare1
## The range of the two-way AMTIEs for all two-way factor interactions
compare2 <- INT(F.conjoint,target.data=Unifdata,compare=TRUE,order=2)
compare2
## Not run:
## The range of the three-way AMTIEs for all three-way factor interactions
compare3 <- INT(F.conjoint,target.data=Unifdata,compare=TRUE,order=3)
compare3
## End(Not run)
## Compute AMTIEs within factor interactions.
## Origin x Experience
out.OP <- INT(F.conjoint,target.data=Unifdata,
column=c("Origin","Experience"),
base=c("India","No.job"), order=2)
out.OP
## Not run:
## Education x Gender x Origin
out.EGO <- INT(F.conjoint,target.data=Unifdata,
column=c("Education","Gender","Origin"),
base=c("No.formal","female","India"), order=3)
out.EGO
## End(Not run)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(FindIt)
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-5
Loading required package: lars
Loaded lars 1.2
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FindIt/Immigration.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Immigration
> ### Title: Data from conjoint analysis in Hainmueller and Hopkins (2014)
> ### and Hainmueller, Hopkins and Yamamoto (2014).
> ### Aliases: Immigration F.conjoint Unifdata
> ### Keywords: datasets
>
> ### ** Examples
>
> ###################################################
> ## Conjoint Analysis: Causal Interaction.
> ###################################################
> data(Immigration)
>
> ## Not run:
> ##D ## The SVM classifier with a lasso constraint is estimated.
> ##D ## The model includes all three-way and two-way interactions as
> ##D ## well as main effects of five factorial treatments.
> ##D
> ##D ## Run to search for lambdas.
> ##D F.conjoint<- FindIt(model.treat= outcome ~
> ##D Education+Gender+Origin+Experience+Plans,
> ##D nway=3,
> ##D data = Immigration,
> ##D type="binary",
> ##D treat.type="multiple")
> ##D
> ##D ## Make the full factorial design matrix as the target population.
> ##D full <- full.FindIt(F.conjoint)
> ##D
> ##D ## Compute the predicted potential outcomes for the target population.
> ##D Unifdata <- predict(F.conjoint,newdata=full,sort=FALSE)$data
> ## End(Not run)
> ## load pre-computed F.conjoint and Unifdata
> data(F.conjoint)
> data(Unifdata)
>
> ## Compute AMTEs, ATCEs, and AMTIEs
>
> ## Range of each factor interaction.
> ## The range of the AMTEs for all factors
> compare1 <- INT(F.conjoint,target.data=Unifdata,compare=TRUE,order=1)
[1] "Using Data representing the target population."
[1] "Range of Marginal Effects"
> compare1
Education Gender Origin Experience Plans
0.197383880 0.007739259 0.126250464 0.087042921 0.267419190
>
> ## The range of the two-way AMTIEs for all two-way factor interactions
> compare2 <- INT(F.conjoint,target.data=Unifdata,compare=TRUE,order=2)
[1] "Using Data representing the target population."
> compare2
V1 V2 range.TIE
8 Origin Experience 0.09497208
3 Education Experience 0.08462559
9 Origin Plans 0.07603530
2 Education Origin 0.06145049
10 Experience Plans 0.05552839
4 Education Plans 0.04373174
1 Education Gender 0.04204575
7 Gender Plans 0.03679968
5 Gender Origin 0.03343086
6 Gender Experience 0.01627208
>
> ## Not run:
> ##D ## The range of the three-way AMTIEs for all three-way factor interactions
> ##D compare3 <- INT(F.conjoint,target.data=Unifdata,compare=TRUE,order=3)
> ##D compare3
> ## End(Not run)
>
> ## Compute AMTIEs within factor interactions.
> ## Origin x Experience
> out.OP <- INT(F.conjoint,target.data=Unifdata,
+ column=c("Origin","Experience"),
+ base=c("India","No.job"), order=2)
[1] "Using Data representing the target population."
> out.OP
$`Range of AMTIE`
[1] 0.09497208
$AMTIE
AMTIE Origin Experience
24 0.05781929 Philippines Three.Five
39 0.02278772 China One.Two
27 0.01900762 Mexico Three.Five
5 0.01166398 Somalia No.job
15 0.01130097 Somalia Morethan.five
33 0.00783490 Sudan One.Two
3 0.00337015 Sudan No.job
32 0.00242682 Iraq One.Two
13 0.00192642 Sudan Morethan.five
25 0.00187452 Somalia Three.Five
36 0.00095525 France One.Two
38 0.00095525 Poland One.Two
40 0.00095525 Germany One.Two
2 0.00043286 Iraq No.job
1 0.00000000 India No.job
11 -0.00036302 India Morethan.five
6 -0.00103870 France No.job
8 -0.00103870 Poland No.job
10 -0.00103870 Germany No.job
9 -0.00116432 China No.job
16 -0.00140171 France Morethan.five
18 -0.00140171 Poland Morethan.five
20 -0.00140171 Germany Morethan.five
19 -0.00152733 China Morethan.five
31 -0.00216084 India One.Two
12 -0.00581640 Iraq Morethan.five
37 -0.00790280 Mexico One.Two
22 -0.00935660 Iraq Three.Five
21 -0.00978947 India Three.Five
17 -0.01025977 Mexico Morethan.five
26 -0.01082816 France Three.Five
28 -0.01082816 Poland Three.Five
30 -0.01082816 Germany Three.Five
7 -0.01315837 Mexico No.job
34 -0.01948207 Philippines One.Two
14 -0.02183903 Philippines Morethan.five
23 -0.02544479 Sudan Three.Five
4 -0.02881151 Philippines No.job
29 -0.03240939 China Three.Five
35 -0.03715279 Somalia One.Two
$ATCE
ATCE AMTIE Origin Experience
24 0.154402938 0.05781929 Philippines Three.Five
20 0.121031247 -0.00140171 Germany Morethan.five
18 0.118807677 -0.00140171 Poland Morethan.five
30 0.100724439 -0.01082816 Germany Three.Five
27 0.099890810 0.01900762 Mexico Three.Five
28 0.098500870 -0.01082816 Poland Three.Five
40 0.087542873 0.00095525 Germany One.Two
11 0.086679906 -0.00036302 India Morethan.five
14 0.085624970 -0.02183903 Philippines Morethan.five
38 0.085319304 0.00095525 Poland One.Two
16 0.085159887 -0.00140171 France Morethan.five
19 0.082613227 -0.00152733 China Morethan.five
17 0.081503781 -0.01025977 Mexico Morethan.five
13 0.079817504 0.00192642 Sudan Morethan.five
39 0.071082942 0.02278772 China One.Two
21 0.066373098 -0.00978947 India Three.Five
26 0.064853079 -0.01082816 France Three.Five
34 0.052136597 -0.01948207 Philippines One.Two
36 0.051671514 0.00095525 France One.Two
33 0.049880642 0.00783490 Sudan One.Two
31 0.049036743 -0.00216084 India One.Two
37 0.048015407 -0.00790280 Mexico One.Two
15 0.046922401 0.01130097 Somalia Morethan.five
23 0.041565940 -0.02544479 Sudan Three.Five
29 0.040850817 -0.03240939 China Three.Five
10 0.034351341 -0.00103870 Germany No.job
8 0.032127772 -0.00103870 Poland No.job
25 0.026615593 0.00187452 Somalia Three.Five
1 0.000000000 0.00000000 India No.job
6 -0.001520019 -0.00103870 France No.job
9 -0.004066679 -0.00116432 China No.job
3 -0.005781686 0.00337015 Sudan No.job
4 -0.008390429 -0.02881151 Philippines No.job
7 -0.008437747 -0.01315837 Mexico No.job
12 -0.009633901 -0.00581640 Iraq Morethan.five
22 -0.024054464 -0.00935660 Iraq Three.Five
32 -0.037236030 0.00242682 Iraq One.Two
35 -0.037376699 -0.03715279 Somalia One.Two
5 -0.039757505 0.01166398 Somalia No.job
2 -0.090427562 0.00043286 Iraq No.job
$`Sum of AMTEs`
Sum of AMTEs AMTIE Origin Experience
20 0.1224329595 -0.00140171 Germany Morethan.five
18 0.1202093902 -0.00140171 Poland Morethan.five
30 0.1115526016 -0.01082816 Germany Three.Five
28 0.1093290323 -0.01082816 Poland Three.Five
14 0.1074640034 -0.02183903 Philippines Morethan.five
24 0.0965836454 0.05781929 Philippines Three.Five
17 0.0917635473 -0.01025977 Mexico Morethan.five
11 0.0870429213 -0.00036302 India Morethan.five
40 0.0865876190 0.00095525 Germany One.Two
16 0.0865615998 -0.00140171 France Morethan.five
38 0.0843640497 0.00095525 Poland One.Two
19 0.0841405612 -0.00152733 China Morethan.five
27 0.0808831893 0.01900762 Mexico Three.Five
13 0.0778910846 0.00192642 Sudan Morethan.five
21 0.0761625634 -0.00978947 India Three.Five
26 0.0756812418 -0.01082816 France Three.Five
29 0.0732602032 -0.03240939 China Three.Five
34 0.0716186628 -0.01948207 Philippines One.Two
23 0.0670107266 -0.02544479 Sudan Three.Five
37 0.0559182067 -0.00790280 Mexico One.Two
31 0.0511975808 -0.00216084 India One.Two
36 0.0507162592 0.00095525 France One.Two
39 0.0482952206 0.02278772 China One.Two
33 0.0420457440 0.00783490 Sudan One.Two
15 0.0356214320 0.01130097 Somalia Morethan.five
10 0.0353900382 -0.00103870 Germany No.job
8 0.0331664689 -0.00103870 Poland No.job
25 0.0247410741 0.00187452 Somalia Three.Five
4 0.0204210820 -0.02881151 Philippines No.job
7 0.0047206259 -0.01315837 Mexico No.job
1 0.0000000000 0.00000000 India No.job
35 -0.0002239085 -0.03715279 Somalia One.Two
6 -0.0004813215 -0.00103870 France No.job
9 -0.0029023601 -0.00116432 China No.job
12 -0.0038175047 -0.00581640 Iraq Morethan.five
3 -0.0091518367 0.00337015 Sudan No.job
22 -0.0146978627 -0.00935660 Iraq Three.Five
32 -0.0396628453 0.00242682 Iraq One.Two
5 -0.0514214893 0.01166398 Somalia No.job
2 -0.0908604261 0.00043286 Iraq No.job
>
> ## Not run:
> ##D ## Education x Gender x Origin
> ##D out.EGO <- INT(F.conjoint,target.data=Unifdata,
> ##D column=c("Education","Gender","Origin"),
> ##D base=c("No.formal","female","India"), order=3)
> ##D out.EGO
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>