When did same-sex marriage laws become effective by state?

[This article was first published on Decision Science News » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

CORRELATION WITH REPUBLICAN VOTING IN THE 2012 PRESIDENTIAL ELECTION

samesex.pre201506.s

Click to enlarge

In light of the good news today that the Supreme Court ruled that same-sex couples have the right to marry in the United States, we thought we’d look at when same-sex marriage laws became effective by state (if they did at all) before today.

Noting that same sex marriage is a dividing issue between the left and right in the US, we thought we’d compare the date of when same-sex marriage laws become effective in each state with each state’s Republican (two-party) vote share in 2012. Results are above.

Note that California’s same-sex marriage law was effective in 2008, then it was overturned, and then made effective again in 2013. We went with the earlier date because you’ve got to chose something.

The next question is “what about the states that were added by the Supreme Court decision today”? We made a second plot, below, in which we put today’s date for those states in the “effective date” column. The result is pretty much the same.



Click to enlarge

It is interesting to note that none of the plurality Romney-voting states had same sex marriage laws in effect before 2014.

A couple last things. You probably want to see the data, because the graph can be hard to read.

THE DATA

state state_abbrev republican_vote effective_date
1 Alabama AL 61.2 2015.46
2 Alaska AK 57.3 2014.79
3 Arizona AZ 54.6 2014.79
4 Arkansas AR 62.2 2015.46
5 California CA 38.1 2008.46
6 Colorado CO 47.3 2014.79
7 Connecticut CT 41.2 2008.88
8 Delaware DE 40.6 2013.54
9 Florida FL 49.6 2015.04
10 Georgia GA 54.0 2015.46
11 Hawaii HI 28.3 2013.96
12 Idaho ID 66.4 2014.79
13 Illinois IL 41.4 2014.46
14 Indiana IN 55.2 2014.46
15 Iowa IA 47.0 2009.29
16 Kansas KS 61.1 2015.46
17 Kentucky KY 61.5 2015.46
18 Louisiana LA 58.7 2015.46
19 Maine ME 42.1 2012.96
20 Maryland MD 36.7 2013.04
21 Massachusetts MA 38.2 2004.38
22 Michigan MI 45.2 2015.46
23 Minnesota MN 46.1 2013.62
24 Mississippi MS 55.8 2015.46
25 Missouri MO 54.8 2015.46
26 Montana MT 57.0 2014.88
27 Nebraska NE 61.1 2015.46
28 Nevada NV 46.6 2015.46
29 New Hampshire NH 47.2 2010.04
30 New Jersey NJ 41.0 2013.79
31 New Mexico NM 44.7 2013.96
32 New York NY 35.7 2011.54
33 North Carolina NC 51.0 2014.79
34 North Dakota ND 60.1 2015.46
35 Ohio OH 48.5 2015.46
36 Oklahoma OK 66.8 2014.79
37 Oregon OR 43.7 2014.38
38 Pennsylvania PE 47.3 2014.29
39 Rhode Island RI 36.0 2013.62
40 South Carolina SC 55.3 2014.88
41 South Dakota SD 59.2 2015.46
42 Tennessee TN 60.4 2015.46
43 Texas TX 58.0 2015.46
44 Utah UT 74.6 2014.79
45 Vermont VT 31.8 2009.71
46 Virginia VA 48.0 2014.79
47 Washington WA 42.4 2012.96
48 West Virginia WV 63.7 2014.79
49 Wisconsin WI 46.5 2014.79
50 Wyoming WY 71.2 2014.79

Or you can get the data and the R code both

R CODE

library(ggplot2)
library(dplyr)
#Effective date for same-sex marraige from
#https://en.wikipedia.org/wiki/Same-sex_marriage_in_the_United_States
#with June 2015 for states that had not approved by that date
#Republican two-party vote share in the 2012 election from
#usaelectionatlas.org h/t David Rothschild
df=structure(list(state = structure(1:50, .Label = c("Alabama",
"Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut",
"Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois",
"Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine",
"Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi",
"Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire",
"New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota",
"Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island",
"South Carolina", "South Dakota", "Tennessee", "Texas", "Utah",
"Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin",
"Wyoming"), class = "factor"), state_abbrev = structure(c(2L,
1L, 4L, 3L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 13L, 14L, 15L, 12L,
16L, 17L, 18L, 21L, 20L, 19L, 22L, 23L, 25L, 24L, 26L, 29L, 33L,
30L, 31L, 32L, 34L, 27L, 28L, 35L, 36L, 37L, 38L, 39L, 40L, 41L,
42L, 43L, 44L, 46L, 45L, 47L, 49L, 48L, 50L), .Label = c("AK",
"AL", "AR", "AZ", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "IA",
"ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN",
"MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY",
"OH", "OK", "OR", "PE", "RI", "SC", "SD", "TN", "TX", "UT", "VA",
"VT", "WA", "WI", "WV", "WY"), class = "factor"), republican_vote = c(61.2,
57.3, 54.6, 62.2, 38.1, 47.3, 41.2, 40.6, 49.6, 54, 28.3, 66.4,
41.4, 55.2, 47, 61.1, 61.5, 58.7, 42.1, 36.7, 38.2, 45.2, 46.1,
55.8, 54.8, 57, 61.1, 46.6, 47.2, 41, 44.7, 35.7, 51, 60.1, 48.5,
66.8, 43.7, 47.3, 36, 55.3, 59.2, 60.4, 58, 74.6, 31.8, 48, 42.4,
63.7, 46.5, 71.2), month_effective = c(6L, 10L, 10L, 6L, 6L,
10L, 11L, 7L, 1L, 6L, 12L, 10L, 6L, 6L, 4L, 6L, 6L, 6L, 12L,
1L, 5L, 6L, 8L, 6L, 6L, 11L, 6L, 6L, 1L, 10L, 12L, 7L, 10L, 6L,
6L, 10L, 5L, 4L, 8L, 11L, 6L, 6L, 6L, 10L, 9L, 10L, 12L, 10L,
10L, 10L), year_effective = c(2015L, 2014L, 2014L, 2015L, 2008L,
2014L, 2008L, 2013L, 2015L, 2015L, 2013L, 2014L, 2014L, 2014L,
2009L, 2015L, 2015L, 2015L, 2012L, 2013L, 2004L, 2015L, 2013L,
2015L, 2015L, 2014L, 2015L, 2015L, 2010L, 2013L, 2013L, 2011L,
2014L, 2015L, 2015L, 2014L, 2014L, 2014L, 2013L, 2014L, 2015L,
2015L, 2015L, 2014L, 2009L, 2014L, 2012L, 2014L, 2014L, 2014L
), effective_date = c(2015.46, 2014.79, 2014.79, 2015.46, 2008.46,
2014.79, 2008.88, 2013.54, 2015.04, 2015.46, 2013.96, 2014.79,
2014.46, 2014.46, 2009.29, 2015.46, 2015.46, 2015.46, 2012.96,
2013.04, 2004.38, 2015.46, 2013.62, 2015.46, 2015.46, 2014.88,
2015.46, 2015.46, 2010.04, 2013.79, 2013.96, 2011.54, 2014.79,
2015.46, 2015.46, 2014.79, 2014.38, 2014.29, 2013.62, 2014.88,
2015.46, 2015.46, 2015.46, 2014.79, 2009.71, 2014.79, 2012.96,
2014.79, 2014.79, 2014.79)), .Names = c("state", "state_abbrev",
"republican_vote", "month_effective", "year_effective", "effective_date"
), row.names = c(NA, -50L), class = "data.frame")
p=ggplot(df,aes(x=effective_date,y=republican_vote))
p=p+coord_cartesian(xlim=c(2004,2016))
p=p+scale_x_continuous(breaks=seq(2004,2016,by=2))
p=p+geom_text(aes(label=state_abbrev),jitter=TRUE)
p=p+labs(x="Date",y="Republican Vote Share\n(2012 Presidential Two-Party Share)",title="Date Same-Sex Marriage Law Effective\n(or June 26, 2015)")
p=p + geom_hline(yintercept=50)
p=p+geom_smooth(method="loess",span=1.05,se=FALSE)
p
#Colorful Ribbon plot, contributed by David Lallemant in the comments
m=lm(republican_vote~poly(effective_date,3),df)
plotyears=seq(2004,2016,by=0.1)
p=predict(m,newdata=data.frame(effective_date=plotyears))
df2=data.frame(x=plotyears,y=p)
myalpha=0.7
p2=ggplot(df2,aes(x=x,y=y))
p2=p2+geom_ribbon(aes(ymin=y-8,ymax=y-6, x=x), fill="violet",alpha=myalpha,colour=NA)+
geom_ribbon(aes(ymin=y-6,ymax=y-4, x=x), fill="blue",alpha=myalpha,colour=NA)+
geom_ribbon(aes(ymin=y-4,ymax=y-2, x=x), fill="turquoise",alpha=myalpha,colour=NA)+
geom_ribbon(aes(ymin=y-2,ymax=y-0, x=x), fill="green",alpha=myalpha,colour=NA)+
geom_ribbon(aes(ymin=y,ymax=y+2, x=x), fill="yellow",alpha=myalpha,colour=NA)+
geom_ribbon(aes(ymin=y+2,ymax=y+4, x=x), fill="orange",alpha=myalpha,colour=NA)+
geom_ribbon(aes(ymin=y+4,ymax=y+6, x=x), fill="red",alpha=myalpha,colour=NA)+
geom_ribbon(aes(ymin=y+6,ymax=y+8, x=x), fill="pink",alpha=myalpha,colour=NA)+
theme_bw()+
geom_text(aes(label=state_abbrev, x=effective_date,y=republican_vote),
jitter=TRUE, data = df)+
labs(x="Date",y="Republican Vote Share",title="Date Same-Sex Marriage Law Effective")
p2
view raw samesex hosted with ❤ by GitHub

The post When did same-sex marriage laws become effective by state? appeared first on Decision Science News.

To leave a comment for the author, please follow the link and comment on their blog: Decision Science News » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)