This is an R HTML document. When you click the Knit HTML button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
POLI - 311, Hw 1: Changing Minds on Gay Marriage```{r} </head>Question 1:</head> <body>Notation/Object Naming<body> #### NC = No Contact #### GC = Gay Canvasser #### SC = Straight Canvasser #### W_ = Wave no. _ #### SSMS = Same Sex Marriage Score #### M___ = Mean of ___ #### ATE = Average Treatment Effect #### d = Delta (or change in) Study1 <- subset(gay, subset = (study != 2)) head(Study1) W1_Study1 <- subset(Study1, subset = (wave == 1)) head (W1_Study1) W1_Study1_SC <- subset(W1_Study1, subset = (treatment == "Same-Sex Marriage Script by Straight Canvasser")) head(W1_Study1_SC) ## W1_Study1_SC contains all the ssm observations for straight canvassers in study 1, wave 1 W1_Study1_GC <- subset(W1_Study1, subset = (treatment == "Same-Sex Marriage Script by Gay Canvasser")) head(W1_Study1_GC) ## W1_Study1_GC contains all the ssm observations for gay canvassers in study 1, wave 1 W1_Study1_NC <- subset(W1_Study1, subset = (treatment == "No Contact")) head(W1_Study1_NC) ## W1_Study1_NC contains all the ssm observations for No Contact in study 1, wave 1 MW1_SSMS_SC <- mean(W1_Study1_SC$ssm) ## MW1_SSMS_SC = 3.09970958... MW1_SSMS_GC <- mean(W1_Study1_GC$ssm) ## MW1_SSMS_GC = 3.02519548... MW1_SSMS_NC <- mean(W1_Study1_NC$ssm) ## MW1_SSMS_NC = 3.04276441... ## Based on pre-treatment analysis, the relative meanial values of the support for same-sex marriage (ssm) appear to be both sufficiently unique to indicate authenticity and yet not so distinct from one another as to render any analysis inconclusive. Randomization appears to have been properly conducted.
## Error: attempt to use zero-length variable name
#Question 2: W2_Study1 <- subset(Study1, subset = (wave == 2)) head(W2_Study1)
## study treatment wave ssm ## 5 1 No Contact 2 5 ## 10 1 No Contact 2 4 ## 15 1 No Contact 2 3 ## 24 1 No Contact 2 3 ## 26 1 Recycling Script by Gay Canvasser 2 2 ## 36 1 No Contact 2 4
W2_Study1_SC <- subset(W2_Study1, subset = (treatment == "Same-Sex Marriage Script by Straight Canvasser")) head(W2_Study1_SC)
## study treatment wave ssm ## 442 1 Same-Sex Marriage Script by Straight Canvasser 2 3 ## 553 1 Same-Sex Marriage Script by Straight Canvasser 2 2 ## 643 1 Same-Sex Marriage Script by Straight Canvasser 2 1 ## 702 1 Same-Sex Marriage Script by Straight Canvasser 2 5 ## 708 1 Same-Sex Marriage Script by Straight Canvasser 2 2 ## 789 1 Same-Sex Marriage Script by Straight Canvasser 2 2
##W2_Study1_SC contains all the ssm observations for straight canvassers in study 1, wave 2 W2_Study1_GC <- subset(W2_Study1, subset = (treatment == "Same-Sex Marriage Script by Gay Canvasser")) head(W2_Study1_GC)
## study treatment wave ssm ## 300 1 Same-Sex Marriage Script by Gay Canvasser 2 5 ## 480 1 Same-Sex Marriage Script by Gay Canvasser 2 5 ## 488 1 Same-Sex Marriage Script by Gay Canvasser 2 5 ## 584 1 Same-Sex Marriage Script by Gay Canvasser 2 5 ## 690 1 Same-Sex Marriage Script by Gay Canvasser 2 1 ## 940 1 Same-Sex Marriage Script by Gay Canvasser 2 5
##W2_Study1_GC contains all the ssm observations for gay canvassers in study 1, wave 2 W2_Study1_NC <- subset(W2_Study1, subset = (treatment == "No Contact")) head(W2_Study1_NC)
## study treatment wave ssm ## 5 1 No Contact 2 5 ## 10 1 No Contact 2 4 ## 15 1 No Contact 2 3 ## 24 1 No Contact 2 3 ## 36 1 No Contact 2 4 ## 40 1 No Contact 2 3
##W2_Study1_NC contains all the ssm observations for No Contact in study 1, wave 2 ##Now analyze the difference in "ssm" between both treatments (SC or GC) & the control (NC) MW2_SSMS_SC <-mean(W2_Study1_SC$ssm) ## MW2_SSMS_SC = 3.16186253... MW2_SSMS_GC <- mean(W2_Study1_GC$ssm) ## MW2_SSMS_GC = 3.13948919... MW2_SSMS_NC <- mean(W2_Study1_NC$ssm) ## MW2_SSMS_NC = 3.03961456... ATE_W2_SC <- (MW2_SSMS_SC - MW2_SSMS_NC) ## ATE_W2_SC = 0.12224797... ## Support for ssm has increased (on average) by the above amount when subjects were exposed to the ## treatment by straight convassers ATE_W2_GC <- (MW2_SSMS_GC - MW2_SSMS_NC) ## ATE_W2_GC = 0.09987463... ## Support for ssm has increased (on average) by the above amount when subjects were exposed to the ## treatment by gay canvassers dSSMS_W1W2_SC <- MW2_SSMS_SC - MW1_SSMS_SC ## dSSMS_W1W2_SC = 0.06215294... dSSMS_W1W2_GC <- MW2_SSMS_GC - MW1_SSMS_GC ## dSSMS_W1W2_GC = 0.11429371... ## Based on the difference between the two treatments and the control we can conclude that the act ## of canvassing in support of gay marriage elicits increased support for the issue. ## Furthermore, a comparison between the menial values of SSMS in wave 1 & 2 for the straight canvasser ## treatment and between the same for the gay canvasser seems to indicate that the gay ## canvasser had a larger 'positive' treatment effect than the straight canvasser, however we ## cannot be certain in conlcluding this based on the data analysis so far.
#Question 3: RS = Recylcling Script; MS = Marriage Script ## i) The use of the "recycling script" will allow us to build on the inference we made in the second sentence ## to the answer in question 2. Namely: does the sexual orientation of the canvasser make a difference ## regarding the support of the subject for same-sex marriage regardless of the script. ## ii) MW2_SSMS_GC_MS <- MW2_SSMS_GC ## MW2_SSMS_GC_MS = 3.13948919... W2_SSMS_GC_RS <- subset(W2_Study1, subset = treatment == "Recycling Script by Gay Canvasser") MW2_SSMS_GC_RS <- mean(W2_SSMS_GC_RS$ssm) ## MW2_SSMS_GC_RS = 3.10744681... ATE_SSMS_GC_RS <- MW2_SSMS_GC_RS - MW2_SSMS_NC ## ATE_SSMS_GC_RS = 0.06783225... ATE_SSMS_GC_MS <- MW2_SSMS_GC_MS - MW2_SSMS_NC ## ATE_SSME_GC_MS = 0.09987463... ## iii) MW2_SSMS_SC_MS <- MW2_SSMS_SC ## MW2_SSMS_SC_MS = 3.16186253... W2_SSMS_SC_RS <- subset(W2_Study1, subset = (treatment == "Recycling Script by Straight Canvasser")) MW2_SSMS_SC_RS <- mean(W2_SSMS_SC_RS$ssm) ## MW2_SSMS_SC_RS = 3.00427781... ATE_SSMS_SC_MS <- MW2_SSMS_SC_MS - MW2_SSMS_NC ## ATE_SSMS_SC_MS = 0.12224797... ATE_SSMS_SC_RS <- MW2_SSMS_SC_RS - MW2_SSMS_NC ## ATE_SSMS_SC_RS = -0.03533649... ## Based on these results we can conclude that the topic of the canvassing does make a difference ## in changing people's mind about a specific topic, and that the simple exposure of subjects ## to a straight canvasser has no effect on their SSMS. ## iv) ## The results found in section ii), for the ATE of the recycling script by a gay canvasser, when ## compared to the results found in section iii), for the ATE of the recycling script by a ## straight canvasser, indicates that the sexual orientation of the canvasser has some impact on ## the subjects support for SSM. In other words, while the topic of the canvassing does make a ## positive impact on the subjects opinions vis-a-vis gay marriage, these results seem to indcate ## that simply exposing to a homosexual for whatever reason will grow support for SSM.
You can also embed plots, for example:
plot(cars)