Stats Unit 4 assignment

docx

School

West Texas A&M University *

*We aren’t endorsed by this school

Course

6388

Subject

Statistics

Date

Feb 20, 2024

Type

docx

Pages

3

Uploaded by georgiaestrada

Report
Dr. J. Rausch Stat/Soc/Crim Rerch (POSC-6388) February 14, 2024 Georgia Estrada Unit 4 1. This review uses the congress.csv dataset. Here is a brief summary of the variables in the congress.csv dataset Try to create separate datasets for Democrats and Republicans (hint: subsetting) Create a scatterplot of first and second dimension (DW-NOMINATE scores) for Democrats (in blue) xlim=c(-1.5, 1.5) and ylim=c(-1.5, 1.5) Create separate datasets for Democrats and Republicans in the 80th Congress (1947-49) Create scatterplot of first and second dimension for Democrats and Republicans xlim=c(-1.5, 1.5) and ylim=c(-1.5, 1.5) Create separate datasets for Democrats and Republicans in the 112th Congress (2011-13) xlim=c(-1.5, 1.5) and ylim=c(-1.5, 1.5) getwd() congress <- read.csv("DSS/congress.csv") head(congress) ## subset the data by party rep <- subset(congress, subset = (party == "Republican")) dem <- congress[congress$party == "Democrat", ] xlab <- "Economic liberalism/conservatism" ylab <- "Racial liberalism/conservatism" lim <- c(-1.5, 1.5) plot(dem$dwnom1, dem$dwnom2, pch = 16, col = "blue", xlim = lim, ylim = lim, xlab = xlab, ylab = ylab, main = "Congress") # democrats rep80 <- subset(rep, subset = (congress == 80)) dem80 <- subset(dem, subset = (congress == 80)) ## scatterplot for the 80th Congress par(mfrow = c(1,2), cex = .8) plot(dem80$dwnom1, dem80$dwnom2, pch = 16, col = "blue", xlim = lim, ylim = lim, xlab = xlab, ylab = ylab, main = "80th Congress") # democrats points(rep80$dwnom1, rep80$dwnom2, pch = 17, col = "red") # republicans text(-0.75, 1, "Democrats") text(1, -1, "Republicans") rep112 <- subset(rep, subset = (congress == 112)) dem112 <- subset(dem, subset = (congress == 112)) ## scatterplot for the 112th Congress plot(dem112$dwnom1, dem112$dwnom2, pch = 16, col = "blue", xlim = lim, ylim = lim, xlab = xlab, ylab = ylab, main = "112th Congress")#democrats points(rep112$dwnom1, rep112$dwnom2, pch = 17, col = "red") #republicans
> getwd() [1] "C:/Users/georg/OneDrive/Documents" > congress <- read.csv("DSS/congress.csv") > head(congress) congress district state party name dwnom1 dwnom2 1 80 0 USA Democrat TRUMAN -0.276 0.016 2 80 1 ALABAMA Democrat BOYKIN F. -0.026 0.796 3 80 2 ALABAMA Democrat GRANT G. -0.042 0.999 4 80 3 ALABAMA Democrat ANDREWS G. -0.008 1.005 5 80 4 ALABAMA Democrat HOBBS S. -0.082 1.066 6 80 5 ALABAMA Democrat RAINS A. -0.170 0.870 > ## subset the data by party > rep <- subset(congress, subset = (party == "Republican")) > dem <- congress[congress$party == "Democrat", ] > xlab <- "Economic liberalism/conservatism" > ylab <- "Racial liberalism/conservatism" > lim <- c(-1.5, 1.5) > plot(dem$dwnom1, dem$dwnom2, pch = 16, col = "blue", xlim = lim, ylim = lim, xlab = xlab, ylab = ylab, main = "Congress") # democrats > rep80 <- subset(rep, subset = (congress == 80)) > dem80 <- subset(dem, subset = (congress == 80)) > ## scatterplot for the 80th Congress > par(mfrow = c(1,2), cex = .8) > plot(dem80$dwnom1, dem80$dwnom2, pch = 16, col = "blue", xlim = lim, ylim = lim, xlab = xlab, ylab = ylab, main = "80th Congress") # democrats > points(rep80$dwnom1, rep80$dwnom2, pch = 17, col = "red") # republicans > text(-0.75, 1, "Democrats") > text(1, -1, "Republicans") > rep112 <- subset(rep, subset = (congress == 112)) > dem112 <- subset(dem, subset = (congress == 112)) > ## scatterplot for the 112th Congress > plot(dem112$dwnom1, dem112$dwnom2, pch = 16, col = "blue", xlim = lim, ylim = lim, xlab = xlab, ylab = ylab, main = "112th Congress")#democrats > points(rep112$dwnom1, rep112$dwnom2, pch = 17, col = "red") #republicans
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help