[R-gregmisc-commits] r2060 - in pkg/gmodels: . R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jul 19 05:22:33 CEST 2015
Author: warnes
Date: 2015-07-19 05:22:30 +0200 (Sun, 19 Jul 2015)
New Revision: 2060
Modified:
pkg/gmodels/DESCRIPTION
pkg/gmodels/NAMESPACE
pkg/gmodels/R/ci.R
pkg/gmodels/R/est.mer.R
pkg/gmodels/R/estimable.R
pkg/gmodels/R/fit.contrast.R
pkg/gmodels/R/to.est.R
pkg/gmodels/inst/NEWS
pkg/gmodels/man/ci.Rd
pkg/gmodels/man/estimable.Rd
pkg/gmodels/man/fit.contrast.Rd
Log:
- Removed references to 'mer' objects, sincel the nlme4 update is not backwards compatible with my code.
- Removed 'require' calls.
Modified: pkg/gmodels/DESCRIPTION
===================================================================
--- pkg/gmodels/DESCRIPTION 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/DESCRIPTION 2015-07-19 03:22:30 UTC (rev 2060)
@@ -8,7 +8,7 @@
Program, of the NIH, National Cancer Institute, Center for
Cancer Research under NCI Contract NO1-CO-12400.
Maintainer: Gregory R. Warnes <greg at warnes.net>
-Description: Various R programming tools for model fitting
+Description: Various R programming tools for model fitting.
Depends: R (>= 1.9.0)
Suggests: gplots, gtools, Matrix, nlme, lme4 (>= 0.999999-0)
Imports: MASS, gdata
Modified: pkg/gmodels/NAMESPACE
===================================================================
--- pkg/gmodels/NAMESPACE 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/NAMESPACE 2015-07-19 03:22:30 UTC (rev 2060)
@@ -14,19 +14,19 @@
summary.glh.test
)
-S3method(ci, default)
+S3method(ci, numeric)
S3method(ci, binom)
S3method(ci, lm)
S3method(ci, lme)
-S3method(ci, mer)
+##S3method(ci, mer)
S3method(ci, estimable)
S3method(fit.contrast, lm)
S3method(fit.contrast, lme)
-S3method(fit.contrast, mer)
+##S3method(fit.contrast, mer)
S3method(estimable, default)
-S3method(estimable, mer)
+##S3method(estimable, mer)
S3method(estimable, mlm)
S3method(print, glh.test)
Modified: pkg/gmodels/R/ci.R
===================================================================
--- pkg/gmodels/R/ci.R 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/R/ci.R 2015-07-19 03:22:30 UTC (rev 2060)
@@ -3,7 +3,7 @@
ci <- function(x, confidence=0.95,alpha=1-confidence,...)
UseMethod("ci")
-ci.default <- function(x, confidence=0.95,alpha=1-confidence,na.rm=FALSE,...)
+ci.numeric <- function(x, confidence=0.95,alpha=1-confidence,na.rm=FALSE,...)
{
est <- mean(x, na.rm=na.rm)
stderr <- sd(x, na.rm=na.rm)/sqrt(nobs(x));
@@ -72,31 +72,31 @@
retval
}
-ci.mer <- function (x,
- confidence = 0.95,
- alpha = 1 - confidence,
- n.sim = 1e4,
- ...)
-{
- x.effects <- x at fixef
- n <- length(x.effects)
+## ci.mer <- function (x,
+## confidence = 0.95,
+## alpha = 1 - confidence,
+## n.sim = 1e4,
+## ...)
+## {
+## x.effects <- x at fixef
+## n <- length(x.effects)
- retval <- gmodels:::est.mer(obj = x,
- cm = diag(n),
- beta0 = rep(0, n),
- conf.int = confidence,
- show.beta0 = FALSE,
- n.sim = n.sim)
+## retval <- gmodels::est.mer(obj = x,
+## cm = diag(n),
+## beta0 = rep(0, n),
+## conf.int = confidence,
+## show.beta0 = FALSE,
+## n.sim = n.sim)
- retval <- retval[,
- c("Estimate", "Lower.CI", "Upper.CI", "Std. Error", "p value"),
- drop=FALSE
- ]
- colnames(retval)[c(2:3, 5)] <- c("CI lower", "CI upper", "p-value")
- rownames(retval) <- names(x.effects)
+## retval <- retval[,
+## c("Estimate", "Lower.CI", "Upper.CI", "Std. Error", "p value"),
+## drop=FALSE
+## ]
+## colnames(retval)[c(2:3, 5)] <- c("CI lower", "CI upper", "p-value")
+## rownames(retval) <- names(x.effects)
- retval
-}
+## retval
+## }
ci.estimable <- function(x,confidence=0.95,alpha=1-confidence,...)
Modified: pkg/gmodels/R/est.mer.R
===================================================================
--- pkg/gmodels/R/est.mer.R 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/R/est.mer.R 2015-07-19 03:22:30 UTC (rev 2060)
@@ -6,55 +6,55 @@
# Created April 25, 2006
# Updated 2012-04-19 for S4 version of lmer object
-est.mer <- function(obj, cm, beta0, conf.int, show.beta0, n.sim)
-{
+## est.mer <- function(obj, cm, beta0, conf.int, show.beta0, n.sim)
+## {
- samp <- lme4:::mcmcsamp(obj, n.sim)
- ## samp.summ <- summary(samp)
+## samp <- lme4:::mcmcsamp(obj, n.sim)
+## ## samp.summ <- summary(samp)
- samp.cm <- t(cm %*% samp at fixef)
+## samp.cm <- t(cm %*% samp at fixef)
- # calculate requested statistics
- est <- apply(samp.cm, 2, mean)
- stderr <- apply(samp.cm, 2, sd)
-
- pval <- sapply(1:length(beta0),
- function(i){percentile(beta0[i], samp.cm[,i])})
- pval <- ifelse(pval <= .5, 2*pval, 2*(1-pval))
+## # calculate requested statistics
+## est <- apply(samp.cm, 2, mean)
+## stderr <- apply(samp.cm, 2, sd)
- if(is.null(conf.int))
- {
- lower.ci <- NULL
- upper.ci <- NULL
- }
- else
- {
- alpha <- 1-conf.int
- samp.ci <- sapply(1:length(beta0),
- function(i)
- {
- quantile(samp.cm[,i], probs=c(alpha/2, 1-alpha/2))
- }
- )
+## pval <- sapply(1:length(beta0),
+## function(i){percentile(beta0[i], samp.cm[,i])})
+## pval <- ifelse(pval <= .5, 2*pval, 2*(1-pval))
- lower.ci <- samp.ci[1,]
- upper.ci <- samp.ci[2,]
- }
+## if(is.null(conf.int))
+## {
+## lower.ci <- NULL
+## upper.ci <- NULL
+## }
+## else
+## {
+## alpha <- 1-conf.int
+## samp.ci <- sapply(1:length(beta0),
+## function(i)
+## {
+## quantile(samp.cm[,i], probs=c(alpha/2, 1-alpha/2))
+## }
+## )
- # return results
- if(!show.beta0)
- beta0 <- NULL
-
- samp.stats <- cbind('beta0' = beta0,
- 'Estimate' = est,
- 'Std. Error' = stderr,
- 'p value' = pval,
- 'Lower.CI' = lower.ci,
- 'Upper.CI' = upper.ci)
+## lower.ci <- samp.ci[1,]
+## upper.ci <- samp.ci[2,]
+## }
- row.names(samp.stats) <- paste('(', apply(cm, 1, paste, collapse=" "),
- ')', sep='')
-
- return(samp.stats)
-}
+## # return results
+## if(!show.beta0)
+## beta0 <- NULL
+## samp.stats <- cbind('beta0' = beta0,
+## 'Estimate' = est,
+## 'Std. Error' = stderr,
+## 'p value' = pval,
+## 'Lower.CI' = lower.ci,
+## 'Upper.CI' = upper.ci)
+
+## row.names(samp.stats) <- paste('(', apply(cm, 1, paste, collapse=" "),
+## ')', sep='')
+
+## return(samp.stats)
+## }
+
Modified: pkg/gmodels/R/estimable.R
===================================================================
--- pkg/gmodels/R/estimable.R 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/R/estimable.R 2015-07-19 03:22:30 UTC (rev 2060)
@@ -9,7 +9,7 @@
{
if (is.matrix(cm) || is.data.frame(cm))
{
- cm <- t(apply(cm, 1, .to.est, obj=obj))
+ cm <- t(apply(cm, 1, .to.est, obj=obj))
}
else if(is.list(cm))
{
@@ -140,7 +140,7 @@
dimnames(retval) <- list(rn, c("beta0", "Estimate", "Std. Error",
"t value", "DF", "Pr(>|t|)"))
}
-
+
if (!is.null(conf.int))
{
if (conf.int <=0 || conf.int >=1)
@@ -163,7 +163,7 @@
if(!show.beta0) retval$beta0 <- NULL
class(retval) <- c("estimable", class(retval))
-
+
return(retval)
}
}
@@ -211,74 +211,74 @@
print(as.data.frame(retval))
}
-estimable.mer <- function (obj, cm, beta0, conf.int=NULL, show.beta0,
- sim.mer=TRUE, n.sim=1000, ...)
-{
- if (is.matrix(cm) || is.data.frame(cm))
- {
- cm <- t(apply(cm, 1, .to.est, obj=obj))
- }
- else if(is.list(cm))
- {
- cm <- matrix(.to.est(obj, cm), nrow=1)
- }
- else if(is.vector(cm))
- {
- cm <- matrix(.to.est(obj, cm), nrow=1)
- }
- else
- {
- stop("'cm' argument must be of type vector, list, or matrix.")
- }
+## estimable.mer <- function (obj, cm, beta0, conf.int=NULL, show.beta0,
+## sim.mer=TRUE, n.sim=1000, ...)
+## {
+## if (is.matrix(cm) || is.data.frame(cm))
+## {
+## cm <- t(apply(cm, 1, .to.est, obj=obj))
+## }
+## else if(is.list(cm))
+## {
+## cm <- matrix(.to.est(obj, cm), nrow=1)
+## }
+## else if(is.vector(cm))
+## {
+## cm <- matrix(.to.est(obj, cm), nrow=1)
+## }
+## else
+## {
+## stop("'cm' argument must be of type vector, list, or matrix.")
+## }
- if(missing(show.beta0))
- {
- if(!missing(beta0))
- show.beta0=TRUE
- else
- show.beta0=FALSE
- }
+## if(missing(show.beta0))
+## {
+## if(!missing(beta0))
+## show.beta0=TRUE
+## else
+## show.beta0=FALSE
+## }
- if (missing(beta0))
- {
- beta0 = rep(0, ifelse(is.null(nrow(cm)), 1, nrow(cm)))
+## if (missing(beta0))
+## {
+## beta0 = rep(0, ifelse(is.null(nrow(cm)), 1, nrow(cm)))
- }
+## }
- if ("mer" %in% class(obj)) {
- if(sim.mer)
- return(est.mer(obj=obj, cm=cm, beta0=beta0, conf.int=conf.int,
- show.beta0=show.beta0, n.sim=n.sim))
-
- stat.name <- "mer"
- cf <- as.matrix(fixef(obj))
- vcv <- as.matrix(vcov(obj))
- df <- NA
- }
- else {
- stop("obj is not of class mer")
- }
+## if ("mer" %in% class(obj)) {
+## if(sim.mer)
+## return(est.mer(obj=obj, cm=cm, beta0=beta0, conf.int=conf.int,
+## show.beta0=show.beta0, n.sim=n.sim))
- if (is.null(rownames(cm)))
- rn <- paste("(", apply(cm, 1, paste, collapse=" "),
- ")", sep="")
- else rn <- rownames(cm)
-
- ct <- cm %*% cf[, 1]
- ct.diff <- cm %*% cf[, 1] - beta0
- vc <- sqrt(diag(cm %*% vcv %*% t(cm)))
-
- retval <- cbind(hyp=beta0, est=ct, stderr=vc, "t value"=ct.diff/vc)
- dimnames(retval) <- list(rn, c("beta0", "Estimate", "Std. Error",
- "t value"))
+## stat.name <- "mer"
+## cf <- as.matrix(fixef(obj))
+## vcv <- as.matrix(vcov(obj))
+## df <- NA
+## }
+## else {
+## stop("obj is not of class mer")
+## }
- rownames(retval) <- make.unique(rownames(retval))
- retval <- as.data.frame(retval)
- if(!show.beta0) retval$beta0 <- NULL
+## if (is.null(rownames(cm)))
+## rn <- paste("(", apply(cm, 1, paste, collapse=" "),
+## ")", sep="")
+## else rn <- rownames(cm)
- class(retval) <- c("estimable", class(retval))
+## ct <- cm %*% cf[, 1]
+## ct.diff <- cm %*% cf[, 1] - beta0
+## vc <- sqrt(diag(cm %*% vcv %*% t(cm)))
- return(retval)
+## retval <- cbind(hyp=beta0, est=ct, stderr=vc, "t value"=ct.diff/vc)
+## dimnames(retval) <- list(rn, c("beta0", "Estimate", "Std. Error",
+## "t value"))
-}
+## rownames(retval) <- make.unique(rownames(retval))
+## retval <- as.data.frame(retval)
+## if(!show.beta0) retval$beta0 <- NULL
+
+## class(retval) <- c("estimable", class(retval))
+
+## return(retval)
+
+## }
Modified: pkg/gmodels/R/fit.contrast.R
===================================================================
--- pkg/gmodels/R/fit.contrast.R 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/R/fit.contrast.R 2015-07-19 03:22:30 UTC (rev 2060)
@@ -113,91 +113,90 @@
fit.contrast.lme <- function(model, varname, coeff, showall=FALSE,
conf.int=NULL, df=FALSE, ...)
{
- require(nlme)
fit.contrast.lm(model, varname, coeff, showall, conf.int, df)
}
-# I made rather dramatic changes here and do all calculations in fit.contrast.mer rather than
-# fit.contrast.lm because of the simulation extras ... added sim.mer and n.sim to the parameter list
-fit.contrast.mer <- function(model, varname, coeff, showall=FALSE,
- conf.int=NULL, sim.mer=TRUE, n.sim=1000, ...)
-{
- require(lme4)
+## # I made rather dramatic changes here and do all calculations in fit.contrast.mer rather than
+## # fit.contrast.lm because of the simulation extras ... added sim.mer and n.sim to the parameter list
+## fit.contrast.mer <- function(model, varname, coeff, showall=FALSE,
+## conf.int=NULL, sim.mer=TRUE, n.sim=1000, ...)
+## {
+## require(lme4)
- # make sure we have the NAME of the variable
- if(!is.character(varname))
- varname <- deparse(substitute(varname))
+## # make sure we have the NAME of the variable
+## if(!is.character(varname))
+## varname <- deparse(substitute(varname))
- # make coeff into a matrix
- if(!is.matrix(coeff))
- {
- coeff <- matrix(coeff, nrow=1)
- }
+## # make coeff into a matrix
+## if(!is.matrix(coeff))
+## {
+## coeff <- matrix(coeff, nrow=1)
+## }
- # make sure columns are labeled
- if (is.null(rownames(coeff)))
- {
- rn <- vector(length=nrow(coeff))
- for(i in 1:nrow(coeff))
- rn[i] <- paste(" c=(",paste(coeff[i,],collapse=" "), ")")
- rownames(coeff) <- rn
- }
+## # make sure columns are labeled
+## if (is.null(rownames(coeff)))
+## {
+## rn <- vector(length=nrow(coeff))
+## for(i in 1:nrow(coeff))
+## rn[i] <- paste(" c=(",paste(coeff[i,],collapse=" "), ")")
+## rownames(coeff) <- rn
+## }
- # now convert into the proper form for the contrast matrix
- cmat <- make.contrasts(coeff, ncol(coeff) )
- cn <- paste(" C",1:ncol(cmat),sep="")
- cn[1:nrow(coeff)] <- rownames(coeff)
- colnames(cmat) <- cn
+## # now convert into the proper form for the contrast matrix
+## cmat <- make.contrasts(coeff, ncol(coeff) )
+## cn <- paste(" C",1:ncol(cmat),sep="")
+## cn[1:nrow(coeff)] <- rownames(coeff)
+## colnames(cmat) <- cn
- m <- model at call
+## m <- model at call
- if(is.null(m$contrasts))
- m$contrasts <- list()
- m$contrasts[[varname]] <- cmat
+## if(is.null(m$contrasts))
+## m$contrasts <- list()
+## m$contrasts[[varname]] <- cmat
- if(is.R())
- r <- eval(m, parent.frame())
- else
- r <- eval(m)
- # now return the correct elements ....
- r.effects <- fixef(r)
- n <- length(r.effects)
+## if(is.R())
+## r <- eval(m, parent.frame())
+## else
+## r <- eval(m)
+## # now return the correct elements ....
+## r.effects <- fixef(r)
+## n <- length(r.effects)
- if(sim.mer)
- {
- retval <- est.mer(obj = r, cm = diag(n), beta0 = rep(0, n),
- conf.int = conf.int, show.beta0 = FALSE,
- n.sim=n.sim)
- rownames(retval) <- names(r.effects)
- }else{
- if(!is.null(conf.int))
- warning("Confidence interval calculation for mer objects requires simulation -- use sim.mer = TRUE")
+## if(sim.mer)
+## {
+## retval <- est.mer(obj = r, cm = diag(n), beta0 = rep(0, n),
+## conf.int = conf.int, show.beta0 = FALSE,
+## n.sim=n.sim)
+## rownames(retval) <- names(r.effects)
+## }else{
+## if(!is.null(conf.int))
+## warning("Confidence interval calculation for mer objects requires simulation -- use sim.mer = TRUE")
- est <- fixef(r)
- se <- sqrt(diag(as.matrix(vcov(r))))
- tval <- est/se
- retval <- cbind(
- "Estimate"= est,
- "Std. Error"= se,
- "t-value"= tval
- )
- }
+## est <- fixef(r)
+## se <- sqrt(diag(as.matrix(vcov(r))))
+## tval <- est/se
+## retval <- cbind(
+## "Estimate"= est,
+## "Std. Error"= se,
+## "t-value"= tval
+## )
+## }
- if( !showall )
- {
- if( !is.R() && ncol(cmat)==1 )
- {
- retval <- retval[varname,,drop=FALSE]
- rownames(retval) <- rn
- }else{
- rn <- paste(varname,rownames(coeff),sep="")
- ind <- match(rn,rownames(retval))
- retval <- retval[ind,,drop=FALSE]
- }
- }
+## if( !showall )
+## {
+## if( !is.R() && ncol(cmat)==1 )
+## {
+## retval <- retval[varname,,drop=FALSE]
+## rownames(retval) <- rn
+## }else{
+## rn <- paste(varname,rownames(coeff),sep="")
+## ind <- match(rn,rownames(retval))
+## retval <- retval[ind,,drop=FALSE]
+## }
+## }
- return(retval)
-}
+## return(retval)
+## }
fit.contrast <- function(model, varname, coeff, ...)
Modified: pkg/gmodels/R/to.est.R
===================================================================
--- pkg/gmodels/R/to.est.R 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/R/to.est.R 2015-07-19 03:22:30 UTC (rev 2060)
@@ -5,12 +5,13 @@
.to.est <- function(obj, params)
{
- if('lme' %in% class(obj) | 'mer' %in% class(obj))
+ ## if('lme' %in% class(obj) | 'mer' %in% class(obj))
+ ## {
+ ## eff.obj <- fixef(obj)
+ ## }
+ ## else
+ if('geese' %in% class(obj))
{
- eff.obj <- fixef(obj)
- }
- else if('geese' %in% class(obj))
- {
eff.obj <- obj$beta
}
else
@@ -45,10 +46,10 @@
)
}
- if(is.list(params))
- est[names(params)] <- unlist(params)
- else
- est[names(params)] <- params
+ if(is.list(params))
+ est[names(params)] <- unlist(params)
+ else
+ est[names(params)] <- params
}
return(est)
Modified: pkg/gmodels/inst/NEWS
===================================================================
--- pkg/gmodels/inst/NEWS 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/inst/NEWS 2015-07-19 03:22:30 UTC (rev 2060)
@@ -8,7 +8,11 @@
interval, which is *conservative* due to the discrete nature of the
binomial distribution.
+Other Changes:
+- Support for lme4 objects has been removed due to incompatible
+ changes to the lme4 package.
+
Version 2.16.0 - 2014-07-24
---------------------------
Modified: pkg/gmodels/man/ci.Rd
===================================================================
--- pkg/gmodels/man/ci.Rd 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/man/ci.Rd 2015-07-19 03:22:30 UTC (rev 2060)
@@ -2,25 +2,27 @@
%
\name{ci}
\alias{ci}
-\alias{ci.default}
+\alias{ci.numeric}
\alias{ci.binom}
\alias{ci.lm}
\alias{ci.lme}
-\alias{ci.mer}
+%\alias{ci.mer}
\alias{ci.estimable}
\title{Compute Confidence Intervals}
\description{ Compute and display confidence intervals for model
estimates. Methods are provided for the mean of a numeric vector
\code{ci.default}, the probability of a binomial vector
- \code{ci.binom}, and for \code{lm}, \code{lme}, and \code{mer} objects are
+ \code{ci.binom}, and for \code{lm}, and \code{lme}
+ %, and \code{mer}
+ objects are
provided. }
\usage{
ci(x, confidence=0.95, alpha=1 - confidence, ...)
- \method{ci}{default}(x, confidence=0.95, alpha=1-confidence, na.rm=FALSE, ...)
+ \method{ci}{numeric}(x, confidence=0.95, alpha=1-confidence, na.rm=FALSE, ...)
\method{ci}{binom}(x, confidence=0.95, alpha=1-confidence, ...)
\method{ci}{lm}(x, confidence=0.95, alpha=1-confidence, ...)
\method{ci}{lme}(x, confidence=0.95, alpha=1-confidence, ...)
- \method{ci}{mer}(x, confidence=0.95, alpha=1-confidence, n.sim=10000, ...)
+ %\method{ci}{mer}(x, confidence=0.95, alpha=1-confidence, n.sim=10000, ...)
\method{ci}{estimable}(x, confidence=0.95, alpha=1-confidence, ...)
}
\arguments{
@@ -30,7 +32,7 @@
\item{na.rm}{boolean indicating whether missing values should be
removed. Defaults to \code{FALSE}.}
\item{\dots}{Arguments for methods}
- \item{n.sim}{Number of samples to take in \code{mcmcsamp}.}
+% \item{n.sim}{Number of samples to take in \code{mcmcsamp}.}
}
\details{
\code{ci.binom} computes binomial confidence intervals using the
@@ -67,13 +69,13 @@
reg <- lm(Area ~ Population, data=as.data.frame(state.x77))
ci(reg)
-%\dontrun{
# mer example
-library(lme4)
-fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)
+library(nlme)
+Orthodont$AgeGroup <- gtools::quantcut(Orthodont$age)
+fm2 <- lme(distance ~ Sex + AgeGroup, data = Orthodont,random=~1|Subject)
ci(fm2)
-%}
+
}
\keyword{ regression }
Modified: pkg/gmodels/man/estimable.Rd
===================================================================
--- pkg/gmodels/man/estimable.Rd 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/man/estimable.Rd 2015-07-19 03:22:30 UTC (rev 2060)
@@ -3,27 +3,29 @@
\name{estimable}
\alias{estimable}
\alias{estimable.default}
-\alias{estimable.mer}
+%\alias{estimable.mer}
\alias{estimable.mlm}
%\alias{.wald}
%\alias{.to.est}
\title{Contrasts and estimable linear functions of model coefficients}
\description{
Compute and test contrasts and other estimable linear
- functions of model coefficients for for lm, glm, lme, mer, and geese
- objects
+ functions of model coefficients for for lm, glm, lme, %mer,
+ and geese objects
}
\usage{
estimable(obj, cm, beta0, conf.int=NULL, show.beta0, ...)
\method{estimable}{default} (obj, cm, beta0, conf.int=NULL, show.beta0, joint.test=FALSE, ...)
-\method{estimable}{mer}(obj, cm, beta0, conf.int=NULL,
- show.beta0, sim.mer=TRUE, n.sim=1000, ...)
+%\method{estimable}{mer}(obj, cm, beta0, conf.int=NULL,
+% show.beta0, sim.mer=TRUE, n.sim=1000, ...)
\method{estimable}{mlm}(obj, cm, beta0, conf.int=NULL, show.beta0, ...)
%.wald(obj, cm,beta0=rep(0, ifelse(is.null(nrow(cm)), 1, nrow(cm))))
%.to.est(obj, params)
}
\arguments{
- \item{obj}{Regression (lm, glm, lme, mer, mlm) object. }
+ \item{obj}{Regression (lm, glm, lme,
+ %mer,
+ mlm) object. }
\item{cm}{Vector, List, or Matrix specifying estimable linear functions or
contrasts. See below for details.}
\item{beta0}{Vector of null hypothesis values}
@@ -37,12 +39,12 @@
\item{show.beta0}{Logical value. If TRUE a column for beta0 will be
included in the output table. Defaults to TRUE when beta0 is
specified, FALSE otherwise.}
- \item{sim.mer}{Logical value. If TRUE p-values and confidence
- intervals will be estimated using \code{mcmcsamp}.
- }
- \item{n.sim}{Number of MCMC samples to take in
- \code{mcmcsamp}.
- }
+ %% \item{sim.mer}{Logical value. If TRUE p-values and confidence
+ %% intervals will be estimated using \code{mcmcsamp}.
+ %% }
+ %% \item{n.sim}{Number of MCMC samples to take in
+ %% \code{mcmcsamp}.
+ %% }
\item{...}{ignored}
}
\details{
@@ -61,12 +63,12 @@
subset of) the model parameters, and each row should contain the
corresponding coefficient to be applied. Model parameters which are
not present in the set of column names of \code{cm} will be set to zero.
-
+
The estimates and their variances are obtained by applying the
contrast matrix (generated from) \code{cm} to the model estimates
variance-covariance matrix. Degrees of freedom are obtained from the
appropriate model terms.
-
+
The user is responsible for ensuring that the specified
linear functions are meaningful.
@@ -91,10 +93,10 @@
the beta0 value (optional, see \code{show.beta0} above), estimated
coefficients, standard errors, t values, degrees of freedom, two-sided
p-values, and the lower and upper endpoints of the
- 1-alpha confidence intervals.
+ 1-alpha confidence intervals.
}
\author{
- BXC (Bendix Carstensen) \email{bxc\@novonordisk.com},
+ BXC (Bendix Carstensen) \email{bxc\@novonordisk.com},
Gregory R. Warnes \email{greg at warnes.net},
Soren Hojsgaard \email{sorenh at agrsci.dk}, and
Randall C Johnson \email{rjohnson at ncifcrf.gov}
@@ -142,11 +144,11 @@
# Sepal.Width by Species interaction terms.
data(iris)
lm1 <- lm (Sepal.Length ~ Sepal.Width + Species + Sepal.Width:Species, data=iris)
-glm1 <- glm(Sepal.Length ~ Sepal.Width + Species + Sepal.Width:Species, data=iris,
+glm1 <- glm(Sepal.Length ~ Sepal.Width + Species + Sepal.Width:Species, data=iris,
family=quasipoisson("identity"))
cm <- rbind(
- 'Setosa vs. Versicolor' = c(0, 0, 1, 0, 1, 0),
+ 'Setosa vs. Versicolor' = c(0, 0, 1, 0, 1, 0),
'Setosa vs. Virginica' = c(0, 0, 0, 1, 0, 1),
'Versicolor vs. Virginica'= c(0, 0, 1,-1, 1,-1)
)
Modified: pkg/gmodels/man/fit.contrast.Rd
===================================================================
--- pkg/gmodels/man/fit.contrast.Rd 2015-07-19 02:34:45 UTC (rev 2059)
+++ pkg/gmodels/man/fit.contrast.Rd 2015-07-19 03:22:30 UTC (rev 2060)
@@ -4,7 +4,7 @@
\alias{fit.contrast}
\alias{fit.contrast.lm}
\alias{fit.contrast.lme}
-\alias{fit.contrast.mer}
+%\alias{fit.contrast.mer}
\title{Compute and test arbitrary contrasts for regression objects}
\description{
Compute and test arbitrary contrasts for regression objects.
@@ -15,12 +15,12 @@
conf.int=NULL, df=FALSE, ...)
\method{fit.contrast}{lme}(model, varname, coeff, showall=FALSE,
conf.int=NULL, df=FALSE, ...)
-\method{fit.contrast}{mer}(model, varname, coeff, showall=FALSE,
- conf.int=NULL, sim.mer = TRUE, n.sim = 1000, ...)
+%\method{fit.contrast}{mer}(model, varname, coeff, showall=FALSE,
+% conf.int=NULL, sim.mer = TRUE, n.sim = 1000, ...)
}
\arguments{
\item{model}{regression (lm,glm,aov,lme) object for which the
- contrast(s) will be computed.}
+ contrast(s) will be computed.}
\item{varname}{variable name}
\item{coeff}{vector or matrix specifying contrasts (one per row).}
\item{showall}{return all regression coefficients. If \code{TRUE}, all
@@ -34,12 +34,12 @@
\item{df}{boolean indicating whether to return a column containing the
degrees of freedom.}
\item{\dots}{optional arguments provided by methods.}
- \item{sim.mer}{Logical value. If TRUE p-values and confidence
- intervals will be estimated using \code{mcmcsamp}. This option only takes effect for mer
- objects.}
- \item{n.sim}{Number of samples to use in \code{mcmcsamp}.}
+% \item{sim.mer}{Logical value. If TRUE p-values and confidence
+% intervals will be estimated using \code{mcmcsamp}. This option only takes effect for mer
+% objects.}
+% \item{n.sim}{Number of samples to use in \code{mcmcsamp}.}
}
-
+
\details{
Computes the specified contrast(s) by re-fitting the model with the
appropriate arguments. A contrast of the form \code{c(1,0,0,-1)}
@@ -51,7 +51,7 @@
containing the degrees of freedom is included. If \code{conf.int} is
specified lower and upper confidence limits are also returned.}
\references{Venables & Ripley, Section 6.2}
-
+
\author{ Gregory R. Warnes \email{greg at warnes.net}}
\seealso{ \code{\link{lm}}, \code{\link{contrasts}},
@@ -83,7 +83,7 @@
sum(-1/2*gm[1], -1/2*gm[2], 1/2*gm[3], 1/2*gm[4])
# mean of 1st group vs mean of 2nd, 3rd and 4th groups
-fit.contrast(reg, x, c( -3/3, 1/3, 1/3, 1/3) )
+fit.contrast(reg, x, c( -3/3, 1/3, 1/3, 1/3) )
# estimate should be equal to:
sum(-3/3*gm[1], 1/3*gm[2], 1/3*gm[3], 1/3*gm[4])
@@ -138,10 +138,10 @@
"2 vs 3" = 2 ) ) )
-# example for lme
+# example for lme
library(nlme)
data(Orthodont)
-fm1 <- lme(distance ~ Sex, data = Orthodont,random=~1|Subject)
+fm1 <- lme(distance ~ Sex, data = Orthodont,random=~1|Subject)
# Contrast for sex. This example is equivalent to standard treatment
# contrast.
More information about the R-gregmisc-commits
mailing list