(5/5)

2. (Dataset: states. Variables: blkleg, blkpct10, south.) In this question, we’ll examine the demographics of state legislatures and the citizens they serve. In particular, we’ll use multiple regression analysis to examine the determinants of African American representation in state legislatures. In the states dataset, you’ll find a variable called blkleg, which records the percentage of black state legislators in the 50 U.S. states.

A. We will estimate a multiple regression model, but let’s start with a simple bivariate regression model before adding an additional explanatory variable. Estimate a bivariate regression model that explains variation in the percentage of African American state legislators in the 50 U.S. states as a function of the African American percentage of each state’s population (blkpct10 in the states dataset). Include a summary of your results in your answer.

B. Now let’s consider regional differences in African American representation in state legislatures by incorporating a variable identifying Southern states into our analysis. You can use the south variable in the states dataset. Estimate a multiple regression model that explains variation in the percentage of African American state legislators as a function of states’ African American populations and whether the state is in the South. Include a summary of these results in your answer.

C. Compare the multiple regression results you obtained in part B with the bivariate regression results you obtained in part A. Based on your analysis, how does incorporating a variable identifying Southern states affect the expected impact of the African American population in a state on African American representation in state legislatures? Does the partial regression coefficient for the blkpct10 variable increase or decrease?

__________________________________________________________________________________________________________________________________________________________________________

D. Create a graphic that visually represents your multiple regression results. The y-axis should correspond to states$blkleg and the x-axis should correspond to states$blkpct10. Plot the observed values of these variables in the states dataset as points on the plot. Add two distinct lines to your plot: one line that represents the relationship between the x- and y-axis variables in the South and another line that represents the relationship in non-Southern states. For clarity, add a legend to your plot that identifies each line.

3. (Dataset: world. Variables: free_labor, regionun.) Workers of the world, unite! Let’s examine labor freedom around the world. In the world dataset, you’ll find an index of labor freedom (free_labor), originally published by the Heritage Foundation, that rates the degree to which employees and employers are free from undue government interference. For this question, we will use regression analysis to compare the labor policies of governments around the world and produce a visualization of the results.

A. Estimate a linear regression model that explains variation in labor freedom (world$free_labor) as a function of region of the world (world$regionun). When you estimate this model, you’ll notice that R automatically creates five dummy variables to allow you to compare labor freedom in six different regions (the sixth region is the omitted, or reference, category). Include a summary of these results in your answer.

B. According to your results, which region of the world enjoys the greatest labor freedom? Which region of the world has the least labor freedom?

Greatest freedom __________

Least freedom __________

C. Create a graphic that visually represents your regression results. The y-axis should correspond to the expected value of the labor freedom index and the x-axis should have six tick marks, one for each region of the world. Plot the expected value of labor freedom corresponding to each region and use vertical line segments to display the 95% confidence interval for each expected value.

4. (Dataset: nes. Variables: ftgr_unions, incgroup_prepost, dem_unionhh.) In this problem, we’ll take a closer look at public sentiment about labor unions in the United States. Labor politics is a complex subject, but many view unions as an important vehicle for protecting the interests of workingclass people from rich and powerful employers. Union membership in the United States peaked in the 1950s and has been steadily declining since that time. Yet many workers are union members or have at least one family member who belongs to a union. How are attitudes about unions shaped by income and personal experience with unions? Let’s use multiple regression analysis with an interaction term to answer this question.

A. To begin, estimate a multiple regression model that explains variation in individuals’ feelings about unions (use the ftgr_unions variable in the nes dataset) as a function of their income and whether anyone in their household belongs to a union (dem_unionhh). Individual income is included in the nes dataset as the incgroup_prepost variable but it’s in the form of an ordered factor, so it becomes unwieldy when incorporated in a multiple regression model. Therefore, transform the incgroup_prepost variable into a numeric class variable by using the as.numeric function. You can simply enter as.numeric(incgroup_prepost) directly into your lm function call. Include a summary of these results in your answer.

B. Based on the results of your analysis in part A, what is the expected effect of increasing income on someone’s sentiment toward unions? How does having a member of one’s household in a union affect one’s sentiment toward unions?

__________________________________________________________________________________________________________________________________________________________________________

C. Now let’s consider how one’s personal experience with unions interacts with personal income in shaping sentiment toward unions. To analyze the interaction between personal experience and income, add an interaction term to the multiple regression model you estimated in part A. Be sure to keep both base terms, dem_unionhh and as.numeric(incgroup_prepost), in your multiple regression model. Include a summary of these results in your answer.

D. Based on the results of your analysis in part C, does the expected effect of increasing income on someone’s sentiment toward unions depend on whether there’s a union member in one’s household? In answering this question, indicate whether income has a greater effect on someone without a household connection to a union or someone with a household connection to a union. __________________________________________________________________________________________________________________________________________________________________________

E. Create a graphic that visually represents the results of the multiple regression model of union sentiment with an interaction term that you estimated to answer part D. The y-axis should correspond to the union feeling thermometer scores and the x-axis should demarcate the income groups represented in the nes dataset. Plot the actual observations as points on the plot. Add two distinct lines to the plot: One line should represent the expected effect of income on union sentiment for those in households with union members, and the other line should represent the expected effect of income on union sentiment for those in households without union members. If, in answering part D, you found that personal experience interacts with income, these two lines should have different slopes.

F. The visualization you created for part E may not illuminate the relationships in these data because the observations are numerous, and people often give a limited number of unique responses when asked to rate something on a feeling thermometer. Enhance your visualization of the relationship between personal experiences with unions, income, and sentiment about unions using one or more of the following techniques described in this chapter: reducing the character expansion values of the points in the plot, plotting points with semi-transparent colors, binning observations, or jittering points to avoid overlaps. As a final touch, add a legend to your plot that distinguishes the two lines you created to answer E.

(5/5)

CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,

Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This

7COM1028 Secure Systems Programming Referral Coursework: Secure

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme