library(Zelig)
## ## 
## ##  Zelig (Version 3.5.3, built: 2011-11-29)
## ##  Please refer to http://gking.harvard.edu/zelig for full
## ##  documentation or help.zelig() for help with commands and
## ##  models supported by Zelig.
## ##
## 
## ##  Zelig project citations:
## ##    Kosuke Imai, Gary King, and Olivia Lau. (2009).
## ##    ``Zelig: Everyone's Statistical Software,''
## ##    http://gking.harvard.edu/zelig.
## ##  and
## ##    Kosuke Imai, Gary King, and Olivia Lau. (2008).
## ##    ``Toward A Common Framework for Statistical Analysis
## ##    and Development,'' Journal of Computational and
## ##    Graphical Statistics, Vol. 17, No. 4 (December)
## ##    pp. 892-913. 
## 
## ##  To cite individual Zelig models, please use the citation format printed with
## ##  each model run and in the documentation.
## ##
library(DescTools)
library(stargazer)
library(dplyr)
library(tidyr)
library(memisc)
library(pander)
library(foreign)
library(gmodels)
library(car)
library(visreg)
library(aod)
library(erer)
library(ggplot2)
library(magrittr)
library(DescTools)
library(lme4)
library(npmlreg)
data(Ornstein)
data(irlsuicide)
GSS = read.spss("C:\\Users\\Robert Johnson\\RSquared\\GSS2014.sav", to.data.frame=TRUE)

Below the glm model shows race and sex as factors when considering whether or not race and sex are factors when considering if someone believes the state should or should not help black people. As you can see black has a -.352 probability of saying that the state should help black people. with a p value of less than .01. While females and non citizen have a significantly lower probability and a p value of greater than .1. In conclusion the variable race has a very significant effect on whether or not someone believes black people should get additional assistance from the government.

## How to cite this model in Zelig:
## Kosuke Imai, Gary King, and Oliva Lau. 2007. "poisson: Poisson Regression for Event Count Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
## 
## =============================================
##                       Dependent variable:    
##                   ---------------------------
##                             helpblk          
## ---------------------------------------------
## citizenNO                0.035 (0.079)       
## raceBLACK              -0.352*** (0.062)     
## raceOTHER               -0.124* (0.064)      
## sexFEMALE                0.013 (0.038)       
## Constant               1.316*** (0.029)      
## ---------------------------------------------
## Observations                  810            
## Log Likelihood            -1,433.313         
## Akaike Inf. Crit.          2,876.626         
## =============================================
## Note:             *p<0.1; **p<0.05; ***p<0.01

## Warning in loop_apply(n, do.ply): Removed 916 rows containing missing
## values (stat_smooth).

## Warning in loop_apply(n, do.ply): Removed 916 rows containing non-finite
## values (stat_density2d).

Above we have some charts that show the data rather well. Specfically the top chart shows education and the want ot help blacks. As you can see the more education someone has the less likely they are to want to help blacks. (1 means yes 7 means no)

The graphs below are ones that I couldn’t get to work with this data.

g1 <- g + geom_point()
g1
## Warning in loop_apply(n, do.ply): Removed 916 rows containing missing
## values (geom_point).

g2 <- g + geom_bin2d()
g2

g6 <- g + geom_point() + stat_smooth(method = "lm")
g6
## Warning in loop_apply(n, do.ply): Removed 916 rows containing missing
## values (stat_smooth).
## Warning in loop_apply(n, do.ply): Removed 916 rows containing missing
## values (geom_point).

g5 <- g1 + geom_smooth()
g5
## Warning in loop_apply(n, do.ply): Removed 916 rows containing missing
## values (stat_smooth).
## Warning in loop_apply(n, do.ply): Removed 916 rows containing missing
## values (geom_point).

I also decided to try out some stuff we worked on for last homework because the data is easier to use.

As you can see from the first graph the data shows that as population increases death by suicide incresaes.

The scatter plot line graph also shows this aswell.

data(irlsuicide)
g8 <- ggplot(irlsuicide, mapping = aes(x = pop, y = death))
g9 <- g8 + geom_smooth()
g9

g11 <- g8 + geom_point()
g11

g15 <- g11+ geom_smooth()
g15