Question
I seem to be struggling formatting R programming code for the following question: In this exercise, we quantify the degree of partisan segregation for each
I seem to be struggling formatting R programming code for the following question:
In this exercise, we quantify the degree of partisan segregation for each state. We consider a state to be politically segregated if Democrats and Republicans tend to live in different counties. A common way to quantify the degree of residential segregation is to use the *dissimilarity index* given by:
$\texttt{dissimilarity index} = \frac{1}{2} \sum_{i=1}^N | \frac{d_i}{D} - \frac{r_i}{R}$
In the formula, $d_i$ $(r_i)$ is the number of Democratic (Republican) voters in the county and $D (R)$ is the total number of Democratic (Republican) votes in the state. $N$ represents the number of counties. The index measures the extent to which Democratic and Republican votes are evenly distributed within states. It can be interpreted as the percentage of one group that would need to move in order for its distribution to match that of the other group. Using data on Democratic and Republican votes from the 2008 presidential election, calculate the dissimilarity index for each state. Which states are among the most (least) segregated according to this measure? Visualize the result as a map. Briefly comment on what you observe.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started