Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE PROVIDE CODE IN MATLAB age6574 % age 65-74, 1990 age75 % age >= 75, 1990 crime serious crimes per 100,000 in 1991 college %
PLEASE PROVIDE CODE IN MATLAB
age6574 % age 65-74, 1990 age75 % age >= 75, 1990 crime serious crimes per 100,000 in 1991 college % with bachelor's degree or higher of those age >=25 income median family income, 1989 dollars farm farm population, % of total, 1990 democrat % votes cast for democratic president republican % votes cast for republican president Perot % votes cast for Ross Perot white % white, 1990 black % black, 1990 turnout 1992 votes for president / 1990 pop x 100 Exercise 1 - US Presidential Election of 1992 The file Us-election-counties.csv contains, at the county level, demographic data and voting results for the 1992 presidential election in the US. A description of the variables for this data set is given in the file US-election-counties-var-explained.txt. In 1992, Ross Perot was an independent candidate in addition to the two main political parties (Democrats and Republicans). a) The population of the US in 1990 was estimated at 249.62 million. Verify that the counties present in this data set cover more than 99% of the US population. b) The state names are abbreviated with only two letters in the data set. With the help of the file US-states-abbrev.txt, add a variable that displays the full name of the state. c) Generate a table that displays, for every state, the median value of the percentage of votes at the county level, for each party. The table should look like this use the full name for states): state Alabama Arizona democrat republican Perot 42.9 46.3 10.5 Wyoming d) Create a function plotlinreg(T, party, var) that has three inputs: the table T of the imported data set, a string variable party that represents the percentage of votes received by the party and another string variable var that represents a demographic variable of the data set. This function will create a scatter plot of the two variables party and var with the linear regression line. You will indicate in the plot title the values of the intercept, slope and unadjusted R2 For example, the call plot_linreg(T,"democrats","black") should produce a figure similar to Figure 1. e) Using plot.linreg(), create a figure with 15 subplots. The subplots will be organized in three rows, one for each political party and five columns. The column will represent the following variables: crime, income, college, white and black f) Explore the dataset and describe (preferably with a figure) something you find interesting, that has not been covered in this exercise it could be trends, unexpected distribution, etc.). age6574 % age 65-74, 1990 age75 % age >= 75, 1990 crime serious crimes per 100,000 in 1991 college % with bachelor's degree or higher of those age >=25 income median family income, 1989 dollars farm farm population, % of total, 1990 democrat % votes cast for democratic president republican % votes cast for republican president Perot % votes cast for Ross Perot white % white, 1990 black % black, 1990 turnout 1992 votes for president / 1990 pop x 100 Exercise 1 - US Presidential Election of 1992 The file Us-election-counties.csv contains, at the county level, demographic data and voting results for the 1992 presidential election in the US. A description of the variables for this data set is given in the file US-election-counties-var-explained.txt. In 1992, Ross Perot was an independent candidate in addition to the two main political parties (Democrats and Republicans). a) The population of the US in 1990 was estimated at 249.62 million. Verify that the counties present in this data set cover more than 99% of the US population. b) The state names are abbreviated with only two letters in the data set. With the help of the file US-states-abbrev.txt, add a variable that displays the full name of the state. c) Generate a table that displays, for every state, the median value of the percentage of votes at the county level, for each party. The table should look like this use the full name for states): state Alabama Arizona democrat republican Perot 42.9 46.3 10.5 Wyoming d) Create a function plotlinreg(T, party, var) that has three inputs: the table T of the imported data set, a string variable party that represents the percentage of votes received by the party and another string variable var that represents a demographic variable of the data set. This function will create a scatter plot of the two variables party and var with the linear regression line. You will indicate in the plot title the values of the intercept, slope and unadjusted R2 For example, the call plot_linreg(T,"democrats","black") should produce a figure similar to Figure 1. e) Using plot.linreg(), create a figure with 15 subplots. The subplots will be organized in three rows, one for each political party and five columns. The column will represent the following variables: crime, income, college, white and black f) Explore the dataset and describe (preferably with a figure) something you find interesting, that has not been covered in this exercise it could be trends, unexpected distribution, etc.)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