[Lme4-commits] r1585 - pkg/lme4Eigen/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Feb 9 19:40:00 CET 2012
Author: dmbates
Date: 2012-02-09 19:40:00 +0100 (Thu, 09 Feb 2012)
New Revision: 1585
Added:
pkg/lme4Eigen/man/predict.merMod.Rd
pkg/lme4Eigen/man/simulate.merMod.Rd
Log:
Add new documentation files.
Added: pkg/lme4Eigen/man/predict.merMod.Rd
===================================================================
--- pkg/lme4Eigen/man/predict.merMod.Rd (rev 0)
+++ pkg/lme4Eigen/man/predict.merMod.Rd 2012-02-09 18:40:00 UTC (rev 1585)
@@ -0,0 +1,58 @@
+\name{predict.merMod}
+\alias{predict.merMod}
+\title{Predictions from a model at new data values}
+\usage{
+ \method{predict}{merMod} (object, newdata = NULL,
+ REform = NULL, terms = NULL,
+ type = c("link", "response"), allow.new.levels = FALSE,
+ ...)
+}
+\arguments{
+ \item{object}{a fitted model object}
+
+ \item{newdata}{data frame for which to evaluate
+ predictions}
+
+ \item{REform}{formula for random effects to include. If
+ NULL, include all random effects; if NA, include no
+ random effects}
+
+ \item{terms}{a \code{\link{terms}} object - not used at
+ present}
+
+ \item{type}{character string - either \code{"link"}, the
+ default, or \code{"response"} indicating the type of
+ prediction object returned.}
+
+ \item{allow.new.levels}{(logical) if FALSE, then any new
+ levels detected in \code{newdata} will trigger an error;
+ if TRUE, then the prediction will use the unconditional
+ (population-level) values for data with previously
+ unobserved levels}
+
+ \item{...}{optional additional parameters. None are used
+ at present.}
+}
+\value{
+ a numeric vector of predicted values
+}
+\description{
+ \code{\link{predict}} method for
+ \code{\linkS4class{merMod}} objects
+}
+\note{
+ explain why there is no option for computing standard
+ errors of predictions!
+
+ offsets not yet handled
+}
+\examples{
+(gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 |herd), cbpp, binomial))
+str(p0 <- predict(gm1)) # fitted values
+str(p1 <- predict(gm1,REform=NA)) # fitted values, unconditional (level-0)
+newdata <- with(cbpp, expand.grid(period=unique(period), herd=unique(herd)))
+str(p2 <- predict(gm1,newdata)) # new data, all RE
+str(p3 <- predict(gm1,newdata,REform=NA)) # new data, level-0
+str(p4 <- predict(gm1,newdata,REform=~(1|herd))) # explicitly specify RE
+}
+
Added: pkg/lme4Eigen/man/simulate.merMod.Rd
===================================================================
--- pkg/lme4Eigen/man/simulate.merMod.Rd (rev 0)
+++ pkg/lme4Eigen/man/simulate.merMod.Rd 2012-02-09 18:40:00 UTC (rev 1585)
@@ -0,0 +1,39 @@
+\name{simulate.merMod}
+\alias{simulate.merMod}
+\title{Simulate responses from a \code{\linkS4class{merMod}} object}
+\usage{
+ \method{simulate}{merMod} (object, nsim = 1, seed = NULL,
+ use.u = FALSE, ...)
+}
+\arguments{
+ \item{object}{a fitted model object}
+
+ \item{nsim}{positive integer scalar - the number of
+ responses to simulate}
+
+ \item{seed}{an optional seed to be used in
+ \code{set.seed} immediately before the simulation so as
+ to to generate a reproducible sample.}
+
+ \item{use.u}{(logical) generate new random-effects values
+ (FALSE) or generate a simulation condition on the current
+ random-effects estimates (TRUE)?}
+
+ \item{...}{optional additional arguments, none are used
+ at present}
+}
+\description{
+ Simulate responses from the model represented by a fitted
+ model object
+}
+\examples{
+## test whether fitted models are consistent with the
+## observed number of zeros in CBPP data set:
+gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
+ data = cbpp, family = binomial)
+gg <- simulate(gm1,1000)
+zeros <- sapply(gg,function(x) sum(x[,"incidence"]==0))
+plot(table(zeros))
+abline(v=sum(cbpp$incidence==0),col=2)
+}
+
More information about the Lme4-commits
mailing list