0

I am performing mixed effect modeling using lme4. But as you would expect, I can get positive and negative fixed and random effects as coefficients. How do I put bounds on my final coefficients such that I get only positive coefficients?

I am also trying to use stan_lmer for Bayesian modeling.

Example: lmer equation

If I check coef(fm1), I get the following output: lmer output

I want to restrict the coefficients to be only positive. Please help.

Shawn Hemelstrand
  • 2,676
  • 4
  • 17
  • 30
  • 1
    Welcome to SO! You're much more likely to get a helpful answer if you can provide a minimal reproducible example of the problem you're trying to solve. See [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) to help you get started. – wurli May 20 '21 at 09:51
  • If you have a negative relation in your data, it does not make any sense at all to restrict coefficients to be positive. Your model won't fit the data. – Martin Wettstein May 20 '21 at 13:41
  • I agree with @MartinWettstein, I am not sure why you would want to do this? – Dylan_Gomes May 20 '21 at 14:32
  • I agree. But it's kind of need of hour. As we want all the independent variables to be significant. Any idea how can we do this ? – abell78989 May 21 '21 at 14:08
  • "As we want all the independent variables to be significant. " - you want all the predictor variables to be significant? Well that typically isn't your choice unless you are dropping "non-significant" terms, but I wouldn't recommend this practice. I would recommend asking yourself what you are doing and why you are doing it. If you feel like you have a handle on this, perhaps you can better word your question(s) to explain why you are trying to do this. – Dylan_Gomes May 26 '21 at 23:35
  • @abell78989 - Did you find a resolution to this. I am in similar mess. I am running a market mix model and would like to run a mixed effect model and study fixed and random effects. I would also like to but bounds/constraints so that few channels should always have +ve coeffcients. Can anyone help? – kawsleo Dec 21 '21 at 09:05

0 Answers0