Professional Documents
Culture Documents
Baylas - Linear Regression Analysis
Baylas - Linear Regression Analysis
Dataset
Study
Hours
Insights
Baylas, Fatima Joan B.
BSCS-2
CSPE 3100 : Data Science
Dataset
The data set contains two columns that is the number of hours
student studied and the marks they got.
himanshunakrani
hours = studstudyhour[,"Hours"]
scores = studstudyhour[,"Scores"]
#plot(x,y)
plot(hours, scores, pch = 16, col = "blue")
#using ggplot
ggplot(data = studstudyhour,aes(x = hours,y = scores)) +
geom_point(colour = "black",size = 1.5) +
geom_smooth(method = "lm",se = FALSE,colour = "red",size = 0.8)
Insights
Insights
> cor(hours, scores)
[1] 0.9761907
#plot(x,y)
plot(hours, scores, pch = 16, col = "blue")
> model = lm(scores~hours, data=studstudyhour)
> summary(model)
Call:
lm(formula = scores ~ hours, data = studstudyhour)
Residuals:
Min 1Q Median 3Q Max
-10.578 -5.340 1.839 4.593 7.265
R-square value: 0.95