Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
gladishd committed May 22, 2018
1 parent 1f808f2 commit 96f19c8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
17 changes: 17 additions & 0 deletions Case-Study-3-CodeSup.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,23 @@ plot(glm.base$residuals)

The residuals plot shows that our model generally fits the data.

```{r, message = F, warning = F}
infIndexPlot(stp.inter.fwd, vars = c("hat", "cook"))
anova(stp.inter.fwd, test = "Chisq")
qqnorm(stp.inter.fwd$residuals)
```

Our p-values indicate that none of our coefficients are non-significant at the 0.05 level.

Despite the qqplot indicating a potential lack of normality, this is typical for multiple regression and our model does fit the data as indicated by the Loess smoother on our Deviance residuals plots.

```{r, message = F, warning = F}
residualPlots(stp.inter.fwd, tests = false, type = "response")
residualPlots(stp.inter.fwd, tests = false, type = "pearson")
residualPlots(stp.inter.fwd, tests = false, type = "deviance")
```





Binary file modified Case-Study-3-WriteUp.pdf
Binary file not shown.
31 changes: 29 additions & 2 deletions Case-Study-3-WriteUp.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,37 @@ colnames(m) <- c(" ", "Estimate", "Standard error", "z value", "P-value")
pander(m, caption = "Important Coefficients of our Logistic Regression Model")
```

The following set of plots represent what is essentially the relationship between our estimated model and the data for the years 1980 and 2000.
The following set of plots represent what is essentially the relationship between our binary model and the data for the years 1980 and 2000.

```{r, message = F, warning = F, echo = F, fig.height = 3, fig.width = 6}
library(Sleuth3)
library(dplyr)
library(ggformula)
library(pander)
library(knitr)
library(stargazer)
library(car)
library(pander)
library(gridExtra)
library(broom)
library(ggthemes)
library(MASS)
library(leaps)
library(GGally)
nes <- read.csv("http://aloy.rbind.io/data/NES.csv")
```{r, message = F, warning = F, echo = F}
library(ggformula)
library(car)
glm.basic <- glm(dem ~ 1, data = nes, family = binomial)
stp.inter.fwd <- stepAIC(glm.basic, scope = list(lower = ~1, upper = ~ year + region + union + income + educ + gender + race + age + I(age^2) +
age * year + age * region + age * union + age * income + age * educ + age * gender + age * race),
direction = "both", k = log(nrow(nes)), trace = 0)
par(mfrow=c(1, 2))
p2 <- crPlot(stp.inter.fwd, variable = "union")
p1 <- crPlot(stp.inter.fwd, variable = "gender")
```


Expand Down

0 comments on commit 96f19c8

Please sign in to comment.