[R-gregmisc-users] SF.net SVN: r-gregmisc:[1868] trunk/gmodels
Brought to you by:
warnes
From: <wa...@us...> - 2014-07-24 15:14:33
|
Revision: 1868 http://sourceforge.net/p/r-gregmisc/code/1868 Author: warnes Date: 2014-07-24 15:14:30 +0000 (Thu, 24 Jul 2014) Log Message: ----------- - Estimable now adds the class 'estimable' to returned objects. - New ci() method for estimable objects. - Minor improvemets to man page formatting. Modified Paths: -------------- trunk/gmodels/DESCRIPTION trunk/gmodels/NAMESPACE trunk/gmodels/R/ci.R trunk/gmodels/R/estimable.R trunk/gmodels/man/ci.Rd trunk/gmodels/man/estimable.Rd Modified: trunk/gmodels/DESCRIPTION =================================================================== --- trunk/gmodels/DESCRIPTION 2014-07-22 15:07:54 UTC (rev 1867) +++ trunk/gmodels/DESCRIPTION 2014-07-24 15:14:30 UTC (rev 1868) @@ -1,6 +1,6 @@ Package: gmodels -Version: 2.15.5 -Date: 2013-07-18 +Version: 2.16.0 +Date: 2014-07-24 Title: Various R programming tools for model fitting Author: Gregory R. Warnes, Ben Bolker, Thomas Lumley, and Randall C Johnson. Contributions from Randall C. Johnson are Copyright Modified: trunk/gmodels/NAMESPACE =================================================================== --- trunk/gmodels/NAMESPACE 2014-07-22 15:07:54 UTC (rev 1867) +++ trunk/gmodels/NAMESPACE 2014-07-24 15:14:30 UTC (rev 1868) @@ -19,6 +19,7 @@ S3method(ci, lm) S3method(ci, lme) S3method(ci, mer) +S3method(ci, estimable) S3method(fit.contrast, lm) S3method(fit.contrast, lme) Modified: trunk/gmodels/R/ci.R =================================================================== --- trunk/gmodels/R/ci.R 2014-07-22 15:07:54 UTC (rev 1867) +++ trunk/gmodels/R/ci.R 2014-07-24 15:14:30 UTC (rev 1868) @@ -93,3 +93,19 @@ retval } + + +ci.estimable <- function(x,confidence=0.95,alpha=1-confidence,...) + { + ci.low <- x$Estimate + qt(alpha/2, x$DF) * x$"Std. Error" + ci.high <- x$Estimate - qt(alpha/2, x$DF) * x$"Std. Error" + retval <- cbind(Estimate=x$Estimate, + "CI lower"=ci.low, + "CI upper"=ci.high, + "Std. Error"= x$"Std. Error", + "p-value" = x$"Pr(>|t|)" + ) + rownames(retval) <- rownames(x) + + retval + } Modified: trunk/gmodels/R/estimable.R =================================================================== --- trunk/gmodels/R/estimable.R 2014-07-22 15:07:54 UTC (rev 1867) +++ trunk/gmodels/R/estimable.R 2014-07-24 15:14:30 UTC (rev 1868) @@ -161,6 +161,9 @@ 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) } } @@ -273,6 +276,9 @@ 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: trunk/gmodels/man/ci.Rd =================================================================== --- trunk/gmodels/man/ci.Rd 2014-07-22 15:07:54 UTC (rev 1867) +++ trunk/gmodels/man/ci.Rd 2014-07-24 15:14:30 UTC (rev 1868) @@ -7,6 +7,7 @@ \alias{ci.lm} \alias{ci.lme} \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 @@ -14,12 +15,13 @@ \code{ci.binom}, and for \code{lm}, \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}{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, ...) + ci(x, confidence=0.95, alpha=1 - confidence, ...) + \method{ci}{default}(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}{estimable}(x, confidence=0.95, alpha=1-confidence, ...) } \arguments{ \item{x}{ object from which to compute confidence intervals. } Modified: trunk/gmodels/man/estimable.Rd =================================================================== --- trunk/gmodels/man/estimable.Rd 2014-07-22 15:07:54 UTC (rev 1867) +++ trunk/gmodels/man/estimable.Rd 2014-07-24 15:14:30 UTC (rev 1868) @@ -104,7 +104,7 @@ \code{\link[stats]{lm}}, \code{\link[nlme]{lme}}, \code{\link[stats]{contrasts}}, - \code{\link[rms]{contrast.rms}}, + \code{\link[rms]{contrast}} } \examples{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |