# How do I fit a constrained regression in R?

I have a formal model from which I'm deriving some parameters that I would like to estimate. I haven't done this kind of thing before, and I'd like to have some help to solve this issue in R. I observe $z_i$ (money) and four characteristics of population. I want to regress these characteristics on $z_i$. My regression model should be $$z_i = \frac{\beta N}{\gamma} \ \textbf{1}_{\{\text{type 1}\}} + (\tilde{\alpha} + \tilde{\beta}) \frac{\beta N}{\gamma} \ \textbf{1}_{\{\text{type 2}\}} + (1 - \tilde{\beta}) \frac{\beta N}{\gamma} \ \textbf{1}_{\{\text{type 3}\}} + (\tilde{\alpha}) \frac{\beta N}{\gamma} \ \textbf{1}_{\{\text{type 4}\}} + \epsilon_i$$ where $\epsilon \sim N(\mu, \sigma^2)$

I want the weighting parameters $\tilde{\alpha}$ and $\tilde{\beta}$ to be obtained from a OLS regression, and I want all my coefficients to sum to 1.

Parameters in the equation above are not identified, so I propose to solve this by re-parametrization:$$D_1 = \frac{\beta N}{\gamma} \quad D_2 = (\tilde{\alpha} + \tilde{\beta}) \frac{\beta N}{\gamma} \quad D_3 = (1 - \tilde{\beta}) \frac{\beta N}{\gamma} \quad D_4 = (\tilde{\alpha}) \frac{\beta N}{\gamma}$$

From this I can find $$\frac{D_2}{D_1} = \tilde{\alpha} + \tilde{\beta} \qquad \frac{D_3}{D_1} = 1 - \tilde{\beta} \qquad \frac{D_4}{D_1} = \tilde{\alpha}$$

I want to estimate the equation above in R to get $\tilde{\alpha}$ and $\tilde{\beta}$. How can I do that?

Thanks

Also, what is $\gamma$, $\beta$ and $N$ in this case? Are they known at all?
• Thanks. I will check that. $\gamma$, $\beta$ and N are just constants. – user1172558 Mar 18 '13 at 17:33
• In that case, see if this helps: $$D_1 + D_2 + D_3 + D_4 = 1$$ $$\frac{\beta N}{\gamma} + \frac{\beta N}{\gamma}(\tilde{\alpha} + \tilde{\beta}) + \frac{\beta N}{\gamma}(1 - \tilde{\beta}) + \frac{\beta N}{\gamma}(\tilde{\alpha}) = 1$$ $$\frac{\beta N}{\gamma}(1 + (\tilde{\alpha} + \tilde{\beta}) + (1 - \tilde{\beta}) + (\tilde{\alpha})) = 1$$ $$2 + 2\tilde{\alpha} = \frac{\gamma}{\beta N}$$ $$\tilde{\alpha} = \frac{\gamma}{2\beta N} - 1$$ – RS18 Mar 19 '13 at 2:20
• The knowledge that $\gamma$, $\beta$ and $N$ are constant, matched with the constraint of the coefficients summing to 1, means that $\tilde{\alpha}$ must be equal to that, and $\tilde{\beta}$ can be any value, as it doesn't affect the constraint at all. – RS18 Mar 19 '13 at 21:30