Restricted Weighted Linear Regression in R

67 Views Asked by At

I have the following issue. I would like to run a linear regression imposing a constraint on the weighted coefficients. Let me construct an example:

Consider the following cross-sectional regression

$r_{i} = \alpha + \beta_{1} I_{i, 1} + \beta_{2} I_{i, 2} + \beta_{3} I_{i, 3} + \epsilon_{i}$

where $r_{i}$ is the return of stock $i$ and $I_{i,1}$ represents a dummy variable which is one if the company belongs to a certain industry and zero otherwise (here I have three industries). The regression should be a weighted linear regression, using the value weights of industry j in the value-weighted market, as weights. In R it would look something like this:

lm(r ~ I1 + I2 + I3, weights = w, data = data)

Now I would like to constrain the regression such that the weighted coefficients for the dummies to add up to zero:

$\sum_{j=1}^{3} w_{j} \beta_{j} = 0$

In a second step, the regression will be extended to continuous variables (i.e. risk factor returns). Those variables should be weighted with the stocks' market capitalizations. So I have one regression for which I have different weights for the continuous variables and the dummy variables. Once market capitalizations and once the weights of the industries in the market. Additionally, I have the mentioned condition for the weighted dummy coefficients.

Does anyone know how I can achieve that in R?

If anyone is interested, I would like to reproduce the results of the paper:

Jose Menchero (2010) - Characteristics of Factor Portfolios

which relies on results of

Steven L. Heston, K. Geert Rouwenhorst (1994) - Does industrial structure explain the benefits of international diversification?

Thank you very much in advance.

1

There are 1 best solutions below

0
On BEST ANSWER

The easiest way to solve this problem is to algebraically eliminate one of the weights by solving for one of the regression weights in

$\sum_{j=1}^{3} w_{j} \beta_{j} = 0.$

For example, if we solve for $\beta_1$ we get

$(1) \quad \beta_1=-\dfrac{w_2}{w_1}\beta_2-\dfrac{w_3}{w_1}\beta_3.$

Now, replace $\beta_1$ in the regression equation

$$r_{i} = \alpha + \beta_{1} I_{i, 1} + \beta_{2} I_{i, 2} + \beta_{3} I_{i, 3} + \epsilon_{i}$$ $$ = \alpha + \left[-\dfrac{w_2}{w_1}\beta_2-\dfrac{w_3}{w_1}\beta_3\right] I_{i, 1} + \beta_{2} I_{i, 2} + \beta_{3} I_{i, 3} + \epsilon_{i}$$ $$\implies r_i= \alpha + \beta_{2} \left[I_{i, 2}-\dfrac{w_2}{w_1}I_{i,1}\right] + \beta_{3} \left[I_{i, 3} -\dfrac{w_3}{w_1}I_{i,1}\right] + \epsilon_{i}$$

The terms in the brackets are your new predictors. This problem has now turned to the unconstrained linear regression problem. As soon as you have determined the coefficients $\beta_2$ and $\beta_3$ you can use equation $(1)$ to determine the last regression weight $\beta_1$.