I have an equation in the form of,
$$ ax + by = cz + dr + es $$
The variables are $x,y,z,r,s$ and the rest are the coefficients. In a book I see the author does a fit and finds values for all these coefficients. I am not sure however how to accomplish this using linear regression. In OLS I am used to expressions such as y ~ x + z, how can I fit the expression above in a form so that OLS will acccept it? I tried to leave only one variable on one side,
$$ ax + by - xz - dr = es $$
for example, so I could do s ~ x + y + z + r (I negated the data values of z and r), but that still does not give me the coefficient of s.
optim()in R) to optimize $a, b, c, d, e$ in order to minimize (say) the squared difference between the left and the right hand side. Add a number of constraints, or your optimizer will happily give you a perfect fit with $a=b=c=d=e=0$, which is probably not what you want. – Stephan Kolassa Jul 05 '16 at 14:35