You are on page 1of 1

# Values of age in months

x <- c(5,6,7,8,9,10,15,20,25,30)
# Values of height in cm.
y <- c(50,52,54,55,56,58,65,70,74,78)
relation <- lm(x~y)
print(relation)
a <- data.frame(x = 35)
View(a)
result <- predict(relation,a)
print(result)
png(file = "lr.png")

# Plot the chart.


plot(y,x,col = "blue",main = "Height & age Regression",
abline(lm(x~y)),cex = 1.3,pch = 16,xlab = "Age in months",ylab = "Height in
cm")

# Save the file.


dev.off()

You might also like