# Finding a linear regression model with polynomial basis function?

I've stumbled across this question and honestly don't really know where to begin, I understand the general idea behind a polynomial basis function and its role in regression, but don't know how to approach this, any help would be greatly appreciated!

The following is a method of creating data for supervised learning. Y is generated from the following distribution: $$y \sim N(\sin(2x), \sigma ^ 2), \quad \sigma = 0.3$$ where x is generated from a uniform distribution from $$-4$$ to $$4$$, yi and xi, for $$i=1,...,n$$ represent n observations. Propose a linear regression model for y and x using polynomial basis functions.

• It isn't clear whether you want to approximate the given sine function using polynomials over that interval, or you're supposed to model only using the points given, ignoring what you know of the function generating the points. The results in the former case are bound to be better, though the latter situation is usually more realistic. Commented May 28, 2021 at 14:22
• Hi there! I think it's asking to approximate the given sine function using polynomials and over that interval. Commented May 28, 2021 at 15:20

Taylor expension of $$\sin (x)$$ at $$x =0$$ is
$$\sum_{n=0}^{\infty} \frac{(-1)^n}{(2n+1)!}x^{2n+1}$$ hence, you can estimate, e.g., $$y = \beta_0 + \beta_1 x + \beta_2 x ^ 3 + \beta_3 x ^ 5 + \beta_4 x ^ 7 + \beta_5 x ^ 9 + \epsilon$$. The following figure illustrates $$n=100$$ data points generated from $$N(\sin(2x), 0.3^2)$$, where $$X \sim U[-2, 2]$$. You can see that practically the polynomial regression was as good as the true regression model $$y = \alpha_0 + \alpha_1 \sin ( 2x ) + \xi$$