0
$\begingroup$

I need to create a linear mixed model in R but parameter estimates have to be non negative. (beta1 and beta2 and beta3 > 0)The model is:

VOLUME SALES = beta1 * morning + beta2 * afternoon + beta3 * evening + (1|Brand)

being Brand the random effect.

I have been using lmer package:

model <- lmer(Volume ~ morning + afternoon + evening + (1 | Brand), data=df) 
summary(model)

This works very well, but fixed effects estimates (beta1, beta2 and beta3) can be both negative or positive. I need them to be always positive. Because we assume there is no way something can diminish volume sales.

Do you know a way to "control" the linear mixed model by adding constrains in which beta>0?

$\endgroup$

1 Answer 1

1
$\begingroup$

As stated here, this is probably a bad idea to "force" coefficients to have a positive value. A negative one could indicate problems in the data (outliers, noise, pseudo-replication ...), missing covariates, non-linear relationships, ect.

However, in a Bayesian framework, you can use your knowledge on the subject as priors. In your case, you could use priors that put a lot of weight on the positive values of the coefficient. This would be an informative prior and must be justified. brms could be a good pick because priors are easy to specify and the syntax is the same as in lme4.

If you really want to do it, it seems to exist some methods/packages in R (see this discussion), but I would not recommend it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.