[R-sig-ME] lower and upper bounds for optimizer="nloptwrap"

Andras Farkas motyoc@k@ @end|ng |rom y@hoo@com
Thu Apr 7 20:05:53 CEST 2022


thanks. my actual model is based on some biological process/es where a negative value (or at times a value outside of a particular range) would not make sense, if estimated... I have done the model run with brms in the past which made this easi(er), but I also wanted to see if I can take advantage of automated model selection procedures available in R (have "way too many potential predictors"), so switched to frequentist approach to try to make it work with glmulti as I am far from being an R coding expert and there are enough available resources on the web that I have found helpful to set up the glmulti run with lmer... But I guess I may be stuck with bayesian it seems if I must box them in?

thanks for the help


On Thursday, April 7, 2022, 01:35:41 PM EDT, Phillip Alday <me using phillipalday.com> wrote: 

lme4 uses the profiled log likelihood -- for linear mixed models, the
maximum-likelihood estimates of the fixed effects can be computed
directly for a given value of the random effects. Because of this, the
optimization bounds are for the random effects (or more precisely, the
lower Cholesky factor of the scaled random effects) and only serve to
restrict them to possible values (positive variances and correlations in
[-1, +1]).

In other words, you can't constrain the fixed effects in lme4.

Is there an inferential reason why you want to constrain the fixed effects?

On 7/4/22 12:18 pm, Andras Farkas via R-sig-mixed-models wrote:
> Hello,
> wonder if I could get some help on how to specify lower and upper bounds for optimizer="nloptwrap". To date my approach looks like:
> lmercontrollist<-lmerControl(optimizer = "nloptwrap",
>                              restart_edge = TRUE,
>                              boundary.tol = 1e-5,
>                              calc.derivs = TRUE,
>                              use.last.params = FALSE,
>                              sparseX = FALSE,
>                              standardize.X = FALSE,
>                              ## input checking options
>                              check.nobs.vs.rankZ = "ignore",
>                              check.nobs.vs.nlev = "stop",
>                              check.nlev.gtreq.5 = "ignore",
>                              check.nlev.gtr.1 = "stop",
>                              check.nobs.vs.nRE= "stop",
>                              check.rankX = c("message+drop.cols", "silent.drop.cols", "warn+drop.cols",
>                                              "stop.deficient", "ignore"),
>                              check.scaleX = c("warning","stop","silent.rescale",
>                                               "message+rescale","warn+rescale","ignore"),
>                              check.formula.LHS = "stop",
>                              ## convergence checking options
>                              check.conv.grad     = .makeCC("warning", tol = 2e-3, relTol = NULL),
>                              check.conv.singular = .makeCC(action = "message", tol = formals(isSingular)$tol),
>                              check.conv.hess     = .makeCC(action = "warning", tol = 1e-6),
>                              ## optimizer args
>                              optCtrl = list(maxeval=100,lower = rep.int(0, 21),upper = rep.int(5, 21)),
>                              mod.type = "lmer")
> let us ignore model appropriateness here and just focus on the constraints: 
> m1 <- lmer(Reaction ~ Days + Subject+ (1|Days),data=sleepstudy,verbose=1,control =lmercontrollist)
> summary(m1)
>  as you will see the fixed effect values are negative. I also tried lb and ub instead of lower and upper based on nloptr function, but also did not help. Besides, just to be sure I understand correctly, the length of the lower/upper bounds must be the same as the length of fixed and random effect, correct? here I set to 21 based on output but am not exactly sure if the residual has to be included in the count or not...
> much appreciate your help,
> Andras 

> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


More information about the R-sig-mixed-models mailing list