[Lme4-commits] r1497 - in pkg/lme4Eigen: R src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 7 18:29:59 CET 2012
Author: dmbates
Date: 2012-01-07 18:29:59 +0100 (Sat, 07 Jan 2012)
New Revision: 1497
Modified:
pkg/lme4Eigen/R/AllClass.R
pkg/lme4Eigen/R/lmer.R
pkg/lme4Eigen/src/external.cpp
pkg/lme4Eigen/src/optimizer.h
Log:
Allowed setting options in the NelderMead optimizer. Switched so that this is the default in glmer.
Modified: pkg/lme4Eigen/R/AllClass.R
===================================================================
--- pkg/lme4Eigen/R/AllClass.R 2012-01-07 00:36:31 UTC (rev 1496)
+++ pkg/lme4Eigen/R/AllClass.R 2012-01-07 17:29:59 UTC (rev 1497)
@@ -527,7 +527,8 @@
setFtolAbs = function(fta) .Call(NelderMead_setFtol_abs, ptr(), fta),
setFtolRel = function(ftr) .Call(NelderMead_setFtol_rel, ptr(), ftr),
setMaxeval = function(mxev) .Call(NelderMead_setMaxeval, ptr(), mxev),
- setMinfMax = function(minf) .Call(NelderMead_setMinf_max, ptr(), minf),
+ setMinfMax = function(minf) .Call(NelderMead_setMinf_max, ptr(), minf),
+ setIprint = function(iprint) .Call(NelderMead_setIprint, ptr(), iprint),
value = function() .Call(NelderMead_value, ptr()),
xeval = function() .Call(NelderMead_xeval, ptr()),
xpos = function() .Call(NelderMead_xpos, ptr())
Modified: pkg/lme4Eigen/R/lmer.R
===================================================================
--- pkg/lme4Eigen/R/lmer.R 2012-01-07 00:36:31 UTC (rev 1496)
+++ pkg/lme4Eigen/R/lmer.R 2012-01-07 17:29:59 UTC (rev 1497)
@@ -124,7 +124,7 @@
control = list(), start = NULL, verbose = 0L, nAGQ = 1L,
compDev=TRUE, subset, weights, na.action, offset,
contrasts = NULL, mustart, etastart, devFunOnly = FALSE,
- tolPwrss = 1e-10, optimizer=c("bobyqa","NelderMead"), ...)
+ tolPwrss = 1e-10, optimizer=c("NelderMead","bobyqa"), ...)
{
verbose <- as.integer(verbose)
mf <- mc <- match.call()
@@ -230,8 +230,18 @@
nM <- NelderMead$new(lower=rho$lower, upper=rep.int(Inf, length(rho$lower)), xst=0.2*xst,
x0=with(environment(devfun), c(pp$theta, pp$beta0)),
xt=xst*0.0001)
- nM$setMaxeval(1000L)
- nM$setFtolAbs(1e-5)
+ cc <- do.call(function(iprint=0L, maxfun=10000L, FtolAbs=1e-5,
+ FtolRel=1e-15, XtolRel=1e-7,
+ MinfMax=.Machine$double.xmin) {
+ if (length(list(...))>0) warning("unused control arguments ignored")
+ list(iprint=iprint, maxfun=maxfun, FtolAbs=FtolAbs, FtolRel=FtolRel,
+ XtolRel=XtolRel, MinfMax=MinfMax)
+ }, control)
+ nM$setMaxeval(cc$maxfun)
+ nM$setFtolAbs(cc$FtolAbs)
+ nM$setFtolRel(cc$FtolRel)
+ nM$setMinfMax(cc$MinfMax)
+ nM$setIprint(cc$iprint)
while ((nMres <- nM$newf(devfun(nM$xeval()))) == 0L) {}
if (nMres < 0L) {
if (nMres > -4L)
Modified: pkg/lme4Eigen/src/external.cpp
===================================================================
--- pkg/lme4Eigen/src/external.cpp 2012-01-07 00:36:31 UTC (rev 1496)
+++ pkg/lme4Eigen/src/external.cpp 2012-01-07 17:29:59 UTC (rev 1497)
@@ -690,6 +690,12 @@
END_RCPP;
}
+ SEXP NelderMead_setIprint(SEXP ptr_, SEXP ip_) {
+ BEGIN_RCPP;
+ XPtr<Nelder_Mead>(ptr_)->set_Iprint(::Rf_asInteger(ip_));
+ END_RCPP;
+ }
+
SEXP NelderMead_setMaxeval(SEXP ptr_, SEXP mm_) {
BEGIN_RCPP;
XPtr<Nelder_Mead>(ptr_)->set_Maxeval(::Rf_asInteger(mm_));
@@ -851,6 +857,7 @@
CALLDEF(NelderMead_setForce_stop, 2),
CALLDEF(NelderMead_setFtol_abs, 2),
CALLDEF(NelderMead_setFtol_rel, 2),
+ CALLDEF(NelderMead_setIprint, 2),
CALLDEF(NelderMead_setMaxeval, 2),
CALLDEF(NelderMead_setMinf_max, 2),
CALLDEF(NelderMead_value, 1),
Modified: pkg/lme4Eigen/src/optimizer.h
===================================================================
--- pkg/lme4Eigen/src/optimizer.h 2012-01-07 00:36:31 UTC (rev 1496)
+++ pkg/lme4Eigen/src/optimizer.h 2012-01-07 17:29:59 UTC (rev 1497)
@@ -127,6 +127,7 @@
void setFtol_abs(const Scalar& fta) {d_stop.setFtol_abs(fta);}
void setFtol_rel(const Scalar& ftr) {d_stop.setFtol_rel(ftr);}
void set_Maxeval(const unsigned int& mm) {d_stop.set_Maxeval(mm);}
+ void set_Iprint(const int& ip) {d_verb = ip;}
void setMinf_max(const Scalar& mm) {d_stop.setMinf_max(mm);}
};
More information about the Lme4-commits
mailing list