df = read.csv("C:/Users/hilla/OneDrive/Desktop/DAT301/dataset/heart/heart_attackCSV.csv",
sep=",", header = T)
model1 = lm(pressurelow~pressurehight, data = df)
intercept1 = coef(model1)[1]
slope1 = coef(model1)[2]
equation1 = cat("y =", round(intercept1, 4), "+", round(slope1,4), "*x\n")
## y = 32.2223 + 0.3149 *x
plot1 = df %>% select(pressurehight, pressurelow) %>%
ggplot(aes(x = pressurehight, y = pressurelow)) +
geom_point() +
geom_smooth(method="lm", level = 0.95) +
coord_cartesian(ylim=c(0,175)) + theme_bw() +
labs(title = "Simple LR: Systolic BP vs Diastolic BP",
x = "Diastolic BP", y = "Systolic BP") +
annotate("text", x = 200, y = 160,
label ="y = 32.2223 + 0.3149 *x" , color = "red", size = 4)