# Least squares estimator of a curve

I have a problem estimating the parameters via least squares. The problem is as follows:

Suppose we want to adjust the following curve $y_i=\beta_0 x_i + \beta_1 x_i^2 +\varepsilon_i$. Compute the parameters' estimator via least squares, and give the expression of the parameters' variance.

I have trouble in computing the estimator.

I have tried to take $(Y-X\beta)^T(Y-X\beta)$ and then differentiate with respect $\beta$.

That equals zero and one gets $\hat{\beta}=(X^TX)^{-1}X^TY$ (usual procedure).

But for that you suppose that the curve will be something like $y_i=\beta_0+\beta_1x_i+\varepsilon$, i.e., the matrix $X$ has the first column of 1s, and then you put the variables $x_i$ in a column as well $$X=\begin{bmatrix} 1 & x_1 \\ 1 & x_2 \\ \vdots & \vdots \\ 1 & x_n \end{bmatrix}$$ but in the problem you don't have $\beta_0$ alone.

Any ideas or suggestions or solutions of how I should proceed?

• Your definition of X doesn't seem right, I could write what it should be for you, but I think you'll have more fun figuring out how X matrix should look :). hint: does your $X \beta$ gives you what it should? – Cherny Mar 23 '17 at 15:17
• The matrix $X$ as defined at the bottom corresponds to the linear model $y_i=\beta_0+\beta_1x_i+\epsilon$, and if you define $\beta$ as $\beta=[\beta_0 \beta_1]^T$ it is correct. But for the model in the problem, it is another matrix $X$ that I do not know how to write. That's what I'm asking – user140214 Mar 23 '17 at 15:26
• Adjoin a column for the $x_i^2$ terms. Remove the column of 1's: it's not part of your model. – whuber Mar 23 '17 at 15:57
• I realise almost after posting the previous comment that I should have done that. I thought it was something different. Thanks both, I'll write the answer when I have a moment (or if you prefer, you can write it and I'll mark it as correct). – user140214 Mar 23 '17 at 16:02
• @plr feel free to write it; I don't think whuber will do so. – Glen_b Mar 24 '17 at 8:25