[Lme4-commits] r1617 - in pkg/lme4Eigen: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Feb 24 16:31:05 CET 2012
Author: dmbates
Date: 2012-02-24 16:31:05 +0100 (Fri, 24 Feb 2012)
New Revision: 1617
Added:
pkg/lme4Eigen/man/bootMer2.Rd
Modified:
pkg/lme4Eigen/DESCRIPTION
pkg/lme4Eigen/NAMESPACE
pkg/lme4Eigen/R/bootMer.R
pkg/lme4Eigen/R/lmer.R
pkg/lme4Eigen/R/nbinom.R
pkg/lme4Eigen/do-roxy
Log:
Some cleanup. Added packages used in tests to the Suggests: list
Modified: pkg/lme4Eigen/DESCRIPTION
===================================================================
--- pkg/lme4Eigen/DESCRIPTION 2012-02-24 11:43:24 UTC (rev 1616)
+++ pkg/lme4Eigen/DESCRIPTION 2012-02-24 15:31:05 UTC (rev 1617)
@@ -18,6 +18,7 @@
stats
LinkingTo: Rcpp, RcppEigen
Imports:
+ MASS,
Matrix(>= 1.0),
graphics,
grid,
@@ -25,12 +26,15 @@
nlme,
splines
Suggests:
+ MEMSS,
PKPDmodels,
- MASS,
- MEMSS,
- testthat,
boot,
- mlmRev
+ ggplot2,
+ glmmADMB,
+ mlmRev,
+ plyr,
+ reshape,
+ testthat
LazyLoad: yes
LazyData: yes
License: GPL (>=2)
Modified: pkg/lme4Eigen/NAMESPACE
===================================================================
--- pkg/lme4Eigen/NAMESPACE 2012-02-24 11:43:24 UTC (rev 1616)
+++ pkg/lme4Eigen/NAMESPACE 2012-02-24 15:31:05 UTC (rev 1617)
@@ -12,6 +12,7 @@
export(getME)
export(GHrule)
export(glmer)
+export(glmer.nb)
export(glmFamily)
export(glmResp)
export(golden)
@@ -83,6 +84,7 @@
importFrom(stats,terms)
importFrom(stats,update)
importFrom(stats,vcov)
+importFrom(stats,weights)
importMethodsFrom(Matrix,"%*%")
importMethodsFrom(Matrix,coerce)
importMethodsFrom(Matrix,crossprod)
Modified: pkg/lme4Eigen/R/bootMer.R
===================================================================
--- pkg/lme4Eigen/R/bootMer.R 2012-02-24 11:43:24 UTC (rev 1616)
+++ pkg/lme4Eigen/R/bootMer.R 2012-02-24 15:31:05 UTC (rev 1617)
@@ -40,9 +40,15 @@
##' @param use.u logical, indicating, if the spherized random effects should be
##' simulated / bootstrapped as well. If \code{FALSE}, they are not changed,
##' and all inference is conditional on these.
+##' @param type character string specifying the type of bootstrap,
+##' \code{"parametric"} or \code{"semiparametric"}. Default is
+##' \code{"parametric"}. Partial matching is allowed.
##' @param verbose logical indicating if progress should print output
##' @param control an optional \code{\link{list}}, to be passed to the minimizer
##' (of the log-likelihood, or RE likelihood).
+##' @param .progress character string - type of progress bar to
+##' display. Default is \code{"none"}.
+##' @param PBargs a list of additional arguments to the progress bar function.
##' @return an object of S3 \code{\link{class}} \code{"boot"}, compatible with
##' \pkg{boot} package's \code{boot()} result.
##' @seealso For inference, including confidence intervals,
Modified: pkg/lme4Eigen/R/lmer.R
===================================================================
--- pkg/lme4Eigen/R/lmer.R 2012-02-24 11:43:24 UTC (rev 1616)
+++ pkg/lme4Eigen/R/lmer.R 2012-02-24 15:31:05 UTC (rev 1617)
@@ -1998,6 +1998,7 @@
eval(mc)
}
+##' @importFrom stats weights
##' @S3method weights merMod
weights.merMod <- function(object, ...) {
object at resp$weights
Modified: pkg/lme4Eigen/R/nbinom.R
===================================================================
--- pkg/lme4Eigen/R/nbinom.R 2012-02-24 11:43:24 UTC (rev 1616)
+++ pkg/lme4Eigen/R/nbinom.R 2012-02-24 15:31:05 UTC (rev 1617)
@@ -1,6 +1,5 @@
##' @importFrom MASS negative.binomial
##' @importFrom MASS theta.ml
-##require(MASS)
## should be getME(object,"NBdisp") ?
getNBdisp <- function(object) {
@@ -62,6 +61,7 @@
}
## wrapper for glmer stuff
+##' @export
glmer.nb <- function(...,
interval=NULL,
debug=FALSE) {
Modified: pkg/lme4Eigen/do-roxy
===================================================================
--- pkg/lme4Eigen/do-roxy 2012-02-24 11:43:24 UTC (rev 1616)
+++ pkg/lme4Eigen/do-roxy 2012-02-24 15:31:05 UTC (rev 1617)
@@ -3,6 +3,7 @@
pkg <- "lme4Eigen"
pDIR <- switch((U <- Sys.getenv("USER")),
"maechler" = "~/R/Pkgs",
+ "bates" = "~/sloc",
## default:
{ p <- "/tmp"
warning("unknown USER ", U,". -- using pDIR=",p,
@@ -12,7 +13,7 @@
pkgPATH <- file.path(pDIR, pkg)
#
library(roxygen2)
-if(TRUE) {
+if(FALSE) {
roxygenize(pkgPATH, roclets = c("collate", "namespace"))## *NOT* using "rd"
} else {
roxygenize(pkgPATH)## <-- also recreates *.Rd files
Added: pkg/lme4Eigen/man/bootMer2.Rd
===================================================================
--- pkg/lme4Eigen/man/bootMer2.Rd (rev 0)
+++ pkg/lme4Eigen/man/bootMer2.Rd 2012-02-24 15:31:05 UTC (rev 1617)
@@ -0,0 +1,115 @@
+\name{bootMer2}
+\alias{bootMer2}
+\title{Model-based (Semi-)Parametric Bootstrap for Mixed Models}
+\usage{
+ bootMer2(x, FUN, nsim = 1, seed = NULL, use.u = FALSE,
+ type = c("parametric", "semiparametric"),
+ verbose = FALSE, control = list(), .progress = "none",
+ PBargs = list())
+}
+\arguments{
+ \item{x}{fitted \code{*lmer()} model, see
+ \code{\link{lmer}}, \code{\link{glmer}}, etc.}
+
+ \item{FUN}{a \code{\link{function}(x)}, computating the
+ \emph{statistic} of interest, which must be a numeric
+ vector, possibly named.}
+
+ \item{nsim}{number of simulations, positive integer; the
+ bootstrap \eqn{B} (or \eqn{R}).}
+
+ \item{seed}{optional argument to \code{\link{set.seed}}.}
+
+ \item{use.u}{logical, indicating, if the spherized random
+ effects should be simulated / bootstrapped as well. If
+ \code{FALSE}, they are not changed, and all inference is
+ conditional on these.}
+
+ \item{type}{character string specifying the type of
+ bootstrap, \code{"parametric"} or
+ \code{"semiparametric"}. Default is \code{"parametric"}.
+ Partial matching is allowed.}
+
+ \item{verbose}{logical indicating if progress should
+ print output}
+
+ \item{control}{an optional \code{\link{list}}, to be
+ passed to the minimizer (of the log-likelihood, or RE
+ likelihood).}
+
+ \item{.progress}{character string - type of progress bar
+ to display. Default is \code{"none"}.}
+
+ \item{PBargs}{a list of additional arguments to the
+ progress bar function.}
+}
+\value{
+ an object of S3 \code{\link{class}} \code{"boot"},
+ compatible with \pkg{boot} package's \code{boot()}
+ result.
+}
+\description{
+ Perform model-based (Semi-)parametric bootstrap for mixed
+ models.
+}
+\details{
+ The semi-parametric variant is not yet implemented, and
+ we only provide a method for \code{\link{lmer}} and
+ \code{\link{glmer}} results.
+
+ The working name for bootMer() was
+ \dQuote{simulestimate()}, as it is an extension of
+ \code{\link{simulate}}, but we rather want to emphasize
+ its potential for valid inference.
+
+ In each of the \code{nsim} simulations --- that is what
+ the \emph{parametric} bootstrap does, both
+ \dQuote{\emph{spherized}} random effects \eqn{u} and the
+ i.i.d errors \eqn{\epsilon} are generated, using
+ \code{\link{rnorm}()} with parameters corresponding to
+ the fitted model \code{x}.
+}
+\examples{
+fm01ML <- lmer(Yield ~ 1|Batch, Dyestuff, REML = FALSE)
+## see ?"profile-methods"
+mySumm <- function(.) { s <- sigma(.)
+ c(beta =getME(., "beta"), sigma = s, sig01 = s * getME(., "theta")) }
+(t0 <- mySumm(fm01ML)) # just three parameters
+
+\dontrun{\%\%--- fails for now --- FIXME
+
+## 3.8s (on a 5600 MIPS 64bit fast(year 2009) desktop "AMD Phenom(tm) II X4 925"):
+system.time( boo01 <- bootMer(fm01ML, mySumm, nsim = 100) )
+
+## to "look" at it
+if(need.boot <- is.na(match("package:boot", search())))
+ require("boot")## is a recommended package, i.e. *must* be there
+boo01 # look at estimated bias for sig01 (-9.1, also when nsim = 1000)
+
+## ------ Bootstrap-based confidence intervals ------------
+
+(bCI.1 <- boot.ci(boo01, index=1, type=c("norm", "basic", "perc")))# beta
+
+## Sigma - original scale, and interval calculation on log-scale:
+(bCI.2 <- boot.ci(boo01, index=2, type=c("norm", "basic", "perc")))
+(bCI.2l <- boot.ci(boo01, index=2, type=c("norm", "basic", "perc"),
+ h = log, hdot = function(.) 1/., hinv = exp))
+
+(bCI.3 <- boot.ci(boo01, index=3, type=c("norm", "basic", "perc")))# sig01
+}
+}
+\references{
+ Davison, A.C. and Hinkley, D.V. (1997) \emph{Bootstrap
+ Methods and Their Application}. Cambridge University
+ Press.
+}
+\seealso{
+ For inference, including confidence intervals,
+ \code{\link{profile-methods}}.
+
+ \code{\link[boot]{boot}()}, and then
+ \code{\link[boot]{boot.ci}} from package \pkg{boot}.
+}
+\keyword{htest}
+\keyword{models}
+
More information about the Lme4-commits
mailing list