[R-gregmisc-commits] r2184 - in pkg/gmodels: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jun 20 22:46:34 CEST 2018
Author: warnes
Date: 2018-06-20 22:46:34 +0200 (Wed, 20 Jun 2018)
New Revision: 2184
Modified:
pkg/gmodels/R/fit.contrast.R
pkg/gmodels/man/ci.Rd
pkg/gmodels/man/estimable.Rd
pkg/gmodels/man/fit.contrast.Rd
Log:
Fix R CMD check issues.
Modified: pkg/gmodels/R/fit.contrast.R
===================================================================
--- pkg/gmodels/R/fit.contrast.R 2018-06-20 20:42:45 UTC (rev 2183)
+++ pkg/gmodels/R/fit.contrast.R 2018-06-20 20:46:34 UTC (rev 2184)
@@ -1,8 +1,8 @@
# $Id$
fit.contrast.lm <- function(model, varname, coeff, showall=FALSE,
- conf.int,
- df=FALSE,
+ conf.int=NULL,
+ df=FALSE,
...)
{
# check class of model
@@ -102,10 +102,10 @@
if(!df)
retval <- retval[,-5,drop=FALSE]
-
+
class(retval) <- "fit_contrast"
-
- retval
+
+ retval
}
# fit.contrast.lme and fit.contrast.mer are necessary because
Modified: pkg/gmodels/man/ci.Rd
===================================================================
--- pkg/gmodels/man/ci.Rd 2018-06-20 20:42:45 UTC (rev 2183)
+++ pkg/gmodels/man/ci.Rd 2018-06-20 20:46:34 UTC (rev 2184)
@@ -2,11 +2,11 @@
%
\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}
\alias{ci.fit_contrast}
\title{Compute Confidence Intervals}
@@ -17,13 +17,13 @@
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}{estimable}(x, confidence=0.95, alpha=1-confidence, ...)
- \method{ci}{fit_contrast}(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, ...)
+ \method{ci}{fit_contrast}(x, confidence=0.95, alpha=1-confidence, ...)
}
\arguments{
\item{x}{ object from which to compute confidence intervals. }
@@ -32,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{
% ~~ If necessary, more details than the __description__ above ~~
@@ -52,7 +52,7 @@
\examples{
-# mean and confidence interval
+# mean and confidence interval
ci( rnorm(10) )
# binomial proportion and exact confidence interval
@@ -64,13 +64,13 @@
# confidence intervals for regression parameteres
data(state)
reg <- lm(Area ~ Population, data=as.data.frame(state.x77))
-ci(reg)
+ci(reg)
%\dontrun{
-# mer example
-library(lme4)
-fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)
-ci(fm2)
+%# mer example
+%library(lme4)
+%fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)
+%ci(fm2)
%}
Modified: pkg/gmodels/man/estimable.Rd
===================================================================
--- pkg/gmodels/man/estimable.Rd 2018-06-20 20:42:45 UTC (rev 2183)
+++ pkg/gmodels/man/estimable.Rd 2018-06-20 20:46:34 UTC (rev 2184)
@@ -3,7 +3,7 @@
\name{estimable}
\alias{estimable}
\alias{estimable.default}
-\alias{estimable.mer}
+%%\alias{estimable.mer}
\alias{estimable.mlm}
%\alias{.wald}
%\alias{.to.est}
@@ -16,8 +16,8 @@
\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)
@@ -37,12 +37,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 +61,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 +91,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 +142,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 2018-06-20 20:42:45 UTC (rev 2183)
+++ pkg/gmodels/man/fit.contrast.Rd 2018-06-20 20:46:34 UTC (rev 2184)
@@ -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