How to get Predicted Value from a Ridge regression using closed solution? I know that by applying the enter image description here

we get the vector of coefficients, but do we do next?

  • $\begingroup$ 0.8 0.6 0.3 0.3 $\endgroup$
    – ak3
    Oct 18, 2023 at 10:19

1 Answer 1


Dot the feature vector with that $w$ you’ve calculated (the estimated coefficient vector), same as in OLS.

A linear model posits that each conditional expected value (what you’re trying to predict) is a linear combination of the features.

$$ \mathbb E\left[y_i\vert x_i\right] = \sum_j x_{ij}w_j $$

In this notation, $y_i$ is the outcome, $x_i$ is a vector of features, and $w$ is a vector of weights.

Therefore, when you estimate that $w$, such as with ordinary least squares or ridge estimation, the sensible way to estimate that conditional expected value (that is, to make a prediction) is to dot the feature vector with the coefficient vector that you’ve just estimated.

  • $\begingroup$ why do you do the transposed? $\endgroup$
    – ak3
    Oct 18, 2023 at 10:34
  • $\begingroup$ @ak3 Otherwise, the matrix multiplication is nonsensical. This is a pretty fundamental concept in the linear algebra underlying linear statistical models, so if you’re shaky on that, you might want to review such topics before jumping into more advanced material. $\endgroup$
    – Dave
    Oct 18, 2023 at 10:37
  • $\begingroup$ but my w is 4*1 and xi is 1*4 if i transpose the xi matrix i will get a 4*1 and then its impossible $\endgroup$
    – ak3
    Oct 18, 2023 at 10:40
  • $\begingroup$ @ak3 Then you’ve already transposed one of the vectors. Perhaps it’s easiest just to write it as a weighted sum. I will edit the notation. $\endgroup$
    – Dave
    Oct 18, 2023 at 10:46
  • $\begingroup$ @ak3 Has my answer resolved your question? $\endgroup$
    – Dave
    Oct 20, 2023 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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