[Lme4-commits] r1614 - pkg/lme4Eigen/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 23 20:30:31 CET 2012


Author: dmbates
Date: 2012-02-23 20:30:31 +0100 (Thu, 23 Feb 2012)
New Revision: 1614

Modified:
   pkg/lme4Eigen/R/nbinom.R
Log:
Use importFrom rather than requiring the whole MASS package


Modified: pkg/lme4Eigen/R/nbinom.R
===================================================================
--- pkg/lme4Eigen/R/nbinom.R	2012-02-23 18:39:03 UTC (rev 1613)
+++ pkg/lme4Eigen/R/nbinom.R	2012-02-23 19:30:31 UTC (rev 1614)
@@ -1,4 +1,6 @@
-require(MASS)
+##' @importFrom MASS negative.binomial
+##' @importFrom MASS theta.ml
+##require(MASS)
 
 ## should be getME(object,"NBdisp") ?
 getNBdisp <- function(object) { 
@@ -23,6 +25,7 @@
   object <- setNBdisp(object,theta)  ## new/copied object
   refit(object,newresp=model.response(model.frame(object)))
   ## FIXME: should refit() take this response as a default??
+  ## Yes, I think that is a good idea.  DB 2012-02-23
 }
 
 optTheta <- function(object,
@@ -33,6 +36,8 @@
   evalcnt <- 0
   optval <- optimize(function(t) {
     ## FIXME: kluge to retain last value and evaluation count
+      ## Perhaps use a reference class object to keep track of this
+      ## auxilliary information?  DB
     L <- -logLik(lastfit <<- refitNB(lastfit,theta=exp(t)))
     evalcnt <<- evalcnt+1
     if (debug) {
@@ -70,4 +75,4 @@
 ## do we want to facilitate profiling on theta??
 ## save evaluations used in optimize() fit?
 ## ('memoise'?)
-
+## Again, I think that a reference class object would be a better approach.



More information about the Lme4-commits mailing list