library(caTools) library(ggplot2)
heart_dp <- read.csv(“Heart_Disease_Prediction.csv”) str(heart_dp) summary(heart_dp)
View(heart_dp)
ggplot(heart_dp, aes(x= ST.depression, y= Age)) + geom_point()
ggplot(heart_dp, aes(x= Age, y= Cholesterol)) + geom_boxplot()
ggplot(heart_dp, aes(Cholesterol)) + geom_histogram()
ggplot(heart_dp, aes(Cholesterol)) + geom_bar()
m <- lm(Age ~ Cholesterol, data = heart_dp) summary(m)
ggplot(heart_dp, aes(Cholesterol, Age)) + geom_point() + geom_abline(aes(intercept=coef(m)[1], slope=coef(m)[2]), colour=“purple”)
m2 = lm(Age ~ Chest.pain.type + BP + Cholesterol + Max.HR + ST.depression, data=heart_dp) summary(m2)
D1 <- ggplot(heart_dp, aes(Chest.pain.type, Age)) + geom_point() + geom_abline(aes(intercept=coef(m2)[1], slope=coef(m2)[2]), colour=“green”)
D1
D2 <-ggplot(heart_dp, aes(BP, Age)) + geom_point() + geom_abline(aes(intercept=coef(m2)[1], slope=coef(m2)[2]), colour=“blue”)
D2
D3 <-ggplot(heart_dp, aes(Cholesterol, Age)) + geom_point() + geom_abline(aes(intercept=coef(m2)[1], slope=coef(m2)[2]), colour=“red”)
D3
D4 <-ggplot(heart_dp, aes(Max.HR, Age)) + geom_point() + geom_abline(aes(intercept=coef(m2)[1], slope=coef(m2)[2]), colour=“yellow”)
D4
D5<-ggplot(heart_dp, aes(ST.depression, Age)) + geom_point() + geom_abline(aes(intercept=coef(m2)[1], slope=coef(m2)[2]), colour=“pink”)
D5
SSE <- sum(m2$residuals^2) SSE
RMSE <- sqrt(SSE/nrow(heart_dp)) RMSE