# 21 points close to the quadratic x^2 - 5*x + 6
x <- seq(-2,5,length=21)
set.seed(7766)
eps <- rnorm(21,mean=0,sd=0.5)
y <- x^2-5*x+6+eps
# Data frame
pts <- data.frame(x=x,y=y)
# Regression
ltmp <- polysolveLS(pts,m=2)
print(names(ltmp))
print(ltmp$a)
print(ltmp$SSE)
Run the code above in your browser using DataLab