From noreply at r-forge.r-project.org Fri Jul 3 04:51:49 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 3 Jul 2015 04:51:49 +0200 (CEST) Subject: [R-gregmisc-commits] r2056 - in pkg/gdata: . inst Message-ID: <20150703025149.85CD6187B58@r-forge.r-project.org> Author: warnes Date: 2015-07-03 04:51:47 +0200 (Fri, 03 Jul 2015) New Revision: 2056 Modified: pkg/gdata/DESCRIPTION pkg/gdata/inst/ChangeLog pkg/gdata/inst/NEWS Log: Update for gdata 2.17.0 Modified: pkg/gdata/DESCRIPTION =================================================================== --- pkg/gdata/DESCRIPTION 2015-06-29 22:40:22 UTC (rev 2055) +++ pkg/gdata/DESCRIPTION 2015-07-03 02:51:47 UTC (rev 2056) @@ -23,8 +23,8 @@ Depends: R (>= 2.3.0) SystemRequirements: perl (>= 5.10.0) Imports: gtools -Version: 2.16.1 -Date: 2015-04-28 +Version: 2.17.0 +Date: 2015-07-02 Author: Gregory R. Warnes, Ben Bolker, Gregor Gorjanc, Gabor Grothendieck, Ales Korosec, Thomas Lumley, Don MacQueen, Arni Magnusson, Jim Rogers, and others Modified: pkg/gdata/inst/ChangeLog =================================================================== --- pkg/gdata/inst/ChangeLog 2015-06-29 22:40:22 UTC (rev 2055) +++ pkg/gdata/inst/ChangeLog 2015-07-03 02:51:47 UTC (rev 2056) @@ -1,5 +1,6 @@ 2015-06-29 warnes + * [r2055] inst/ChangeLog: Update ChangeLog * [r2054] tests/test.humanReadable.Rout.save, tests/test.read.xls.R, tests/test.read.xls.Rout.save, tests/test.reorder.factor.Rout.save, Modified: pkg/gdata/inst/NEWS =================================================================== --- pkg/gdata/inst/NEWS 2015-06-29 22:40:22 UTC (rev 2055) +++ pkg/gdata/inst/NEWS 2015-07-03 02:51:47 UTC (rev 2056) @@ -1,3 +1,21 @@ +Changes in 2.17.0 (2015-07-02) +------------------------------ + +New features: + +- Add new argument 'byrow' to upperTriangle(), lowerTriangle(), + upperTriangle<-(), and lowerTriangle<-() to specify by-row rather + by-column order. This makes it simpler to copy values between the + lower and upper triangular areas, e.g. to construct a symmetric + matrix. + +Other changes: + +- Add inline comments to tests to alert reviewers of expected diffs on + systems lacking the libraries for read.xls() to support XLSX + formatted files. + + Changes in 2.16.1 (2015-04-28) ----------------------------- From noreply at r-forge.r-project.org Tue Jul 14 23:19:03 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 14 Jul 2015 23:19:03 +0200 (CEST) Subject: [R-gregmisc-commits] r2057 - in pkg/gtools: R man Message-ID: <20150714211903.C3119187AEA@r-forge.r-project.org> Author: warnes Date: 2015-07-14 23:19:03 +0200 (Tue, 14 Jul 2015) New Revision: 2057 Modified: pkg/gtools/R/loadedPackages.R pkg/gtools/man/loadedPackages.Rd Log: Modify loadedPackages() to return data silently so that the results don't get printed twice. Modified: pkg/gtools/R/loadedPackages.R =================================================================== --- pkg/gtools/R/loadedPackages.R 2015-07-03 02:51:47 UTC (rev 2056) +++ pkg/gtools/R/loadedPackages.R 2015-07-14 21:19:03 UTC (rev 2057) @@ -8,5 +8,5 @@ retval$SearchPath <- na.replace(retval$SearchPath, '-') retval <- retval[order(inSearchPath),] if(!silent) print(retval) - retval + invisible(retval) } Modified: pkg/gtools/man/loadedPackages.Rd =================================================================== --- pkg/gtools/man/loadedPackages.Rd 2015-07-03 02:51:47 UTC (rev 2056) +++ pkg/gtools/man/loadedPackages.Rd 2015-07-14 21:19:03 UTC (rev 2057) @@ -13,7 +13,7 @@ \item{silent}{Logical indicating whether the results should be printed} } \value{ - Data frame containing one row per loaded package namespace, with columns: + Invisibly returns a data frame containing one row per loaded package namespace, with columns: \item{Package}{Package name} \item{Version}{Version string} \item{Path}{Path to package files} From noreply at r-forge.r-project.org Sun Jul 19 04:30:07 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 19 Jul 2015 04:30:07 +0200 (CEST) Subject: [R-gregmisc-commits] r2058 - in pkg/gmodels: R man Message-ID: <20150719023008.15C1F187B29@r-forge.r-project.org> Author: warnes Date: 2015-07-19 04:30:05 +0200 (Sun, 19 Jul 2015) New Revision: 2058 Modified: pkg/gmodels/R/ci.R pkg/gmodels/man/ci.Rd Log: ci.binom() was using an incorrect method for calculating binomial confidence interval. The revised code calculates the Clopper-Pearson 'exect' interval, which is *conservative* due to the discrete nature of the binomial distribution. Modified: pkg/gmodels/R/ci.R =================================================================== --- pkg/gmodels/R/ci.R 2015-07-14 21:19:03 UTC (rev 2057) +++ pkg/gmodels/R/ci.R 2015-07-19 02:30:05 UTC (rev 2058) @@ -15,20 +15,24 @@ "CI upper"=ci.high, "Std. Error"=stderr ) - + retval } ci.binom <- function(x, confidence=0.95,alpha=1-confidence,...) { - if( !(all(x) %in% c(0,1)) ) stop("Binomial values must be either 0 or 1.") + if( !(all(x %in% c(0,1))) ) stop("Binomial values must be either 0 or 1.") + if( all(x==0) || all(x==1) ) + warning("All observed values are ", as.numeric(x[1]), ", so estimated Std. Error is 0.") est <- mean(x, na.rm=TRUE) n <- nobs(x) + x <- sum(x) stderr <- sqrt(est*(1-est)/n) - ci.low <- qbinom(p=alpha/2, prob=est, size=n)/n - ci.high <- qbinom(p=1-alpha/2, prob=est, size=n)/n + ci.low <- qbeta( alpha/2, x , n + 1 - x) + ci.high <- qbeta(1- alpha/2, x+1, n-x ) + retval <- cbind(Estimate=est, "CI lower"=ci.low, "CI upper"=ci.high, @@ -48,7 +52,7 @@ "CI upper"=ci.high, "Std. Error"= coef(x)[,2], "p-value" = coef(x)[,4]) - + retval } @@ -68,18 +72,18 @@ retval } -ci.mer <- function (x, - confidence = 0.95, - alpha = 1 - confidence, +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, + retval <- gmodels:::est.mer(obj = x, cm = diag(n), - beta0 = rep(0, n), + beta0 = rep(0, n), conf.int = confidence, show.beta0 = FALSE, n.sim = n.sim) @@ -90,7 +94,7 @@ ] colnames(retval)[c(2:3, 5)] <- c("CI lower", "CI upper", "p-value") rownames(retval) <- names(x.effects) - + retval } @@ -106,6 +110,6 @@ "p-value" = x$"Pr(>|t|)" ) rownames(retval) <- rownames(x) - + retval } Modified: pkg/gmodels/man/ci.Rd =================================================================== --- pkg/gmodels/man/ci.Rd 2015-07-14 21:19:03 UTC (rev 2057) +++ pkg/gmodels/man/ci.Rd 2015-07-19 02:30:05 UTC (rev 2058) @@ -20,8 +20,8 @@ \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}{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. } @@ -32,9 +32,12 @@ \item{\dots}{Arguments for methods} \item{n.sim}{Number of samples to take in \code{mcmcsamp}.} } -%\details{ -% ~~ If necessary, more details than the __description__ above ~~ -%} +\details{ + \code{ci.binom} computes binomial confidence intervals using the + Clopper-Pearson 'exact' method based on the binomial quantile + function. Due to the discrete nature of the binomial distribution, + this interval is conservative. +} \value{ vector or matrix with one row per model parameter and elements/columns \code{Estimate}, \code{CI lower}, \code{CI upper}, \code{Std. Error}, @@ -50,7 +53,7 @@ \examples{ -# mean and confidence interval +# mean and confidence interval ci( rnorm(10) ) # binomial proportion and exact confidence interval @@ -62,7 +65,7 @@ # confidence intervals for regression parameteres data(state) reg <- lm(Area ~ Population, data=as.data.frame(state.x77)) -ci(reg) +ci(reg) %\dontrun{ # mer example From noreply at r-forge.r-project.org Sun Jul 19 04:34:48 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 19 Jul 2015 04:34:48 +0200 (CEST) Subject: [R-gregmisc-commits] r2059 - in pkg/gmodels: . inst Message-ID: <20150719023448.EB424187B2B@r-forge.r-project.org> Author: warnes Date: 2015-07-19 04:34:45 +0200 (Sun, 19 Jul 2015) New Revision: 2059 Modified: pkg/gmodels/DESCRIPTION pkg/gmodels/inst/ChangeLog pkg/gmodels/inst/NEWS Log: Update DESCRIPTION, ChangeLog, and NEWS for gmodels 2.16.1 Modified: pkg/gmodels/DESCRIPTION =================================================================== --- pkg/gmodels/DESCRIPTION 2015-07-19 02:30:05 UTC (rev 2058) +++ pkg/gmodels/DESCRIPTION 2015-07-19 02:34:45 UTC (rev 2059) @@ -1,6 +1,6 @@ Package: gmodels -Version: 2.16.0 -Date: 2014-07-24 +Version: 2.16.1 +Date: 2015-07-18 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: pkg/gmodels/inst/ChangeLog =================================================================== --- pkg/gmodels/inst/ChangeLog 2015-07-19 02:30:05 UTC (rev 2058) +++ pkg/gmodels/inst/ChangeLog 2015-07-19 02:34:45 UTC (rev 2059) @@ -1,194 +1,182 @@ +2015-07-19 warnes + + * [r2058] R/ci.R, man/ci.Rd: ci.binom() was using an incorrect + method for calculating binomial confidence interval. The revised + code calculates the Clopper-Pearson 'exect' interval, which is + *conservative* due to the discrete nature of the binomial + distribution. + +2015-05-02 warnes + + * [r2018] Rename 'trunk' to 'pkg' for compatibility with R-forge + +2015-04-06 warnes + + * [r1916] Add ChangeLog files to repository + 2014-07-24 warnes - * [r1868] DESCRIPTION, NAMESPACE, R/ci.R, R/estimable.R, man/ci.Rd, - man/estimable.Rd: - Estimable now adds the class 'estimable' to - returned objects. + * [r1869] Update NEWS for gmodels 2.16.0 + * [r1868] - Estimable now adds the class 'estimable' to returned + objects. - New ci() method for estimable objects. - Minor improvemets to man page formatting. 2013-07-18 warnes - * [r1710] DESCRIPTION, inst/NEWS: Looks like Brian Ripley - repackaged for R 3.0.0 and bumped version number, so change it to - 2.15.5 - * [r1709] DESCRIPTION, inst/NEWS: Update for gmodels 2.15.4 - * [r1708] man/ci.Rd: Update to current Rd syntax - * [r1707] R/estimable.mlm.R, test/test_estimable_mlm.R: Correct bug - in estimable.mlm + * [r1710] Looks like Brian Ripley repackaged for R 3.0.0 and bumped + version number, so change it to 2.15.5 + * [r1709] Update for gmodels 2.15.4 + * [r1708] Update to current Rd syntax + * [r1707] Correct bug in estimable.mlm 2013-07-15 warnes - * [r1706] R/ci.R, man/ci.Rd: Remove unused argument to ci.mer + * [r1706] Remove unused argument to ci.mer 2012-06-28 warnes - * [r1577] DESCRIPTION, inst/NEWS: Update for gmodels version - 2.15.3. - * [r1576] R/percentile.R: Move percentile() function to a separate - file. - * [r1575] R/est.lmer.R, R/est.mer.R: Update est.mer() to support - new S4 "mer" class. - * [r1574] man/ci.Rd: Make lme4 example executable. + * [r1577] Update for gmodels version 2.15.3. + * [r1576] Move percentile() function to a separate file. + * [r1575] Update est.mer() to support new S4 "mer" class. + * [r1574] Make lme4 example executable. 2012-06-27 warnes - * [r1573] test/lme-test.R: Add test code submitted by - Ariel.Muldoon at oregonstate.edu. + * [r1573] Add test code submitted by Ariel.Muldoon at oregonstate.edu. 2012-04-19 warnes - * [r1528] inst/NEWS: Update for release 2.15.2 - * [r1527] DESCRIPTION: Update version and date. - * [r1526] man/estimable.Rd: The 'Design' package has been replaced - my 'rms', so update man page references. - * [r1525] R/ci.R, R/est.mer.R: More fixes for support of S4 'mer' - class from lme4 package. - * [r1524] man/coefFrame.Rd: Split long line. - * [r1523] man/ci.Rd, man/glh.test.Rd: Changes to pass R CMD check + * [r1528] Update for release 2.15.2 + * [r1527] Update version and date. + * [r1526] The 'Design' package has been replaced my 'rms', so + update man page references. + * [r1525] More fixes for support of S4 'mer' class from lme4 + package. + * [r1524] Split long line. + * [r1523] Changes to pass R CMD check 2011-12-14 warnes - * [r1521] R/ci.R: Improve formatting of ci.mer(). - * [r1520] R/est.mer.R: Modify est.mer to work with recent lme4 - 'mer' S4 objects. + * [r1521] Improve formatting of ci.mer(). + * [r1520] Modify est.mer to work with recent lme4 'mer' S4 objects. 2011-01-16 warnes - * [r1466] DESCRIPTION, inst/NEWS, man/ci.Rd, man/estimable.Rd, - man/fast.prcomp.Rd, man/fit.contrast.Rd, man/glh.test.Rd, - man/make.contrasts.Rd: Fix warnings reported by R CMD check. - Update version number to 2.15.1. + * [r1466] Fix warnings reported by R CMD check. Update version + number to 2.15.1. 2009-05-09 warnes - * [r1337] test, test/lme-test.R: Add tests for lme4 'mer' objects - * [r1336] inst/NEWS: Update for 2.15.0 - * [r1335] DESCRIPTION: Update description for 2.15.0 - * [r1334] R/est.mer.R: Add support for lme4's 'mer' objects - * [r1333] NAMESPACE, R/ci.R, R/est.lmer.R, R/estimable.R, - R/fit.contrast.R, R/to.est.R: Add support for lme4's 'mer' - objects - * [r1332] man/glh.test.Rd: Fix .Rd syntax error - * [r1331] NEWS: Add softlinks for ChangeLog and NEWS to top level - dir for convenience - * [r1330] ChangeLog, NEWS, inst, inst/NEWS: Move ChangeLog and NEWS - files into inst directory - * [r1329] DESCRIPTION, man/ci.Rd, man/estimable.Rd, - man/fast.prcomp.Rd, man/fit.contrast.Rd, man/glh.test.Rd, - man/make.contrasts.Rd: Update Greg's email address + * [r1337] Add tests for lme4 'mer' objects + * [r1336] Update for 2.15.0 + * [r1335] Update description for 2.15.0 + * [r1334] Add support for lme4's 'mer' objects + * [r1333] Add support for lme4's 'mer' objects + * [r1332] Fix .Rd syntax error + * [r1331] Add softlinks for ChangeLog and NEWS to top level dir for + convenience + * [r1330] Move ChangeLog and NEWS files into inst directory + * [r1329] Update Greg's email address 2008-04-10 warnes - * [r1255] man/ci.Rd: Improve languages a bit + * [r1255] Improve languages a bit 2008-01-02 warnes - * [r1236] man/CrossTable.Rd: Update Marc's email address + * [r1236] Update Marc's email address 2007-12-12 warnes - * [r1233] DESCRIPTION: Move copyright notice for Randall's - contributions from License section to Author section of the - DESCRIPTION file. + * [r1233] Move copyright notice for Randall's contributions from + License section to Author section of the DESCRIPTION file. 2007-12-07 warnes - * [r1232] DESCRIPTION, NEWS: Update DESCRIPTION and NEWS for - release 2.14.1 - * [r1231] man/estimable.Rd: Correct minor typos in man page for - estimable() - * [r1230] R/estimable.R: Add support for lme models to estimable() - * [r1229] man/estimable.Rd: Replace non-ascii characters in Soren's - name with (equivalent?) ascii character to avoid character - encoding issues. + * [r1232] Update DESCRIPTION and NEWS for release 2.14.1 + * [r1231] Correct minor typos in man page for estimable() + * [r1230] Add support for lme models to estimable() + * [r1229] Replace non-ascii characters in Soren's name with + (equivalent?) ascii character to avoid character encoding issues. 2007-10-22 warnes - * [r1196] DESCRIPTION: Clarify GPL version + * [r1196] Clarify GPL version 2007-07-26 warnes - * [r1105] DESCRIPTION, NAMESPACE, NEWS, R/estimable.mlm.R, - man/estimable.Rd: Add support for mlm to estimable(). - * [r1104] R/estimable.R, R/estimable.mlm.R: Add estimable method - for mlm objects + * [r1105] Add support for mlm to estimable(). + * [r1104] Add estimable method for mlm objects 2007-03-09 warnes - * [r1079] R/ci.R: Remove stray character - * [r1078] NEWS: Update NEWS file. - * [r1077] DESCRIPTION: Update version number - * [r1076] R/ci.R: Minor code formatting changes - * [r1075] R/est.lmer.R, man/ci.Rd: Flip lower and upper interval in - ci.lmer(). Add example to man page. - * [r1074] man/ci.Rd, man/estimable.Rd: Fix some old email - addressses that got missed + * [r1079] Remove stray character + * [r1078] Update NEWS file. + * [r1077] Update version number + * [r1076] Minor code formatting changes + * [r1075] Flip lower and upper interval in ci.lmer(). Add example + to man page. + * [r1074] Fix some old email addressses that got missed 2006-11-29 warnes - * [r1029] NEWS: Update for 2.13.1 - * [r1028] NAMESPACE: Correct declartion of S3 methods for - estimable() - * [r1027] DESCRIPTION: Add additional suggested packages - * [r1026] R/estimable.R, man/estimable.Rd: - Add generic + * [r1029] Update for 2.13.1 + * [r1028] Correct declartion of S3 methods for estimable() + * [r1027] Add additional suggested packages + * [r1026] - Add generic - Fix code vs. doc inconsistiencies 2006-11-28 warnes - * [r1025] R/ci.R, R/estimable.R, R/fast.prcomp.R: Remove extraneous - comma that causes errors in R 2.5.0 + * [r1025] Remove extraneous comma that causes errors in R 2.5.0 2006-11-27 warnes - * [r1016] DESCRIPTION, NEWS: Update for 2.13.1 - * [r1015] DESCRIPTION, NAMESPACE: Add missing export of methods for - estimable() + * [r1016] Update for 2.13.1 + * [r1015] Add missing export of methods for estimable() 2006-11-14 ggorjan - * [r1012] R/ci.R, R/fast.prcomp.R, man/ci.Rd: Removed executable - property + * [r1012] Removed executable property 2006-08-02 warnes - * [r977] man/fast.prcomp.Rd, man/fit.contrast.Rd, man/glh.test.Rd, - man/make.contrasts.Rd: Update my email address + * [r977] Update my email address 2006-06-06 nj7w - * [r966] man/ci.Rd, man/estimable.Rd, man/fit.contrast.Rd: Updated - ci, estimable and fit.contrast as per Randall Johnson + * [r966] Updated ci, estimable and fit.contrast as per Randall + Johnson 2006-06-05 nj7w - * [r965] DESCRIPTION: Additions as per Randall C Johnson - * [r964] R/ci.R, R/estimable.R, R/fit.contrast.R, R/to.est.R: - Additions as per Randall C Johnson - * [r963] R/est.lmer.R: - New function to estimate CI's and p-values - using mcmcsamp() from the + * [r965] Additions as per Randall C Johnson + * [r964] Additions as per Randall C Johnson + * [r963] - New function to estimate CI's and p-values using + mcmcsamp() from the Matrix package 2006-05-05 nj7w - * [r959] R/CrossTable.R, man/CrossTable.Rd: Fixed an error: - According to Marc Schwartz - there was an error when a matrix - without dimnames(or names(dimnames)) was passed as x argument + * [r959] Fixed an error: According to Marc Schwartz - there was an + error when a matrix without dimnames(or names(dimnames)) was + passed as x argument 2005-12-13 nj7w - * [r808] ChangeLog: Removed ChangeLog - * [r807] NEWS: Updated NEWS + * [r808] Removed ChangeLog + * [r807] Updated NEWS 2005-12-12 nj7w - * [r796] DESCRIPTION: Updated version number for CRAN + * [r796] Updated version number for CRAN 2005-12-04 warnes - * [r781] NEWS: Update for 2.11.0 - * [r780] DESCRIPTION, NAMESPACE, R/ci.R, R/estimable.R, - R/fit.contrast.R, R/to.est.R, man/ci.Rd, man/estimable.Rd: - Integration of code changes suggested by Randall C Johnson to add + * [r781] Update for 2.11.0 + * [r780] Integration of code changes suggested by Randall C Johnson + to add support for lmer (lme version 4) objects to ci(), estimable(), and fit.contrast(). @@ -203,52 +191,48 @@ 2005-12-01 nj7w - * [r776] man/ci.Rd, man/coefFrame.Rd, man/estimable.Rd, - man/fit.contrast.Rd, man/make.contrasts.Rd: Updated Greg's email - address + * [r776] Updated Greg's email address 2005-10-27 warnes - * [r709] DESCRIPTION: Update version number. Bump minor version - since we added functionality. - * [r708] DESCRIPTION, NAMESPACE: Add ci.binom() to NAMESPACE, bump - version + * [r709] Update version number. Bump minor version since we added + functionality. + * [r708] Add ci.binom() to NAMESPACE, bump version 2005-10-26 warnes - * [r707] R/ci.R, man/ci.Rd: Add ci.binom + * [r707] Add ci.binom 2005-10-25 warnes - * [r706] NAMESPACE: Add gdata::nobs to import list. Needed by ci() + * [r706] Add gdata::nobs to import list. Needed by ci() 2005-09-12 nj7w - * [r671] man/fast.prcomp.Rd, man/glh.test.Rd: Updated Greg's email + * [r671] Updated Greg's email 2005-09-07 nj7w - * [r667] man/CrossTable.Rd: Fixed man page + * [r667] Fixed man page 2005-09-06 nj7w - * [r664] DESCRIPTION: Updated DESCRIPTION - * [r663] NEWS: Added NEWS - * [r662] DESCRIPTION: Fixed the Package name + * [r664] Updated DESCRIPTION + * [r663] Added NEWS + * [r662] Fixed the Package name 2005-09-02 nj7w - * [r655] ChangeLog: Added ChangeLog + * [r655] Added ChangeLog 2005-08-31 nj7w - * [r644] DESCRIPTION: Added DESCRIPTION file - * [r643] DESCRIPTION.in: removed DESCRIPTION.in + * [r644] Added DESCRIPTION file + * [r643] removed DESCRIPTION.in 2005-07-11 nj7w - * [r627] R/CrossTable.R, man/CrossTable.Rd: Revision based on Marc - Schwartz's suggestions: + * [r627] Revision based on Marc Schwartz's suggestions: 1) Added 'dnn' argument to enable specification of dimnames as per table() 2) Corrected bug in SPSS output for 1d table, where proportions @@ -256,14 +240,10 @@ 2005-06-09 nj7w - * [r625] R/ci.R, R/coefFrame.R, R/estimable.R, R/fast.prcomp.R, - R/fit.contrast.R, R/glh.test.R, R/make.contrasts.R, - man/CrossTable.Rd, man/ci.Rd, man/coefFrame.Rd, man/estimable.Rd, - man/fast.prcomp.Rd, man/fit.contrast.Rd, man/glh.test.Rd, - man/make.contrasts.Rd: Updating the version number, and various - help files to synchronize splitting of gregmisc bundle in 4 - individual components. - * [r623] R/CrossTable.R: Updates by Marc Schwartz: + * [r625] Updating the version number, and various help files to + synchronize splitting of gregmisc bundle in 4 individual + components. + * [r623] Updates by Marc Schwartz: CrossTable: # Revision 2.0 2005/04/27 @@ -273,108 +253,95 @@ 2005-05-13 nj7w - * [r621] man/CrossTable.Rd: 1) Using dQuote.ascii function in - read.xls as the new version of dQuote doesn't work proprly with - UTF-8 locale. + * [r621] 1) Using dQuote.ascii function in read.xls as the new + version of dQuote doesn't work proprly with UTF-8 locale. 2) Modified CrossTable.Rd usage in gmodels 3) Modified heatmap.2 usage in gplots. 2005-05-11 warnes - * [r620] DESCRIPTION.in, NAMESPACE: Add dependency on - gdata::frameApply. + * [r620] Add dependency on gdata::frameApply. 2005-03-31 warnes - * [r593] NAMESPACE: Add ceofFrame function to NAMESPACE - * [r592] man/coefFrame.Rd: coefFrame example needs to properly load - ELISA data from gtools package - * [r588] R/CrossTable.R, man/CrossTable.Rd, man/ci.Rd, - man/estimable.Rd, man/fast.prcomp.Rd, man/fit.contrast.Rd, - man/glh.test.Rd, man/make.contrasts.Rd: Ensure that each file has - $Id$ header, and no $Log$ - * [r587] R/coefFrame.R, man/coefFrame.Rd: Add coefFrame() function - contributed by Jim Rogers + * [r593] Add ceofFrame function to NAMESPACE + * [r592] coefFrame example needs to properly load ELISA data from + gtools package + * [r588] Ensure that each file has $Id$ header, and no $Log$ + * [r587] Add coefFrame() function contributed by Jim Rogers 2005-01-18 warnes - * [r521] R/CrossTable.R: Removed Windows Line Endings + * [r521] Removed Windows Line Endings 2005-01-14 nj7w - * [r518] man/CrossTable.Rd: Updated the manual to reflect - prop.chisq change in its R file. + * [r518] Updated the manual to reflect prop.chisq change in its R + file. 2005-01-14 warnes - * [r517] R/CrossTable.R: Nitin added display of the Chisquare - contribution of each cell, as suggested + * [r517] Nitin added display of the Chisquare contribution of each + cell, as suggested by Greg Snow. 2005-01-12 warnes - * [r515] DESCRIPTION.in: Add dependency on R 1.9.0+ to prevent - poeple from installing on old + * [r515] Add dependency on R 1.9.0+ to prevent poeple from + installing on old versions of R which don't support namespaces. 2004-12-23 nj7w - * [r507] R/CrossTable.R, man/CrossTable.Rd: Split the function - print.CrossTable.vector in two parts - for SAS behaiour and SPSS - behaviour. Also put the code of printing statistics in a function - 'print.statistics' + * [r507] Split the function print.CrossTable.vector in two parts - + for SAS behaiour and SPSS behaviour. Also put the code of + printing statistics in a function 'print.statistics' 2004-12-21 warnes - * [r502] R/CrossTable.R: Added & extended changes made by Nitin to - implement 'SPSS' format, as suggested by + * [r502] Added & extended changes made by Nitin to implement 'SPSS' + format, as suggested by Dirk Enzmann . 2004-09-30 warneg - * [r464] man/glh.test.Rd: Fix typos. + * [r464] Fix typos. 2004-09-27 warneg - * [r461] DESCRIPTION, DESCRIPTION.in: Updated to pass R CMD check. + * [r461] Updated to pass R CMD check. 2004-09-03 warneg - * [r450] man/fit.contrast.Rd: Add explicit package to call to - quantcut in example. - * [r446] DESCRIPTION, NAMESPACE, R/CrossTable.R, R/ci.R, - R/estimable.R, R/fast.prcomp.R, R/fit.contrast.R, R/glh.test.R, - R/make.contrasts.R, man/estimable.Rd, man/fit.contrast.Rd, - man/glh.test.Rd, man/make.contrasts.Rd: initial bundle checkin + * [r450] Add explicit package to call to quantcut in example. + * [r446] initial bundle checkin 2004-09-02 warneg - * [r442] DESCRIPTION, DESCRIPTION.in, NAMESPACE: Initial revision + * [r442] Initial revision 2004-05-25 warnes - * [r327] R/CrossTable.R, man/CrossTable.Rd: Updates from Mark - Schwartz. + * [r327] Updates from Mark Schwartz. 2004-04-13 warnes - * [r314] man/estimable.Rd: Fix latex warning: it doesn't like - double subscripts. + * [r314] Fix latex warning: it doesn't like double subscripts. 2004-03-26 warnes - * [r306] man/fast.prcomp.Rd: Reflect movement of code from 'mva' - package to 'stats' in R 1.9.0. + * [r306] Reflect movement of code from 'mva' package to 'stats' in + R 1.9.0. 2004-03-25 warnes - * [r296] R/estimable.R, man/estimable.Rd: - Estimable was reporting - sqrt(X^2) rather than X^2 in the output. + * [r296] - Estimable was reporting sqrt(X^2) rather than X^2 in the + output. - Provide latex math markup for linear algebra expressions in help text. - Other clarifications in help text - * [r295] R/estimable.R, man/estimable.Rd: Add enhancements to - estimable() provided by S?ren H?jsgaard + * [r295] Add enhancements to estimable() provided by S?ren + H?jsgaard \email{sorenh at agrsci.dk}: I have made a modified version of the function [..] which @@ -384,38 +351,38 @@ 2003-11-17 warnes - * [r221] R/fit.contrast.R: - Fix incorrect handling of glm objects - by fit.contrast, as reported + * [r221] - Fix incorrect handling of glm objects by fit.contrast, + as reported by Ulrich Halekoh, Phd . - Add regression test code to for this bug. 2003-08-07 warnes - * [r217] R/ci.R: - Fixed incorrect denominator in standard error - for mean in ci.default. + * [r217] - Fixed incorrect denominator in standard error for mean + in ci.default. 2003-04-22 warnes - * [r190] R/fit.contrast.R: - the variable 'df' was used within the - lme code section overwriting + * [r190] - the variable 'df' was used within the lme code section + overwriting the argument 'df'. 2003-03-12 warnes - * [r173] man/fit.contrast.Rd: - Fixed a typo in the example + * [r173] - Fixed a typo in the example - Added to lme example 2003-03-07 warnes - * [r168] R/fast.prcomp.R: - Minor changes to code to allow the - package to be provided as an + * [r168] - Minor changes to code to allow the package to be + provided as an S-Plus chapter. 2003-01-30 warnes - * [r160] R/fit.contrast.R, man/fit.contrast.Rd: - Renamed - 'contrast.lm' to 'fit.contrast'. This new name is more + * [r160] - Renamed 'contrast.lm' to 'fit.contrast'. This new name + is more descriptive and makes it easier to create and use methods for other classes, eg lme. @@ -429,8 +396,8 @@ calls fit.contrast - Updated help text to match changes. - * [r158] R/CrossTable.R, man/CrossTable.Rd: - Removed argument - 'correct' and now print separate corrected values + * [r158] - Removed argument 'correct' and now print separate + corrected values for 2 x 2 tables. - Added arguments 'prop.r', 'prop.c' and 'prop.t' to toggle printing @@ -444,8 +411,8 @@ table counts, proportions and the results of the appropriate statistical tests. - * [r157] R/make.contrasts.R: - Added explicit check to ensure that - the number of specified + * [r157] - Added explicit check to ensure that the number of + specified contrasts is less than or equal to the ncol - 1. Previously, this failed with an obtuse error message when the contrast matrix had row @@ -453,56 +420,50 @@ 2002-11-04 warnes - * [r142] R/CrossTable.R: - Moved fisher.test() to after table is - printed, so that table is + * [r142] - Moved fisher.test() to after table is printed, so that + table is still printed in the event that fisher.test() results in errors. 2002-10-29 warnes - * [r138] R/fast.prcomp.R, man/fast.prcomp.Rd: - Fixes to fast.svd - to make it actually work. + * [r138] - Fixes to fast.svd to make it actually work. - Updates to man page to fix mistmatches between code and docs and to fix warnings. - * [r137] R/make.contrasts.R, man/make.contrasts.Rd: - Moved - make.contrasts to a separate file. + * [r137] - Moved make.contrasts to a separate file. - Enhanced make contrasts to better label contrast matrix, to give how.many a default value, and to coerce vectors into row matrixes. - Added help page for make.contrasts. - Added link from contrasts.lm seealso to make.contrasts. - * [r136] R/fast.prcomp.R, man/fast.prcomp.Rd: Initial checkin for - fast.prcomp() and fast.svd(). + * [r136] Initial checkin for fast.prcomp() and fast.svd(). 2002-09-26 warnes - * [r127] man/glh.test.Rd: - Added note and example code to - illustrate how to properly compute + * [r127] - Added note and example code to illustrate how to + properly compute contrasts for the first factor in the model. 2002-09-24 warnes - * [r124] R/glh.test.R: - Fixed a typo. + * [r124] - Fixed a typo. 2002-09-23 warnes - * [r119] man/CrossTable.Rd, man/glh.test.Rd: - Fixed syntax errors - in barplot2.Rd and CrossTable.Rd + * [r119] - Fixed syntax errors in barplot2.Rd and CrossTable.Rd - Fixed incorrect translation of 'F' (distribution) to 'FALSE' in glh.test.Rd - * [r117] R/ci.R, man/estimable.Rd, man/glh.test.Rd: - Modified all - files to include CVS Id and Log tags. - * [r116] R/CrossTable.R, man/CrossTable.Rd: - Added CrossTable() - and barplot2() code and docs contributed by Marc Schwartz. + * [r117] - Modified all files to include CVS Id and Log tags. + * [r116] - Added CrossTable() and barplot2() code and docs + contributed by Marc Schwartz. - Permit combinations() to be used when r>n provided repeat.allowed=TRUE - Bumped up version number 2002-08-01 warnes - * [r114] R/ci.R, man/ci.Rd, man/estimable.Rd, man/glh.test.Rd: - - Corrected documentation mismatch for ci, ci.default. + * [r114] - Corrected documentation mismatch for ci, ci.default. - Replaced all occurences of '_' for assignment with '<-'. @@ -514,101 +475,95 @@ 2002-04-09 warneg - * [r109] R/ci.R, R/estimable.R, R/glh.test.R, man/glh.test.Rd: - Checkin for version 0.5.3 + * [r109] Checkin for version 0.5.3 2002-03-26 warneg - * [r104] R/ci.R, R/glh.test.R, man/ci.Rd, man/glh.test.Rd: - - Changed methods to include '...' to match the generic. + * [r104] - Changed methods to include '...' to match the generic. - Updated for version 0.5.1 - * [r99] man/glh.test.Rd: Removed incorrect link to 'contrast' from - seealso. + * [r99] Removed incorrect link to 'contrast' from seealso. 2002-02-20 warneg - * [r81] man/ci.Rd, man/estimable.Rd, man/glh.test.Rd: Minor - changes, typo and formatting fixes. + * [r81] Minor changes, typo and formatting fixes. 2002-01-17 warneg - * [r70] man/estimable.Rd: - Fixed errror in last example by adding - 'conf.int' parameter to + * [r70] - Fixed errror in last example by adding 'conf.int' + parameter to 'estimable' call. - * [r69] R/glh.test.R: - Fixed typo in code that resulted in an - syntax error. + * [r69] - Fixed typo in code that resulted in an syntax error. 2002-01-10 warneg - * [r68] R/glh.test.R: - print.glh.test() was using cat() to - printing the call. This didn't work and + * [r68] - print.glh.test() was using cat() to printing the call. + This didn't work and generated an error. 2001-12-19 warneg - * [r66] man/glh.test.Rd: - Fixed display of formulae. + * [r66] - Fixed display of formulae. - Added description of return value - * [r65] R/glh.test.R: - Removed extra element of return object. + * [r65] - Removed extra element of return object. 2001-12-18 warneg - * [r64] man/estimable.Rd: - Updated documentation to reflect change - of parameters from 'alpha' + * [r64] - Updated documentation to reflect change of parameters + from 'alpha' to 'conf.int', including the new optional status of the confidence intervals. - * [r63] R/estimable.R: - Modified to make confidence intervals - optional. Changed 'alpha' + * [r63] - Modified to make confidence intervals optional. Changed + 'alpha' parameter giving significance level to 'conf.int' giving confidence level. - * [r62] man/glh.test.Rd: - Added summary.glh.test to alias, usage, - and example sections. - * [r61] R/glh.test.R: - Modified to work correctly when obj is of - class 'aov' by specifying + * [r62] - Added summary.glh.test to alias, usage, and example + sections. + * [r61] - Modified to work correctly when obj is of class 'aov' by + specifying summary.lm instead of summary. This ensures that the summary object has the fields we need. - Moved detailed reporting of results from 'print' to 'summary' function and added a simpler report to 'print' - * [r60] R/estimable.R: - Modified to work correctly when obj is of - class 'aov' by specifying + * [r60] - Modified to work correctly when obj is of class 'aov' by + specifying summary.lm instead of summary. This ensures that the summary object has the fields we need. - * [r59] R/glh.test.R, man/glh.test.Rd: Initial checkin. + * [r59] Initial checkin. 2001-12-17 warneg - * [r56] man/estimable.Rd: - Fixed spelling errors. - * [r55] man/estimable.Rd: - Fixed the link to contrasts.lm. + * [r56] - Fixed spelling errors. + * [r55] - Fixed the link to contrasts.lm. - Rephrased title/description to be more clear. 2001-12-10 warneg - * [r49] man/estimable.Rd: Renamed 'contrsts.coeff.Rd' to - 'estimable.Rd' corresponding to function rename. - * [r48] R/estimable.R: renamed from contrast.coeff.R to estimable.R - (incorrectly via contrast.lm.R) + * [r49] Renamed 'contrsts.coeff.Rd' to 'estimable.Rd' corresponding + to function rename. + * [r48] renamed from contrast.coeff.R to estimable.R (incorrectly + via contrast.lm.R) 2001-12-07 warneg - * [r37] man/ci.Rd: - Added text noting that lme is now supported. - * [r36] R/ci.R: - Fixed typo: DF column was being filled in with - p-value. - * [r35] R/ci.R: - Added ci.lme method to handle lme objects. + * [r37] - Added text noting that lme is now supported. + * [r36] - Fixed typo: DF column was being filled in with p-value. + * [r35] - Added ci.lme method to handle lme objects. 2001-10-16 warneg - * [r27] man/ci.Rd: Fixed unbalanced brace. + * [r27] Fixed unbalanced brace. 2001-08-25 warneg - * [r12] man/ci.Rd: - Added CVS header. + * [r12] - Added CVS header. - Added my email address. 2001-05-30 warneg - * [r2] ., R, R/ci.R, man, man/ci.Rd: Initial revision + * [r2] Initial revision Modified: pkg/gmodels/inst/NEWS =================================================================== --- pkg/gmodels/inst/NEWS 2015-07-19 02:30:05 UTC (rev 2058) +++ pkg/gmodels/inst/NEWS 2015-07-19 02:34:45 UTC (rev 2059) @@ -1,3 +1,14 @@ +Version 2.16.1 - 2015-07-18 +--------------------------- + +Bug fixes: + +- ci.binom() was using an incorrect method for calcuating binomial + conficence intervals. It now calculates the Clopper-Pearson 'exect' + interval, which is *conservative* due to the discrete nature of the + binomial distribution. + + Version 2.16.0 - 2014-07-24 --------------------------- @@ -41,7 +52,7 @@ Bug fixes: - Update est.mer() to work with recent versions of lme4 which changed - 'mer' objects from S3 to S4 class + 'mer' objects from S3 to S4 class - Changes to pass new R CMD check tests @@ -113,7 +124,7 @@ - fix various code/doc inconsistencies - Problem: estimable() was failing for lmer objects. - Solution: + Solution: - Create a generic estimable() - Move old function to estimable.default() - Add estimable.lmer() to the exported methods list in NAMESPACE @@ -135,8 +146,8 @@ function provided by Randall C Johnson. It is now possible to do things like: estimable(reg, c("xB"=1,"xD"=-1)) - instead of: - estimable(reg, c( 0, 1, 0, -1)) + instead of: + estimable(reg, c( 0, 1, 0, -1)) which should make estimable() much easier to use for large models. Version 2.1.0 From noreply at r-forge.r-project.org Sun Jul 19 05:22:33 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 19 Jul 2015 05:22:33 +0200 (CEST) Subject: [R-gregmisc-commits] r2060 - in pkg/gmodels: . R inst man Message-ID: <20150719032233.CF0FD185142@r-forge.r-project.org> 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 -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. From noreply at r-forge.r-project.org Tue Jul 21 01:38:09 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 21 Jul 2015 01:38:09 +0200 (CEST) Subject: [R-gregmisc-commits] r2061 - pkg/gmodels Message-ID: <20150720233809.290C4187AF8@r-forge.r-project.org> Author: warnes Date: 2015-07-21 01:38:07 +0200 (Tue, 21 Jul 2015) New Revision: 2061 Modified: pkg/gmodels/DESCRIPTION pkg/gmodels/NAMESPACE Log: Changs to squash new R CMD check warnings Modified: pkg/gmodels/DESCRIPTION =================================================================== --- pkg/gmodels/DESCRIPTION 2015-07-19 03:22:30 UTC (rev 2060) +++ pkg/gmodels/DESCRIPTION 2015-07-20 23:38:07 UTC (rev 2061) @@ -1,7 +1,7 @@ Package: gmodels Version: 2.16.1 Date: 2015-07-18 -Title: Various R programming tools for model fitting +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 (2005) SAIC-Frederick, Inc. Funded by the Intramural Research Modified: pkg/gmodels/NAMESPACE =================================================================== --- pkg/gmodels/NAMESPACE 2015-07-19 03:22:30 UTC (rev 2060) +++ pkg/gmodels/NAMESPACE 2015-07-20 23:38:07 UTC (rev 2061) @@ -35,3 +35,17 @@ importFrom(MASS, ginv) importFrom(gdata, frameApply) importFrom(gdata, nobs) + +importFrom(stats, "chisq.test") +importFrom(stats, "coef") +importFrom(stats, "family") +importFrom(stats, "fisher.test") +importFrom(stats, "mcnemar.test") +importFrom(stats, "pchisq") +importFrom(stats, "pf") +importFrom(stats, "pt") +importFrom(stats, "qbeta") +importFrom(stats, "qt") +importFrom(stats, "sd") +importFrom(stats, "summary.glm") +importFrom(stats, "summary.lm") From noreply at r-forge.r-project.org Wed Jul 22 02:48:52 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 22 Jul 2015 02:48:52 +0200 (CEST) Subject: [R-gregmisc-commits] r2062 - in pkg: SASxport SASxport/R SASxport/tests exp.ssize/inst/Presentation fork gdata gdata/tests gmodels gmodels/tests gplots gplots/R Message-ID: <20150722004852.6B3721872F8@r-forge.r-project.org> Author: warnes Date: 2015-07-22 02:48:51 +0200 (Wed, 22 Jul 2015) New Revision: 2062 Added: pkg/gmodels/tests/ pkg/gplots/R/layout_set.R Removed: pkg/gmodels/test/ Modified: pkg/SASxport/NAMESPACE pkg/SASxport/R/SASiformat.R pkg/SASxport/tests/datetime.xpt pkg/SASxport/tests/dfAttributes.R pkg/exp.ssize/inst/Presentation/Warnes-SampleSize-Omics.ppt pkg/fork/DESCRIPTION pkg/gdata/DESCRIPTION pkg/gdata/NAMESPACE pkg/gdata/tests/test.humanReadable.Rout.save pkg/gdata/tests/test.read.xls.R pkg/gdata/tests/test.read.xls.Rout.save pkg/gdata/tests/test.reorder.factor.Rout.save pkg/gdata/tests/tests.write.fwf.Rout.save pkg/gmodels/tests/lme-test.R pkg/gplots/DESCRIPTION pkg/gplots/R/heatmap.2.R Log: Renamed 'test' directory to 'tests', commented out tests for lme4 which has a changed API Modified: pkg/SASxport/NAMESPACE =================================================================== --- pkg/SASxport/NAMESPACE 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/SASxport/NAMESPACE 2015-07-22 00:48:51 UTC (rev 2062) @@ -34,15 +34,25 @@ S3method(toSAS, default) ## S3method(label, default) -S3method(SASformat, default) +S3method(SASformat, default) S3method(SASiformat, default) -S3method(SAStype, default) +S3method(SAStype, default) +## S3method(label, data.frame) +S3method(SASformat, data.frame) +S3method(SASiformat, data.frame) +S3method(SAStype, data.frame) + ## S3method("label<-", default) -S3method("SASformat<-", default) +S3method("SASformat<-", default) S3method("SASiformat<-", default) -S3method("SAStype<-", default) +S3method("SAStype<-", default) +## S3method("label<-", data.frame) +S3method("SASformat<-", data.frame) +S3method("SASiformat<-", data.frame) +S3method("SAStype<-", data.frame) + S3method(print, lookup.xport) S3method(summary, lookup.xport) S3method(print, summary.lookup.xport) Modified: pkg/SASxport/R/SASiformat.R =================================================================== --- pkg/SASxport/R/SASiformat.R 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/SASxport/R/SASiformat.R 2015-07-22 00:48:51 UTC (rev 2062) @@ -10,6 +10,14 @@ lab } + +SASiformat.data.frame <- function(x, default=NULL) +{ + sapply( x, SASiformat) +} + + + "SASiformat<-" <- function(x, value) UseMethod("SASiformat<-") @@ -18,3 +26,13 @@ attr(x,'SASiformat') <- value x } + +"SASiformat<-.data.frame" <- function(x, value) +{ + if( ncol(x) != length(value) ) + stop("vector of iformats must match number of data frame columns") + + for(i in 1:ncol(x)) + attr(x[[i]],'SASiformat') <- value[i] + x +} Modified: pkg/SASxport/tests/datetime.xpt =================================================================== (Binary files differ) Modified: pkg/SASxport/tests/dfAttributes.R =================================================================== --- pkg/SASxport/tests/dfAttributes.R 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/SASxport/tests/dfAttributes.R 2015-07-22 00:48:51 UTC (rev 2062) @@ -9,7 +9,8 @@ SAStype(abc.out) <- "normal" ## add a format specifier (not used by R) -SASformat(abc.out$x) <- 'date7.' +SASformat(abc.out$x) <- 'DATE7.' +SASiformat(abc.out$x) <- 'DATE7.' ## add a variable label (not used by R) label(abc.out$y) <- 'character variable' @@ -25,20 +26,30 @@ # read the SAS data back in abc.in <- read.xport("dfAttributes.xpt", - names.tolower=FALSE, + names.tolower=TRUE, verbose=TRUE) ## Test that the files are otherwise identical label(abc.out, self=TRUE, "MISSING!") label(abc.in , self=TRUE, "MISSING!") +stopifnot( label(abc.out, self=TRUE, "MISSING!") == + label(abc.in, self=TRUE, "MISSING!") + ) + SAStype(abc.out, "MISSING!") SAStype(abc.in , "MISSING!") -stopifnot( label (abc.out, self=TRUE, "MISSING!") == - label (abc.in, self=TRUE, "MISSING!") ) - stopifnot( SAStype(abc.out, "MISSING!") == SAStype(abc.in, "MISSING!") ) +SASformat(abc.out) +SASformat(abc.in) +stopifnot( unlist(SASformat(abc.out)) == unlist(SASformat(abc.in)) ) + +SASiformat(abc.out) +SASiformat(abc.in) + +stopifnot( unlist(SASiformat(abc.out)) == unlist(SASiformat(abc.in)) ) + Modified: pkg/exp.ssize/inst/Presentation/Warnes-SampleSize-Omics.ppt =================================================================== (Binary files differ) Modified: pkg/fork/DESCRIPTION =================================================================== --- pkg/fork/DESCRIPTION 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/fork/DESCRIPTION 2015-07-22 00:48:51 UTC (rev 2062) @@ -11,3 +11,5 @@ processes. Maintainer: Gregory R. Warnes License: GPL-2 +URL: https://r-forge.r-project.org/projects/r-gregmisc/ +BugReports: https://r-forge.r-project.org/tracker/?func=browse&group_id=2031&atid=5378 Modified: pkg/gdata/DESCRIPTION =================================================================== --- pkg/gdata/DESCRIPTION 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/gdata/DESCRIPTION 2015-07-22 00:48:51 UTC (rev 2062) @@ -22,7 +22,7 @@ scalar and vector arguments ('resample'). Depends: R (>= 2.3.0) SystemRequirements: perl (>= 5.10.0) -Imports: gtools +Imports: gtools, stats, methods, utils Version: 2.17.0 Date: 2015-07-02 Author: Gregory R. Warnes, Ben Bolker, Gregor Gorjanc, Gabor Modified: pkg/gdata/NAMESPACE =================================================================== --- pkg/gdata/NAMESPACE 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/gdata/NAMESPACE 2015-07-22 00:48:51 UTC (rev 2062) @@ -66,6 +66,8 @@ importFrom(stats, reorder) importFrom(stats, nobs) importFrom(gtools, mixedsort) +importFrom(methods, is) +importFrom(utils, data, download.file, head, read.csv, read.delim, read.table, tail, write.table) S3method(reorder, factor) @@ -161,3 +163,5 @@ S3method(left, matrix) S3method(right, data.frame) S3method(right, matrix) + + Modified: pkg/gdata/tests/test.humanReadable.Rout.save =================================================================== --- pkg/gdata/tests/test.humanReadable.Rout.save 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/gdata/tests/test.humanReadable.Rout.save 2015-07-22 00:48:51 UTC (rev 2062) @@ -235,4 +235,4 @@ > > proc.time() user system elapsed - 0.414 0.050 0.461 + 0.421 0.052 0.464 Modified: pkg/gdata/tests/test.read.xls.R =================================================================== --- pkg/gdata/tests/test.read.xls.R 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/gdata/tests/test.read.xls.R 2015-07-22 00:48:51 UTC (rev 2062) @@ -29,26 +29,27 @@ # see the number and names of sheets: sheetCount(exampleFile) -if( 'XLSX' %in% xlsFormats() ) +if(! 'XLSX' %in% xlsFormats() ) { + cat("************************************************************\n") + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + cat("************************************************************\n") + } else { sheetCount(exampleFileX) - } else { - cat("************************************************************\n") - cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") - cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") - cat("************************************************************\n") } + sheetNames(exampleFile) -if( 'XLSX' %in% xlsFormats() ) +if(! 'XLSX' %in% xlsFormats() ) { + cat("************************************************************\n") + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + cat("************************************************************\n") + } else { sheetNames(exampleFileX) - } else { - cat("************************************************************\n") - cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") - cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") - cat("************************************************************\n") } @@ -64,8 +65,13 @@ example.4 <- read.xls(exampleFile, sheet=4, header=FALSE) # fourth worksheet by number example.4 -if( 'XLSX' %in% xlsFormats() ) +if(! 'XLSX' %in% xlsFormats() ) { + cat("************************************************************\n") + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + cat("************************************************************\n") + } else { example.x.1 <- read.xls(exampleFileX, sheet=1) # default is first worksheet print(example.x.1) @@ -84,9 +90,6 @@ # load the third worksheet, skipping the first two non-data lines... data <- read.xls(exampleFileX, sheet="Sheet with initial text", skip=2) print(data) - } else { - cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") - cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") } ## Check handling of skip.blank.lines=FALSE @@ -94,18 +97,19 @@ example.skip <- read.xls(exampleFile, sheet=2, blank.lines.skip=FALSE) example.skip -if( 'XLSX' %in% xlsFormats() ) +if(! 'XLSX' %in% xlsFormats() ) { + cat("************************************************************\n") + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + cat("************************************************************\n") + } else { example.x.skip <- read.xls(exampleFileX, sheet=2, blank.lines.skip=FALSE) example.x.skip - } else { - cat("************************************************************\n") - cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") - cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") - cat("************************************************************\n") } + ## Check handing of fileEncoding for latin-1 characters latin1File <- file.path(path.package('gdata'),'xls', 'latin-1.xls' ) @@ -124,8 +128,13 @@ stringsAsFactors=FALSE) } -if( 'XLSX' %in% xlsFormats() ) +if(! 'XLSX' %in% xlsFormats() ) { + cat("************************************************************\n") + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + cat("************************************************************\n") + } else { if(.Platform$OS.type=="unix") { example.latin1.x <- read.xls(latin1FileX, @@ -138,12 +147,7 @@ encoding='latin1', stringsAsFactors=FALSE) } - } else { - cat("************************************************************\n") - cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") - cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") - cat("************************************************************\n") -} + } ## Check handling of very wide file @@ -154,13 +158,15 @@ example.wide <- read.xls(wideFile) stopifnot(dim(example.wide)==c(0,256)) -if( 'XLSX' %in% xlsFormats() ) +if( !'XLSX' %in% xlsFormats() ) { - example.wide.x <- read.xls(wideFileX) - stopifnot(dim(example.wide.x)==c(0,16384)) + cat("************************************************************\n") + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + cat("************************************************************\n") } else { - cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") - cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + example.wide.x <- read.xls(wideFileX) + stopifnot(dim(example.wide.x)==c(0,16384)) } ## Check handling of files with dates calulcated relative to Modified: pkg/gdata/tests/test.read.xls.Rout.save =================================================================== --- pkg/gdata/tests/test.read.xls.Rout.save 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/gdata/tests/test.read.xls.Rout.save 2015-07-22 00:48:51 UTC (rev 2062) @@ -514,29 +514,30 @@ > sheetCount(exampleFile) [1] 4 > -> if( 'XLSX' %in% xlsFormats() ) +> if(! 'XLSX' %in% xlsFormats() ) + { ++ cat("************************************************************\n") ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") ++ cat("************************************************************\n") ++ } else { + sheetCount(exampleFileX) -+ } else { -+ cat("************************************************************\n") -+ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") -+ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") -+ cat("************************************************************\n") + } [1] 4 > +> > sheetNames(exampleFile) [1] "Sheet First" "Sheet Second" [3] "Sheet with a very long name!" "Sheet with initial text" > -> if( 'XLSX' %in% xlsFormats() ) +> if(! 'XLSX' %in% xlsFormats() ) + { ++ cat("************************************************************\n") ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") ++ cat("************************************************************\n") ++ } else { + sheetNames(exampleFileX) -+ } else { -+ cat("************************************************************\n") -+ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") -+ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") -+ cat("************************************************************\n") + } [1] "Sheet First" "Sheet Second" [3] "Sheet with a very long name!" "Sheet with initial text" @@ -605,8 +606,13 @@ 6 ThirdRow 3 2 1 Red 7 FourthRow 4 3 2 1 Black > -> if( 'XLSX' %in% xlsFormats() ) +> if(! 'XLSX' %in% xlsFormats() ) + { ++ cat("************************************************************\n") ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") ++ cat("************************************************************\n") ++ } else { + example.x.1 <- read.xls(exampleFileX, sheet=1) # default is first worksheet + print(example.x.1) + @@ -625,9 +631,6 @@ + # load the third worksheet, skipping the first two non-data lines... + data <- read.xls(exampleFileX, sheet="Sheet with initial text", skip=2) + print(data) -+ } else { -+ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") -+ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + } A B C 1 1 1 1 @@ -702,15 +705,15 @@ 4 ThirdRow 3 2 1 NA Red 5 FourthRow 4 3 2 1 Black > -> if( 'XLSX' %in% xlsFormats() ) +> if(! 'XLSX' %in% xlsFormats() ) + { ++ cat("************************************************************\n") ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") ++ cat("************************************************************\n") ++ } else { + example.x.skip <- read.xls(exampleFileX, sheet=2, blank.lines.skip=FALSE) + example.x.skip -+ } else { -+ cat("************************************************************\n") -+ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") -+ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") -+ cat("************************************************************\n") + } X D E. F G Factor 1 FirstRow 1 NA NA NA Red @@ -720,6 +723,7 @@ 5 FourthRow 4 3 2 1 Black > > +> > ## Check handing of fileEncoding for latin-1 characters > > latin1File <- file.path(path.package('gdata'),'xls', 'latin-1.xls' ) @@ -738,8 +742,13 @@ + stringsAsFactors=FALSE) + } > -> if( 'XLSX' %in% xlsFormats() ) +> if(! 'XLSX' %in% xlsFormats() ) + { ++ cat("************************************************************\n") ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") ++ cat("************************************************************\n") ++ } else { + if(.Platform$OS.type=="unix") + { + example.latin1.x <- read.xls(latin1FileX, @@ -752,12 +761,7 @@ + encoding='latin1', + stringsAsFactors=FALSE) + } -+ } else { -+ cat("************************************************************\n") -+ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") -+ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") -+ cat("************************************************************\n") -+ } ++ } > > > ## Check handling of very wide file @@ -768,13 +772,15 @@ > example.wide <- read.xls(wideFile) > stopifnot(dim(example.wide)==c(0,256)) > -> if( 'XLSX' %in% xlsFormats() ) +> if( !'XLSX' %in% xlsFormats() ) + { -+ example.wide.x <- read.xls(wideFileX) -+ stopifnot(dim(example.wide.x)==c(0,16384)) ++ cat("************************************************************\n") ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") ++ cat("************************************************************\n") + } else { -+ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") -+ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") ++ example.wide.x <- read.xls(wideFileX) ++ stopifnot(dim(example.wide.x)==c(0,16384)) + } > > ## Check handling of files with dates calulcated relative to @@ -898,4 +904,4 @@ > > proc.time() user system elapsed - 14.560 0.980 15.861 + 13.495 0.834 14.549 Modified: pkg/gdata/tests/test.reorder.factor.Rout.save =================================================================== --- pkg/gdata/tests/test.reorder.factor.Rout.save 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/gdata/tests/test.reorder.factor.Rout.save 2015-07-22 00:48:51 UTC (rev 2062) @@ -53,4 +53,4 @@ > > proc.time() user system elapsed - 0.411 0.059 0.489 + 0.341 0.046 0.381 Modified: pkg/gdata/tests/tests.write.fwf.Rout.save =================================================================== --- pkg/gdata/tests/tests.write.fwf.Rout.save 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/gdata/tests/tests.write.fwf.Rout.save 2015-07-22 00:48:51 UTC (rev 2062) @@ -231,4 +231,4 @@ > > proc.time() user system elapsed - 0.517 0.054 0.583 + 0.426 0.048 0.462 Modified: pkg/gmodels/tests/lme-test.R =================================================================== --- pkg/gmodels/test/lme-test.R 2015-06-29 22:40:22 UTC (rev 2055) +++ pkg/gmodels/tests/lme-test.R 2015-07-22 00:48:51 UTC (rev 2062) @@ -1,76 +1,76 @@ -library(gmodels) -library(lme4) -set.seed(314159) +## library(gmodels) +## library(lme4) +## set.seed(314159) -sleepstudy$dayGroup <- cut(sleepstudy$Days, seq(-1,9,by=2), include=T) +## sleepstudy$dayGroup <- cut(sleepstudy$Days, seq(-1,9,by=2), include=T) -# ci example -fm2 <- lmer(Reaction ~ dayGroup + (1|Subject) + (0+Days|Subject), sleepstudy) -ci(fm2) +## # ci example +## fm2 <- lmer(Reaction ~ dayGroup + (1|Subject) + (0+Days|Subject), sleepstudy) +## ci(fm2) -# estimable examples -estimable(fm2, c( 0, -1, 1, 0, 0 ) ) # list all terms -estimable(fm2, c("dayGroup(1,3]"=-1, "dayGroup(3,5]"=1)) # just the nonzero terms -estimable(fm2, c("dayGroup(1,3]"=-1, "dayGroup(3,5]"=1), n.sim=5000 ) # more simulations... +## # estimable examples +## estimable(fm2, c( 0, -1, 1, 0, 0 ) ) # list all terms +## estimable(fm2, c("dayGroup(1,3]"=-1, "dayGroup(3,5]"=1)) # just the nonzero terms +## estimable(fm2, c("dayGroup(1,3]"=-1, "dayGroup(3,5]"=1), n.sim=5000 ) # more simulations... -# fit.contrast example -fit.contrast( fm2, "dayGroup", - rbind("0-1 vs 3-4"=c(-1,0,1,0,0), - "3-4 vs 5-6"=c(0,0,-1,1,0) - ), - conf=0.95 ) +## # fit.contrast example +## fit.contrast( fm2, "dayGroup", +## rbind("0-1 vs 3-4"=c(-1,0,1,0,0), +## "3-4 vs 5-6"=c(0,0,-1,1,0) +## ), +## conf=0.95 ) -# Example from Ariel.Muldoon at oregonstate.edu -homerange=c( - "male","1","fall","0.1", - "male","1","winter","0.3", - "male","1","spring","5.2", - "male","1","summer","3.1", - "male","2","fall","3.4", - "male","2","winter","1.3", - "male","2","spring","4.8", - "male","2","summer","4.3", - "male","3","fall","3.9", - "male","3","winter","3.8", - "male","3","spring","5.7", - "male","3","summer","2.0", - "male","4","fall","3.7", - "male","4","winter","4.3", - "male","4","spring","6.0", - "male","4","summer","1.8", - "female","5","fall","4.3", - "female","5","winter","1.9", - "female","5","spring","7.2", - "female","5","summer","6.9", - "female","6","fall","5.3", - "female","6","winter","4.3", - "female","6","spring","6.2", - "female","6","summer","4.8", - "female","7","fall","7.1", - "female","7","winter","4.9", - "female","7","spring","8.3", - "female","7","summer","7.7" - ) - -homerange <- data.frame(matrix(homerange,ncol=4, byrow=T)) -names(homerange) <- c("sex", "animal", "season", "area") -homerange$area = as.numeric(as.character(homerange$area)) +## # Example from Ariel.Muldoon at oregonstate.edu +## homerange=c( +## "male","1","fall","0.1", +## "male","1","winter","0.3", +## "male","1","spring","5.2", +## "male","1","summer","3.1", +## "male","2","fall","3.4", +## "male","2","winter","1.3", +## "male","2","spring","4.8", +## "male","2","summer","4.3", +## "male","3","fall","3.9", +## "male","3","winter","3.8", +## "male","3","spring","5.7", +## "male","3","summer","2.0", +## "male","4","fall","3.7", +## "male","4","winter","4.3", +## "male","4","spring","6.0", +## "male","4","summer","1.8", +## "female","5","fall","4.3", +## "female","5","winter","1.9", +## "female","5","spring","7.2", +## "female","5","summer","6.9", +## "female","6","fall","5.3", +## "female","6","winter","4.3", +## "female","6","spring","6.2", +## "female","6","summer","4.8", +## "female","7","fall","7.1", +## "female","7","winter","4.9", +## "female","7","spring","8.3", +## "female","7","summer","7.7" +## ) -fit1 <- lmer(area ~ sex*season + (1|animal), data=homerange) -summary(fit1) -anova(fit1) - +## homerange <- data.frame(matrix(homerange,ncol=4, byrow=T)) +## names(homerange) <- c("sex", "animal", "season", "area") +## homerange$area = as.numeric(as.character(homerange$area)) -#matrix to give estimable for making estimates +## fit1 <- lmer(area ~ sex*season + (1|animal), data=homerange) +## summary(fit1) +## anova(fit1) -spr <- rbind(c(1,0,1,0,0,0,0,0), - c(1,1,0,0,0,1,0,0), - c(1,0,0,1,0,0,0,0), - c(1,1,0,0,0,0,1,0), - c(1,0,0,0,1,0,0,0), - c(1,1,0,0,0,0,0,1)) - -estimable(fit1, spr) +## #matrix to give estimable for making estimates + +## spr <- rbind(c(1,0,1,0,0,0,0,0), +## c(1,1,0,0,0,1,0,0), +## c(1,0,0,1,0,0,0,0), +## c(1,1,0,0,0,0,1,0), +## c(1,0,0,0,1,0,0,0), +## c(1,1,0,0,0,0,0,1)) + + +## estimable(fit1, spr) Modified: pkg/gplots/DESCRIPTION =================================================================== --- pkg/gplots/DESCRIPTION 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/gplots/DESCRIPTION 2015-07-22 00:48:51 UTC (rev 2062) @@ -1,7 +1,7 @@ Package: gplots Title: Various R Programming Tools for Plotting Data Description: Various R programming tools for plotting data, including: - - calculating and plotting locally smoothed summary functionas + - calculating and plotting locally smoothed summary functionals ('bandplot', 'wapply'), - enhanced versions of standard plots ('barplot2', 'boxplot2', 'heatmap.2', 'smartlegend'), @@ -14,11 +14,11 @@ - displaying textual data in plots ('textplot', 'sinkplot'), - plotting a matrix where each cell contains a dot whose size reflects the relative magnitude of the elements ('balloonplot'), - - plotting venn diagrams ('venn'), - - displaying Open-Office syle plots ('ooplot'), - - plotting multiple datasets on same region, with separate axes + - plotting Venn diagrams ('venn'), + - displaying Open-Office style plots ('ooplot'), + - plotting multiple data sets on same region, with separate axes ('overplot'), - - plotting means and cofidence intervals ('plotCI', 'plotmeans'), + - plotting means and confidence intervals ('plotCI', 'plotmeans'), - spacing points in an x-y plot so they don't overlap ('space'). Depends: R (>= 3.0) Imports: gtools, gdata, stats, caTools, KernSmooth Modified: pkg/gplots/R/heatmap.2.R =================================================================== --- pkg/gplots/R/heatmap.2.R 2015-07-20 23:38:07 UTC (rev 2061) +++ pkg/gplots/R/heatmap.2.R 2015-07-22 00:48:51 UTC (rev 2062) @@ -107,6 +107,9 @@ if(length(col)==1 && is.character(col) ) col <- get(col, mode="function") + if(!missing(breaks) && any(duplicated(breaks)) ) + stop("breaks may not contian duplicate values") + if(!missing(breaks) && (scale!="none")) warning("Using scale=\"row\" or scale=\"column\" when breaks are", "specified can produce unpredictable results.", @@ -384,14 +387,18 @@ on.exit(par(op)) layout(lmat, widths = lwid, heights = lhei, respect = FALSE) + plot.index <- 1 + ## draw the side bars if(!missing(RowSideColors)) { par(mar = c(margins[1],0, 0,0.5)) image(rbind(1:nr), col = RowSideColors[rowInd], axes = FALSE) + plot.index <- plot.index + 1 } if(!missing(ColSideColors)) { par(mar = c(0.5,0, 0,margins[2])) image(cbind(1:nc), col = ColSideColors[colInd], axes = FALSE) + plot.index <- plot.index + 1 } ## draw the main carpet par(mar = c(margins[1], 0, 0, margins[2])) @@ -576,6 +583,13 @@ col=notecol, cex=notecex) + plot.index <- plot.index + 1 + + ## increment plot.index and then do + ## latout_set( lmat, plot.index ) + ## to set to the correct plot region, instead of + ## relying on plot.new(). + ## the two dendrograms : par(mar = c(margins[1], 0, 0, 0)) if( dendrogram %in% c("both","row") ) @@ -614,6 +628,7 @@ if(!is.null(main)) title(main, cex.main = 1.5*op[["cex.main"]]) ## Add the color-key + browser() if(key) { mar <- c(5, 4, 2, 1) @@ -721,7 +736,6 @@ if (is.null(key.title)) title("Color Key") - if(trace %in% c("both","column") ) { vline.vals <- scale01(vline, min.raw, max.raw) Added: pkg/gplots/R/layout_set.R =================================================================== --- pkg/gplots/R/layout_set.R (rev 0) +++ pkg/gplots/R/layout_set.R 2015-07-22 00:48:51 UTC (rev 2062) @@ -0,0 +1,13 @@ +layout_set <- function(mat, index) + { + mfg <- par("mfg") + mfg[1:2] = which(mat==index, arr.ind=TRUE)[1,] + par(mfg=mfg) + invisible(mfg) + } + +layout_show <- function(mat) + { + graphics::layout.show( max(mat) ) + mat + } From noreply at r-forge.r-project.org Wed Jul 22 02:53:31 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 22 Jul 2015 02:53:31 +0200 (CEST) Subject: [R-gregmisc-commits] r2063 - pkg/gmodels Message-ID: <20150722005331.86FD3187714@r-forge.r-project.org> Author: warnes Date: 2015-07-22 02:53:30 +0200 (Wed, 22 Jul 2015) New Revision: 2063 Modified: pkg/gmodels/DESCRIPTION Log: Update gmodels DESCRIPTION Modified: pkg/gmodels/DESCRIPTION =================================================================== --- pkg/gmodels/DESCRIPTION 2015-07-22 00:48:51 UTC (rev 2062) +++ pkg/gmodels/DESCRIPTION 2015-07-22 00:53:30 UTC (rev 2063) @@ -1,6 +1,6 @@ Package: gmodels -Version: 2.16.1 -Date: 2015-07-18 +Version: 2.16.2 +Date: 2015-07-21 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