If you really need to use lm or nls and cannot use anything that allows you to specify restrictions, one way is to re-parameterize the model, so the difference in the coefficients is itself a parameter.
For example, if you have a model with b1 * x1 + b2 * x2, but where b2> b1, you can encode this as b1 * x3 + d * x2, where x3 = x1 + x2 and d represents b2-b1, now you you need to force d> 0. You just reanalyze again, d = exp (k), say, and use nls to match the new model b1 * x3 + exp (k) * x2, where your parameters are b1 and k. After the estimate, you can calculate the estimate of b2 as b1 + exp (k). Then b1 is guaranteed to be less than b2.
However, nls allows you to specify upper and lower bounds, so you should just set 0 as the lower bound for d (although this may not guarantee strict inequality).
Hope this helps.
source share