# why regress a y variable on a vector of just ones

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?

(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}$.