Cara menghitung garis regresi di r
library(readxl)
# import data
Salary_Data <- read_excel("Salary_Data.xls")
# plot a scatter plot
plot(Salary_Data$YearsExperience,Salary_Data$Salary,
main='Regression for YearsExperience and Salary',
xlab='YearsExperience',ylab='Salary')
# plot a regression line
abline(lm(Salary~YearsExperience,data=Salary_Data),col='red')
Outrageous Ocelot