Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

In the well known matrix form of a least squares regression

where I am trying to solve for B in Y = B1X1 + B2X2 + B3

I might be given X and Y sample data as something like

$X$ = $\begin{bmatrix} 1 & 2 \\ 2 & 3 \\ \end{bmatrix}$

$Y$ = $\begin{bmatrix} 7 \\ 8 \\ \end{bmatrix}$

In such an arrangement how do I include B3? I would think I would want to add it in as always 1 in X

IE

$X$ = $\begin{bmatrix} 1 & 2 \\ 2 & 3 \\ 1 & 1 \\ \end{bmatrix}$

Sorry if the question is not clear.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Usually the sample data is represented as a 'design matrix' $X$ in which each row represents one training vector. For your $X$ it would look like this:

$\begin{bmatrix} 1 & 2 & 1\\ 2 & 3 & 1\\ \end{bmatrix}$

In general, you need to insert column of $1$'s as the first (or last) column in you design matrix.

The $X$ you proposed would be correct if each column, not row, represented a training example.

share|improve this answer
    
Thanks Blazej. Later today I will try it out and confirm then I will certainly accept the answer. BTW you are spot on I transposed the training vectors for some reason......Thanks again. –  Pablitorun Mar 1 '11 at 22:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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