Answer:
Step-by-step explanation:
Suppose the dataset "women" has 2 numeric columns namely "heights" and "weights".
By using function lm(formula, data) we can calculate the weight for the linear model
linmod = lm(weights ~ heights, data = women)
summary(linmod)
Similarly for the polynomial model
polymod = lm(women$weights ~ women$heights + I(women$heights^2))
summary(polymod)
To plot the fitted lines, we would need to calculate their y-values
plot(women$heights, women$weights, pch=16, col='black)
lines(women$heights, predict(linmod), col='blue')
lines(women$heights, predict(polymod), col='red')