0
$\begingroup$

I am looking at second order polynomial approximation, specifically at this link. However, I am stuck in the one dimensional case: I do not think I can calculate the following:

$$ X^{T}*X^{-1}*X^{T}*y$$

Suppose I have as sample points $x = [1.0,2.0,3.0,4.0,5.0]$, then from what I understood in the link my matrix should become: \begin{bmatrix} 1 & 1 & 1 \\ 1 & 2 & 4 \\ 1 & 3 & 9 \\ 1 & 4 & 16 \\ 1 & 5 & 25 \end{bmatrix} Ignoring the columns $x_1*x_2, \cdots x_{nx-1}x_{nx}$ because I do not have more dimensions. Suppose I calculate $X^{-1}$ with Matlab pinv command, still I cannot do $X^T * X^{-1}$. Is this a problem with the single dimension and it gets solved with $d > 1$?

$\endgroup$
  • $\begingroup$ @Leo I though it was $nt$ x $(1 + 3*d)$, isn't that so? Also because I have been reading this wikipedia article which talks about the same thing in my mind: en.wikipedia.org/wiki/Polynomial_regression $\endgroup$ – qcc101 Aug 13 at 14:19
  • $\begingroup$ @Leo If X is $n$ by $m$, $n \neq m$, then $X^{-1}$ is actually $m$ by $n$, check it with the pinv command $\endgroup$ – qcc101 Aug 13 at 17:31
  • $\begingroup$ Yes you are right $\endgroup$ – Leo Aug 13 at 17:33
0
$\begingroup$

Looks like a typo on the site,

$$ \boldsymbol{\beta} = \color{red}{(} {\bf X}^T {\bf X}\color{red}{)^{-1}} {\bf X}^{T} {\bf y} $$

If you use y = [0.0, 1.0, 1.5, 0.5, 1.0], you should get beta = [-0.9, 1.22142857, -0.17857143]

enter image description here

$\endgroup$
  • $\begingroup$ What is the form of the X matrix in your example? $\endgroup$ – qcc101 Aug 13 at 17:28
  • $\begingroup$ @qcc101 the same you have in your post $\endgroup$ – caverac Aug 13 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.