0

I am relatively new to R and trying to carry out a conjoint experiment using the cjoint package in R to figure out the characteristics favored by voters in choosing a political candidate. I have been able to carry out the 'amce' regression as well as the plots that the regression produces. The code for the 'amce' regression looks like this:

results_overall <- amce(chosen ~ gender + residence + party + partisanship + education + copartisan + profession_type + caste_type + pol_connection, data=cdata_chosen, cluster=TRUE, respondent.id= "serial_id", design="uniform")

The code for the plot is:

candidate_plot <- plot(results_overall, main="Overall Candidate Preference", xlab="Change in E[Y]", text.size=8, point.size = 0.3, dodge.size = 0.9)

And the produced plot is: Conjoint Experiment Plot:

Now I am trying to produce multiple plots on the same page, where the y-axis remains constant and the new plots are conditional on the specific characteristics of respondents. So, for example, a plot of how the preferences for characteristics of political candidates differ between rich and poor voters produced on the same page rather than two different plots. I have tried to facet_grid and facet_wrap, but they don't seem to be working with this plot. I keep getting the error:

candidate_plot + facet_grid(. ~ econ_class) Error in candidate_plot + facet_grid(. ~ econ_class) : non-numeric argument to binary operator

Does anyone know how to get rid of this error or create facet plots using a different technique that caters to the plots produced by the cjoint package?

Haseeb
  • 1
  • 1
  • 1
    Please add sample of your data per this guide https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Tung Jan 09 '18 at 09:26
  • My dataset has a lot of variables and I don't know how to subset the ones that are relevant to this problem. Basically each row is a respondent entry and the "chosen" column is whether the respondent chose a candidate profile or not. Each variable, from gender ~ pol_connection, is a specific characteristic (with various levels) shown in the profile of each candidate. The regression, therefore, is determining which characteristic is strongly predicting whether the candidate will be chosen by the respondent or not. – Haseeb Jan 09 '18 at 09:57
  • @Haseeb, did you read the article Tung linked to? It explain in detail how to produce [a complete minimal reproducible example](http://stackoverflow.com/help/mcve). Experience show that one often solves ones problems in the process of producing them. – Eric Fail Feb 11 '18 at 14:12

0 Answers0