Created
October 30, 2016 05:27
-
-
Save lotusirous/e2732093d21c61e52be6e4bc5cc3bba0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm(list=ls()) | |
data = read.csv('weisberg_fuel.csv',header=TRUE) | |
X1 <- data$TAX # Tax | |
X2 <- data$DLIC | |
X3 <- data$INC | |
X4 <- data$ROAD | |
Y <- data$FUEL | |
df <- cbind(X1,X2,X3,X4,Y) | |
pairs(df) | |
summary(df) | |
cor(df) | |
fit <- lm(Y ~ X1+X2+X3+X4) | |
summary(fit) | |
# Anova | |
anova(fit) | |
# Use stepAIC | |
library(MASS) | |
stepAIC(fit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment