0
$\begingroup$

I am trying to understand some code somebody has written.

I have a y vector which is a factor say book to price for 500 companies.

Then I also have a x vector of the same shape which is just ones.

A OLS regression is performed. The beta of the x variable is saved and called coeff.

The residual is then calculate as

   residual = y - (x * coeff)

The residuals are then sorted and then ranked be being passed into a normal inverse function which gives us our final factor.

I do not follow what is going on here? Why is a factor being regressed against a vector of ones?

$\endgroup$
0
$\begingroup$

(OLS) regressing a response variable against a vector of ones is equivalent to fitting a constant model consisting of the mean of the response. The residuals are then $r_i=Y_i-\bar{Y}$.

If the response has already been centred then this is a no-op.

$\endgroup$
  • $\begingroup$ thanks for your reply. Can you tell me why you would want to do this? $\endgroup$ – user8170 Aug 31 '16 at 8:27
  • 1
    $\begingroup$ Generally such a model is referred to as a "null model", against which other models are compared. It is also necessary to fit it in order to calculate some statistics about goodness of fit of other, more complicated models. $\endgroup$ – JDL Aug 31 '16 at 8:29

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.