r-gregmisc-users Mailing List for R gregmisc package (Page 36)
Brought to you by:
warnes
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(12) |
Apr
(5) |
May
(3) |
Jun
(5) |
Jul
(2) |
Aug
(5) |
Sep
(7) |
Oct
(15) |
Nov
(34) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(3) |
Feb
(16) |
Mar
(28) |
Apr
(5) |
May
|
Jun
(5) |
Jul
(9) |
Aug
(50) |
Sep
(29) |
Oct
(9) |
Nov
(25) |
Dec
(7) |
2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(8) |
May
(26) |
Jun
(11) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(9) |
2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
(2) |
May
(26) |
Jun
|
Jul
(10) |
Aug
(6) |
Sep
|
Oct
(7) |
Nov
(3) |
Dec
(2) |
2010 |
Jan
(45) |
Feb
(11) |
Mar
|
Apr
(1) |
May
(8) |
Jun
(7) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(9) |
Dec
(1) |
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
(14) |
Sep
(29) |
Oct
(3) |
Nov
|
Dec
(3) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(6) |
Jun
(59) |
Jul
|
Aug
(8) |
Sep
(21) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
(10) |
Apr
|
May
(18) |
Jun
(25) |
Jul
(18) |
Aug
(1) |
Sep
(6) |
Oct
(28) |
Nov
(4) |
Dec
(13) |
2014 |
Jan
(7) |
Feb
(5) |
Mar
(4) |
Apr
(36) |
May
(3) |
Jun
(7) |
Jul
(46) |
Aug
(14) |
Sep
(12) |
Oct
(2) |
Nov
|
Dec
(12) |
2015 |
Jan
(4) |
Feb
|
Mar
|
Apr
(80) |
May
(36) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <wa...@us...> - 2007-08-03 00:40:48
|
Revision: 1113 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1113&view=rev Author: warnes Date: 2007-08-02 17:40:42 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Drop version number to 0.99 until testing integration and is complete Modified Paths: -------------- trunk/SASxport/DESCRIPTION Modified: trunk/SASxport/DESCRIPTION =================================================================== --- trunk/SASxport/DESCRIPTION 2007-08-03 00:39:59 UTC (rev 1112) +++ trunk/SASxport/DESCRIPTION 2007-08-03 00:40:42 UTC (rev 1113) @@ -1,7 +1,7 @@ Package: SASxport Type: Package Title: Read and write SAS export files -Version: 1.0 +Version: 0.99.1 Date: 2007-07-28 Author: Gregory R. Warnes <gr...@ra...> Maintainer: Gregory R. Warnes <gr...@ra...> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-08-03 00:40:01
|
Revision: 1112 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1112&view=rev Author: warnes Date: 2007-08-02 17:39:59 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Add R test file to run c-level tests Added Paths: ----------- trunk/SASxport/tests/test_fields.R Added: trunk/SASxport/tests/test_fields.R =================================================================== --- trunk/SASxport/tests/test_fields.R (rev 0) +++ trunk/SASxport/tests/test_fields.R 2007-08-03 00:39:59 UTC (rev 1112) @@ -0,0 +1,7 @@ +library(SASxport) + +## Call C-level test routines + +.C("doTest",PACKAGE="SASxport") + +## Successful completion means all assertions have been met This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-08-03 00:36:26
|
Revision: 1111 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1111&view=rev Author: warnes Date: 2007-08-02 17:36:25 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Remove .so from svn Removed Paths: ------------- trunk/SASxport/src/SASxport.so Deleted: trunk/SASxport/src/SASxport.so =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-08-03 00:35:41
|
Revision: 1110 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1110&view=rev Author: warnes Date: 2007-08-02 17:35:39 -0700 (Thu, 02 Aug 2007) Log Message: ----------- More modifications. Should now work for most R data types Modified Paths: -------------- trunk/SASxport/NAMESPACE trunk/SASxport/R/write.xport.R trunk/SASxport/R/xport.character.R trunk/SASxport/R/xport.file.header.R trunk/SASxport/R/xport.member.header.R trunk/SASxport/R/xport.namestr.R trunk/SASxport/src/SASxport.so trunk/SASxport/src/writeSAS.c Added Paths: ----------- trunk/SASxport/R/fromSASDate.R trunk/SASxport/R/parseFormat.R trunk/SASxport/R/toSAS.R trunk/SASxport/man/toSAS.Rd Modified: trunk/SASxport/NAMESPACE =================================================================== --- trunk/SASxport/NAMESPACE 2007-08-03 00:35:07 UTC (rev 1109) +++ trunk/SASxport/NAMESPACE 2007-08-03 00:35:39 UTC (rev 1110) @@ -1,5 +1,14 @@ export( - write.xport + write.xport, + toSAS ) +S3method(toSAS,numeric) +S3method(toSAS,logical) +S3method(toSAS,character) +S3method(toSAS,factor) +S3method(toSAS,POSIXt) +S3method(toSAS,Date) +S3method(toSAS,default) + useDynLib(SASxport) Added: trunk/SASxport/R/fromSASDate.R =================================================================== --- trunk/SASxport/R/fromSASDate.R (rev 0) +++ trunk/SASxport/R/fromSASDate.R 2007-08-03 00:35:39 UTC (rev 1110) @@ -0,0 +1,15 @@ +fromSASDate <- function( sDate ) + { + sasBase <- as.Date(strptime("01/01/1960 0:00:00", "%m/%d/%Y %H:%M:%S", tz="GMT")) # days + sasBase + sDate + } + + +fromSASDateTime <- function( sDateTime ) + { + sasBaseSeconds <- as.numeric(ISOdatetime(1960,1,1,0,0,0) - 0) + retval <- sDateTime + sasBaseSeconds + class(retval) <- c("POSIXt","POSIXct") + retval + } + Added: trunk/SASxport/R/parseFormat.R =================================================================== --- trunk/SASxport/R/parseFormat.R (rev 0) +++ trunk/SASxport/R/parseFormat.R 2007-08-03 00:35:39 UTC (rev 1110) @@ -0,0 +1,41 @@ +## Convert SAS format specification string into format name, length, and digits +parseFormat <- function(format) + { + retval <- list("name"="", "len"=0, "digits"=0) + + + if( !is.null(format) && (length(format)==1) && (format > "") ) + { + index <- regexpr("[0-9]+", format) + if(index==-1) + { + retval$name <- format + retval$len <- 0 + retval$digits <- 0 + } + else + { + retval$name <- substr(format,0,index-1)[1] + + lenStr <- substr(format,index, nchar(format)) + + index <- regexpr("\\.", lenStr) + if(index==-1) + { + retval$len <- as.numeric(lenStr) + retval$digits <- 0 + } + else + { + retval$len <- as.numeric(substr(lenStr, 0, index-1)) + retval$digits <- as.numeric(substr(lenStr, index+1, nchar(lenStr))) + } + } + + if(is.na(retval$len)) retval$len <- 0 + if(is.na(retval$digits)) retval$digits <- 0 + + } + + return(retval) + } Added: trunk/SASxport/R/toSAS.R =================================================================== --- trunk/SASxport/R/toSAS.R (rev 0) +++ trunk/SASxport/R/toSAS.R 2007-08-03 00:35:39 UTC (rev 1110) @@ -0,0 +1,55 @@ +toSAS <- function(x, format) + UseMethod("toSAS") + +toSAS.numeric <- function(x, format="") + { + retval <- as.numeric(x) + attr(retval, "format")=format + retval + } + +toSAS.logical <- function(x, format="") + { + retval <- as.character(x) + attr(retval, "format")=format + retval + } + + +toSAS.character <- function(x, format="") + { + retval <- as.character(x) + attr(retval, "format")=format + retval + } + +toSAS.factor <- function(x, format="") + { + retval <- as.character(x) + attr(retval, "format")=format + retval + } + +toSAS.POSIXt <- function( x, format="DATETIME16." ) + { + sasBaseSeconds <- as.numeric(ISOdatetime(1960,1,1,0,0,0)) + retval <- unclass(as.POSIXct(x)) - sasBaseSeconds # sasBaseSeconds is negative + attr(retval,"format") <- format + retval + } + +toSAS.Date <- function(x, format="DATE9." ) + { + sasBase <- as.Date(strptime("01/01/1960", "%m/%d/%Y", tz="GMT")) # days + retval <- as.numeric( as.Date(x) - sasBase) + attr(retval, "format") <- format + retval + } + +toSAS.default <- function(x, format="") + { + retval <- as.character(x) + attr(retval, "format")=format + retval + } + Modified: trunk/SASxport/R/write.xport.R =================================================================== --- trunk/SASxport/R/write.xport.R 2007-08-03 00:35:07 UTC (rev 1109) +++ trunk/SASxport/R/write.xport.R 2007-08-03 00:35:39 UTC (rev 1110) @@ -88,9 +88,14 @@ scat("", i , "...") var <- df[[i]] - # Convert factors to character strings - if(is.factor(var)) df[[i]] <- var <- as.character(var) + # get attribute information before any transformations!" + varLabel <- attr(var, "label") + varFormat <- attr(var, "format") + varIFormat <- attr(var, "iformat") + # Convert R object to SAS object + df[[i]] <- var <- toSAS(var) + # compute variable length if(is.character(var)) varLen <- max(8, max( nchar(var) ) ) @@ -100,12 +105,33 @@ # fill in variable offset and length information offsetTable[i, "len"] <- varLen offsetTable[i, "offset"] <- lenIndex + + + + # parse format and iformat + formatInfo <- parseFormat( varFormat) + iFormatInfo <- parseFormat( varIFormat) + + + # write the entry - out( xport.namestr( - var=var, varName=i, varNum=varIndex, varPos=lenIndex, - varLength=varLen - ) ) + out( + xport.namestr( + var=var, + varName=i, + varNum=varIndex, + varPos=lenIndex, + varLength=varLen, + varLabel=varLabel, + fName = formatInfo$name, + fLength = formatInfo$len, + fDigits = formatInfo$digits, + iName = iFormatInfo$name, + iLength = iFormatInfo$len, + iDigits = iFormatInfo$digits, + ) + ) # increment our counters lenIndex <- lenIndex + varLen @@ -115,7 +141,8 @@ scat("Done.") # Space-fill to 80 character record end - fillSize <- spaceUsed %% 80 + fillSize <- 80 - (spaceUsed %% 80) + if(fillSize==80) fillSize <- 0 out( xport.fill( TRUE, fillSize ) ) scat("Write header for data block ...") @@ -123,7 +150,6 @@ scat("Done") scat("Write data ... "); - counter <- 1 spaceUsed <- 0 for(i in 1:nrow(df) ) for(j in 1:ncol(df) ) @@ -140,9 +166,11 @@ spaceUsed <- spaceUsed + valLen } - fillSize <- spaceUsed %% 80 - out( xport.fill(FALSE, fillSize ) ) + fillSize <- 80 - (spaceUsed %% 80) + if(fillSize==80) fillSize <- 0 + out( xport.fill(TRUE, fillSize ) ) + scat("Done.") } Modified: trunk/SASxport/R/xport.character.R =================================================================== --- trunk/SASxport/R/xport.character.R 2007-08-03 00:35:07 UTC (rev 1109) +++ trunk/SASxport/R/xport.character.R 2007-08-03 00:35:39 UTC (rev 1110) @@ -1,6 +1,8 @@ xport.character <- function( value, width ) { if(length(value)!=1) stop("Only a single character value is permitted.") + + if(is.na(value)) value <- "" .C("fill_character_field", value = as.character(value), Modified: trunk/SASxport/R/xport.file.header.R =================================================================== --- trunk/SASxport/R/xport.file.header.R 2007-08-03 00:35:07 UTC (rev 1109) +++ trunk/SASxport/R/xport.file.header.R 2007-08-03 00:35:39 UTC (rev 1110) @@ -2,10 +2,10 @@ function( cDate=Sys.time(), mDate=cDate, sasVer="7.00", osType="Unknown" ) { .C("fill_file_header", - cDate = xport.dateFMT(cDate), # creation date - mDate = xport.dateFMT(mDate), # modification date + cDate = xport.dateFMT(cDate), # Creation date + mDate = xport.dateFMT(mDate), # Modification date sasVer = toupper(as.character(sasVer)), # SAS version number - osType = toupper(as.character(osType)), # operating system + osType = as.character(osType), # Operating System (can include lowercase) PACKAGE="SASxport" ) Modified: trunk/SASxport/R/xport.member.header.R =================================================================== --- trunk/SASxport/R/xport.member.header.R 2007-08-03 00:35:07 UTC (rev 1109) +++ trunk/SASxport/R/xport.member.header.R 2007-08-03 00:35:39 UTC (rev 1110) @@ -4,7 +4,7 @@ .C("fill_member_header", dfName = toupper(as.character(dfName)), # Name of data set sasVer = toupper(as.character(sasVer)), # SAS version number - osType = toupper(as.character(osType)), # Operating System + osType = as.character(osType), # Operating System (can include lowercase) cDate = xport.dateFMT(cDate), # Creation date mDate = xport.dateFMT(mDate), # modification date PACKAGE="SASxport" Modified: trunk/SASxport/R/xport.namestr.R =================================================================== --- trunk/SASxport/R/xport.namestr.R 2007-08-03 00:35:07 UTC (rev 1109) +++ trunk/SASxport/R/xport.namestr.R 2007-08-03 00:35:39 UTC (rev 1110) @@ -33,13 +33,8 @@ else varLength <- 8 -# if(missing(varLabel) || is.null(varLabel) ) -# { -# varLabel <- attr(var, "label") -# if(is.null(varLabel)) -# varLabel <- varName -# } - varLabel="" + if( missing(varLabel) || is.null(varLabel) ) + varLabel <- "" just <- match.arg(just) if(just=="left") Added: trunk/SASxport/man/toSAS.Rd =================================================================== --- trunk/SASxport/man/toSAS.Rd (rev 0) +++ trunk/SASxport/man/toSAS.Rd 2007-08-03 00:35:39 UTC (rev 1110) @@ -0,0 +1,90 @@ +\name{toSAS.default} +alias{toSAS} +alias{toSAS.numeric} +alias{toSAS.logical} +alias{toSAS.character} +alias{toSAS.factor} +alias{toSAS.POSIXt} +alias{toSAS.Date} +alias{toSAS.default} +\title{Convert R data object for storage in SAS xport file} +\description{ + The \code{toSAS} methods control how R objects and data types are + represented when stored into a SAS xport format file using + \code{write.xport}. +} +\usage{ +toSAS(x, format) +\method{toSAS}{default}(x, format="") +\method{toSAS}{numeric}(x, format="") +\method{toSAS}{logical}(x, format="") +\method{toSAS}{character}(x, format="") +\method{toSAS}{factor}(x, format="") +\method{toSAS}{POSIXt}( x, format="DATETIME16." ) +\method{toSAS}{Date}(x, format="DATE9." ) +} +\arguments{ + \item{x}{ Object to be converted } + \item{format}{SAS format name} +} +\details{ + To add support for a new object type, create an appropriate + \code{toSAS} method. This method must convert the object data to + either an object of type "numeric" or type "character", and should add + an attribute named "format" to the object providing an appropriate SAS + format string or "" (indicating the default SAS format). +} +\value{ + A vector of type "character" or of type "numeric", with an attribute + named "lable" containing the SAS format specification. +} +\author{ Gregory R. Warnes \email{gr...@ra...} } +\seealso{ + \code{\link{write.xport}}, + \code{\link{read.xport}}, + \code{\link{lookup.xport}} +} +\examples{ + +#### +## See how an R date object will be stored in a SAS xport file: +#### + +dateObj <- ISOdate(2007,08,01,10,14,37) +dateObj + +sasObj <- toSAS(dateObj) +str(sasObj) + +#### +## Create a new R object class based on factor to hold color names +#### +colorFactor <- function(x) # constructor + { + retval <- factor(x, levels=c("Red","Green","Blue") ) + class(retval) <- c("colorFactor","factor") + retval + } + +## create one and look at it +cf <- colorFactor( c("Red","Red","Blue",NA) ) + + +## See how it will be represented in a SAS xport file +toSAS(cf) +class(toSAS(cf)) + +## Create a new conversion function to store as a RGB hex value +toSAS.colorFactor <- function(x, format="") +{ + retval <- ifelse(x=="Red", "#FF0000", ifelse(x=="Green", "#00FF00", "#0000FF") ) + attr(retval, "format") <- format + retval +} + +## see it in action +toSAS(cf) + +} +\keyword{manip} +\keyword{IO} Modified: trunk/SASxport/src/SASxport.so =================================================================== (Binary files differ) Modified: trunk/SASxport/src/writeSAS.c =================================================================== --- trunk/SASxport/src/writeSAS.c 2007-08-03 00:35:07 UTC (rev 1109) +++ trunk/SASxport/src/writeSAS.c 2007-08-03 00:35:39 UTC (rev 1110) @@ -328,7 +328,6 @@ static char numeric_NA[8] = {0x2e,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; memcpy(raw_buffer, numeric_NA, 8); - REVERSE(raw_buffer, 8); raw_buffer_used = 8; return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-08-03 00:35:19
|
Revision: 1109 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1109&view=rev Author: warnes Date: 2007-08-02 17:35:07 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Add more tests Added Paths: ----------- trunk/SASxport/tests/cars.R trunk/SASxport/tests/datetime.xpt trunk/SASxport/tests/testDates.R trunk/SASxport/tests/xxx.R Added: trunk/SASxport/tests/cars.R =================================================================== --- trunk/SASxport/tests/cars.R (rev 0) +++ trunk/SASxport/tests/cars.R 2007-08-03 00:35:07 UTC (rev 1109) @@ -0,0 +1,25 @@ +library(SASxport) + + +cars <- read.table(file="cars.sas", skip=3, nrows=26, + col.names=c("MAKE","PRICE","MPG","REP78","FOREIGN"), + header=F) + +head(cars, n=5) + +summary(cars) + +write.xport(cars, + filename="cars2.xpt", + cDate=strptime("28JUL07: 20:59:49", format="%d%b%y:%H:%M:%S"), + osType="SunOS", + sasVer="9.1" +) + + +## Load both files back in as raw data +a.1 <- readBin( con="cars.xpt", what=raw(), n=1e5) +a.2 <- readBin( con="cars2.xpt", what=raw(), n=1e5) + +## Test that the files are identical +assert( all(a.1 == a.2) ) Added: trunk/SASxport/tests/datetime.xpt =================================================================== (Binary files differ) Property changes on: trunk/SASxport/tests/datetime.xpt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/SASxport/tests/testDates.R =================================================================== --- trunk/SASxport/tests/testDates.R (rev 0) +++ trunk/SASxport/tests/testDates.R 2007-08-03 00:35:07 UTC (rev 1109) @@ -0,0 +1,23 @@ +library(SASxport) + +## Create a small data set containing dates, times, and date-times + +dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92") +times <- c("23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26") + + +temp <- data.frame(x=c(1, 2, 3, 4, 5 ), + y=c('a', 'B', 'c', 'd', 'e' ), + dates=strptime(dates, "%m/%d/%y"), + datetimes=strptime( paste(dates,times), "%m/%d/%y %H:%M:%S") +) + +print(temp) + +write.xport( DATETIME=temp, filename="datetime.xpt") +temp2 <- read.xport(file="datetime.xpt") + +print(temp2) + + +identical(temp, temp2) Added: trunk/SASxport/tests/xxx.R =================================================================== --- trunk/SASxport/tests/xxx.R (rev 0) +++ trunk/SASxport/tests/xxx.R 2007-08-03 00:35:07 UTC (rev 1109) @@ -0,0 +1,54 @@ +library(SASxport) + +## manually create a data set +abc <- data.frame( x=c(1, 2, NA, NA ), y=c('a', 'B', NA, '*' ) ) + +## add a format specifier (not used by R) +attr(abc$x, 'format') <- 'date7.' + +## add a variable label (not used by R) +attr(abc$y, 'label') <- 'character variable' + +# create a SAS XPORT file from our local data fram +write.xport(abc, + filename="xxx2.xpt", + cDate=strptime("28JUL07:21:08:06 ", format="%d%b%y:%H:%M:%S"), + osType="SunOS", + sasVer="9.1" + ) + +# read the original SAS data file +abc.SAS <- read.xport("xxx.xpt") + +## read.xport currently doesn't store the format and label attributes... +attr(abc.SAS$X, 'format') <- 'date7.' +attr(abc.SAS$Y, 'label') <- 'character variable' + +# create a SAS XPORT file from the SAS data +write.xport(abc=abc.SAS, + filename="xxx3.xpt", + cDate=strptime("28JUL07:21:08:06 ", format="%d%b%y:%H:%M:%S"), + osType="SunOS", + sasVer="9.1" + ) + + + + +## Load both files back in as raw data +a.1 <- readBin( con="xxx.xpt", what=raw(), n=1e5 ) +a.2 <- readBin( con="xxx2.xpt", what=raw(), n=1e5 ) +a.3 <- readBin( con="xxx3.xpt", what=raw(), n=1e5 ) + +## R doesn't have multiple NA types, while SAS does. The original +## file contains a SAS '.A' missing value, while what we've created +## contains an ordinary '.' missing value, so mash this one byte to +## avoid a comparison error for this know limitation. + +a.1[1089] <- as.raw("0x2e") + +## Test that the files are otherwise identical +assert( all(a.1 == a.2) ) +assert( all(a.1 == a.3) ) + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-07-30 17:18:16
|
Revision: 1108 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1108&view=rev Author: warnes Date: 2007-07-30 10:18:15 -0700 (Mon, 30 Jul 2007) Log Message: ----------- Add JSM 2007 talk Added Paths: ----------- trunk/exp.ssize/inst/Presentation/Warnes-SampleSize-Omics.ppt Added: trunk/exp.ssize/inst/Presentation/Warnes-SampleSize-Omics.ppt =================================================================== (Binary files differ) Property changes on: trunk/exp.ssize/inst/Presentation/Warnes-SampleSize-Omics.ppt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-07-29 01:15:24
|
Revision: 1107 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1107&view=rev Author: warnes Date: 2007-07-28 18:15:04 -0700 (Sat, 28 Jul 2007) Log Message: ----------- Add SAS code to create xport data files for testing Added Paths: ----------- trunk/SASxport/tests/cars.sas trunk/SASxport/tests/cars.xpt trunk/SASxport/tests/xxx.sas trunk/SASxport/tests/xxx.xpt Removed Paths: ------------- trunk/SASxport/tests/Alfalfa2.xpt Deleted: trunk/SASxport/tests/Alfalfa2.xpt =================================================================== (Binary files differ) Added: trunk/SASxport/tests/cars.sas =================================================================== --- trunk/SASxport/tests/cars.sas (rev 0) +++ trunk/SASxport/tests/cars.sas 2007-07-29 01:15:04 UTC (rev 1107) @@ -0,0 +1,44 @@ +DATA cars1; + input MAKE $ PRICE MPG REP78 FOREIGN; +DATALINES; +AMC 4099 22 3 0 +AMC 4749 17 3 0 +AMC 3799 22 3 0 +Audi 9690 17 5 1 +Audi 6295 23 3 1 +BMW 9735 25 4 1 +Buick 4816 20 3 0 +Buick 7827 15 4 0 +Buick 5788 18 3 0 +Buick 4453 26 3 0 +Buick 5189 20 3 0 +Buick 10372 16 3 0 +Buick 4082 19 3 0 +Cad. 11385 14 3 0 +Cad. 14500 14 2 0 +Cad. 15906 21 3 0 +Chev. 3299 29 3 0 +Chev. 5705 16 4 0 +Chev. 4504 22 3 0 +Chev. 5104 22 2 0 +Chev. 3667 24 2 0 +Chev. 3955 19 3 0 +Datsun 6229 23 4 1 +Datsun 4589 35 5 1 +Datsun 5079 24 4 1 +Datsun 8129 21 4 1 +; +RUN; + +PROC PRINT DATA=cars1(obs=5); +RUN; + +PROC MEANS DATA=cars1; +RUN; + +LIBNAME out XPORT './cars.xpt'; + +DATA out.cars; + SET cars1; +RUN; + Added: trunk/SASxport/tests/cars.xpt =================================================================== (Binary files differ) Property changes on: trunk/SASxport/tests/cars.xpt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/SASxport/tests/xxx.sas =================================================================== --- trunk/SASxport/tests/xxx.sas (rev 0) +++ trunk/SASxport/tests/xxx.sas 2007-07-29 01:15:04 UTC (rev 1107) @@ -0,0 +1,12 @@ +libname xxx xport 'xxx.xpt'; +data temp; input x y $ @@; cards; +1 a 2 B . . .a * +run; +data temp; set temp; +format x date7.; label y='character variable'; run; +proc print data=temp; format x y ; run; +proc print data=temp; run; +proc contents; run; +data xxx.abc; set; run; +options ls=132; +data _null_; infile 'xxx.xpt' recfm=f lrecl=80; input x $char80.;list;run; Added: trunk/SASxport/tests/xxx.xpt =================================================================== (Binary files differ) Property changes on: trunk/SASxport/tests/xxx.xpt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-07-26 00:20:02
|
Revision: 1105 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1105&view=rev Author: warnes Date: 2007-07-25 17:20:00 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Add support for mlm to estimable(). Modified Paths: -------------- trunk/gmodels/DESCRIPTION trunk/gmodels/NAMESPACE trunk/gmodels/NEWS trunk/gmodels/R/estimable.mlm.R trunk/gmodels/man/estimable.Rd Modified: trunk/gmodels/DESCRIPTION =================================================================== --- trunk/gmodels/DESCRIPTION 2007-07-26 00:10:03 UTC (rev 1104) +++ trunk/gmodels/DESCRIPTION 2007-07-26 00:20:00 UTC (rev 1105) @@ -1,5 +1,5 @@ Package: gmodels -Version: 2.13.2 +Version: 2.14.0 Title: Various R programming tools for model fitting Author: Gregory R. Warnes. Includes R source code and/or documentation contributed by Ben Bolker, Thomas Lumley, and Randall C Johnson. @@ -15,5 +15,4 @@ Contract NO1-CO-12400. URL: http://cran.r-project.org/src/contrib/PACKAGES.html http://www.sf.net/projects/r-gregmisc -Packaged: Mon Jun 5 16:19:14 2006; root -Date: 2007-03-09 \ No newline at end of file +Date: 2007-07-24 \ No newline at end of file Modified: trunk/gmodels/NAMESPACE =================================================================== --- trunk/gmodels/NAMESPACE 2007-07-26 00:10:03 UTC (rev 1104) +++ trunk/gmodels/NAMESPACE 2007-07-26 00:20:00 UTC (rev 1105) @@ -26,6 +26,7 @@ S3method(estimable, default) S3method(estimable, lmer) +S3method(estimable, mlm) S3method(print, glh.test) S3method(summary, glh.test) Modified: trunk/gmodels/NEWS =================================================================== --- trunk/gmodels/NEWS 2007-07-26 00:10:03 UTC (rev 1104) +++ trunk/gmodels/NEWS 2007-07-26 00:20:00 UTC (rev 1105) @@ -1,6 +1,14 @@ Version 2.13.2 -------------- +New Features: + +- Add support for 'mlm' objects to estimable + + +Version 2.13.2 +-------------- + Bug Fixes: - Lower and upper end of confidence interval for lmer objects were Modified: trunk/gmodels/R/estimable.mlm.R =================================================================== --- trunk/gmodels/R/estimable.mlm.R 2007-07-26 00:10:03 UTC (rev 1104) +++ trunk/gmodels/R/estimable.mlm.R 2007-07-26 00:20:00 UTC (rev 1105) @@ -1,5 +1,5 @@ `estimable.mlm` <- - function (object, ...) + function (obj, cm, beta0, conf.int=NULL, show.beta0, ...) { coef <- coef(object) ny <- ncol(coef) @@ -23,7 +23,7 @@ object$fitted.values <- fitted[, i] object$effects <- effects[, i] object$call$formula[[2]] <- object$terms[[2]] <- as.name(ynames[i]) - value[[i]] <- estimable(object, ...) + value[[i]] <- estimable(obj, cm, beta0, conf.int=NULL, show.beta0, ...) } class(value) <- "listof" value Modified: trunk/gmodels/man/estimable.Rd =================================================================== --- trunk/gmodels/man/estimable.Rd 2007-07-26 00:10:03 UTC (rev 1104) +++ trunk/gmodels/man/estimable.Rd 2007-07-26 00:20:00 UTC (rev 1105) @@ -4,6 +4,7 @@ \alias{estimable} \alias{estimable.default} \alias{estimable.lmer} +\alias{estimable.mlm} %\alias{.wald} %\alias{.to.est} \title{Contrasts and estimable linear functions of model coefficients} @@ -17,11 +18,12 @@ \method{estimable}{default} (obj, cm, beta0, conf.int=NULL, show.beta0, joint.test=FALSE, ...) \method{estimable}{lmer}(obj, cm, beta0, conf.int=NULL, show.beta0, sim.lmer=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,lmer) object. } + \item{obj}{Regression (lm,glm,lme,lmer,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} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-07-26 00:10:06
|
Revision: 1104 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1104&view=rev Author: warnes Date: 2007-07-25 17:10:03 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Add estimable method for mlm objects Modified Paths: -------------- trunk/gmodels/R/estimable.R Added Paths: ----------- trunk/gmodels/R/estimable.mlm.R Modified: trunk/gmodels/R/estimable.R =================================================================== --- trunk/gmodels/R/estimable.R 2007-07-22 09:27:18 UTC (rev 1103) +++ trunk/gmodels/R/estimable.R 2007-07-26 00:10:03 UTC (rev 1104) @@ -4,7 +4,8 @@ UseMethod("estimable") } -estimable.default <- function (obj, cm, beta0, conf.int=NULL, show.beta0, joint.test=FALSE, ...) +estimable.default <- function (obj, cm, beta0, conf.int=NULL, + show.beta0, joint.test=FALSE, ...) { if (is.matrix(cm) || is.data.frame(cm)) { @@ -12,8 +13,8 @@ } else if(is.list(cm)) { - cm <- matrix(.to.est(obj, cm), nrow=1) ################### changed - } ################### it seems that the names are lost with the way it used to be... + cm <- matrix(.to.est(obj, cm), nrow=1) + } else if(is.vector(cm)) { cm <- matrix(.to.est(obj, cm), nrow=1) @@ -122,7 +123,7 @@ }, X2.stat={ prob <- 1 - pchisq((ct.diff/vc)^2, df=1) - }) ################## + }) if (stat.name=="X2.stat") { Added: trunk/gmodels/R/estimable.mlm.R =================================================================== --- trunk/gmodels/R/estimable.mlm.R (rev 0) +++ trunk/gmodels/R/estimable.mlm.R 2007-07-26 00:10:03 UTC (rev 1104) @@ -0,0 +1,30 @@ +`estimable.mlm` <- + function (object, ...) +{ + coef <- coef(object) + ny <- ncol(coef) + effects <- object$effects + resid <- object$residuals + fitted <- object$fitted + ynames <- colnames(coef) + if (is.null(ynames)) { + lhs <- object$terms[[2]] + if (mode(lhs) == "call" && lhs[[1]] == "cbind") + ynames <- as.character(lhs)[-1] + else ynames <- paste("Y", seq(ny), sep = "") + } + value <- vector("list", ny) + names(value) <- paste("Response", ynames) + cl <- oldClass(object) + class(object) <- cl[match("mlm", cl):length(cl)][-1] + for (i in seq(ny)) { + object$coefficients <- coef[, i] + object$residuals <- resid[, i] + object$fitted.values <- fitted[, i] + object$effects <- effects[, i] + object$call$formula[[2]] <- object$terms[[2]] <- as.name(ynames[i]) + value[[i]] <- estimable(object, ...) + } + class(value) <- "listof" + value +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ar...@us...> - 2007-07-22 09:27:20
|
Revision: 1103 http://svn.sourceforge.net/r-gregmisc/?rev=1103&view=rev Author: arnima Date: 2007-07-22 02:27:18 -0700 (Sun, 22 Jul 2007) Log Message: ----------- Reverted back to as.character(substitute(x)), so user can run keep(x), keep("x"), Args(x), and Args("x"). Modified Paths: -------------- trunk/gdata/R/Args.R trunk/gdata/R/keep.R Modified: trunk/gdata/R/Args.R =================================================================== --- trunk/gdata/R/Args.R 2007-07-21 18:57:25 UTC (rev 1102) +++ trunk/gdata/R/Args.R 2007-07-22 09:27:18 UTC (rev 1103) @@ -1,6 +1,6 @@ Args <- function(name, sort.args=FALSE) { - a <- formals(get(deparse(substitute(name)), pos=1)) + a <- formals(get(as.character(substitute(name)), pos=1)) if(is.null(a)) return(NULL) arg.labels <- names(a) Modified: trunk/gdata/R/keep.R =================================================================== --- trunk/gdata/R/keep.R 2007-07-21 18:57:25 UTC (rev 1102) +++ trunk/gdata/R/keep.R 2007-07-22 09:27:18 UTC (rev 1103) @@ -6,7 +6,7 @@ "Nothing was removed.") return(invisible(NULL)) } - names <- deparse(substitute(list(...)))[-1] + names <- as.character(substitute(list(...)))[-1] list <- c(list, names) keep.elements <- match(list, ls(1)) if(any(is.na(keep.elements))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ar...@us...> - 2007-07-21 18:57:29
|
Revision: 1102 http://svn.sourceforge.net/r-gregmisc/?rev=1102&view=rev Author: arnima Date: 2007-07-21 11:57:25 -0700 (Sat, 21 Jul 2007) Log Message: ----------- Changed as.character(substitute()) to deparse(substitute()), following help(substitute) recommendation. Modified Paths: -------------- trunk/gdata/R/keep.R Modified: trunk/gdata/R/keep.R =================================================================== --- trunk/gdata/R/keep.R 2007-07-21 18:49:50 UTC (rev 1101) +++ trunk/gdata/R/keep.R 2007-07-21 18:57:25 UTC (rev 1102) @@ -6,7 +6,7 @@ "Nothing was removed.") return(invisible(NULL)) } - names <- as.character(substitute(list(...)))[-1] + names <- deparse(substitute(list(...)))[-1] list <- c(list, names) keep.elements <- match(list, ls(1)) if(any(is.na(keep.elements))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ar...@us...> - 2007-07-21 18:49:52
|
Revision: 1101 http://svn.sourceforge.net/r-gregmisc/?rev=1101&view=rev Author: arnima Date: 2007-07-21 11:49:50 -0700 (Sat, 21 Jul 2007) Log Message: ----------- Changed as.character(substitute()) to deparse(substitute()), following help(substitute) recommendation. Modified Paths: -------------- trunk/gdata/R/Args.R Modified: trunk/gdata/R/Args.R =================================================================== --- trunk/gdata/R/Args.R 2007-07-18 11:48:20 UTC (rev 1100) +++ trunk/gdata/R/Args.R 2007-07-21 18:49:50 UTC (rev 1101) @@ -1,6 +1,6 @@ Args <- function(name, sort.args=FALSE) { - a <- formals(get(as.character(substitute(name)), pos=1)) + a <- formals(get(deparse(substitute(name)), pos=1)) if(is.null(a)) return(NULL) arg.labels <- names(a) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2007-07-18 11:48:34
|
Revision: 1100 http://svn.sourceforge.net/r-gregmisc/?rev=1100&view=rev Author: ggorjan Date: 2007-07-18 04:48:20 -0700 (Wed, 18 Jul 2007) Log Message: ----------- typo fixed Modified Paths: -------------- trunk/gtools/man/combinations.Rd Modified: trunk/gtools/man/combinations.Rd =================================================================== --- trunk/gtools/man/combinations.Rd 2007-07-10 17:51:08 UTC (rev 1099) +++ trunk/gtools/man/combinations.Rd 2007-07-18 11:48:20 UTC (rev 1100) @@ -21,7 +21,7 @@ \item{set}{ Logical flag indicating whether duplicates should be removed from the source vector \code{v}. Defaults to \code{TRUE}.} \item{repeats.allowed}{ Logical flag indicating whether the - constructed vectors nay include duplicated values. Defaults to + constructed vectors may include duplicated values. Defaults to \code{FALSE}. } } \details{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-07-10 17:51:11
|
Revision: 1099 http://svn.sourceforge.net/r-gregmisc/?rev=1099&view=rev Author: warnes Date: 2007-07-10 10:51:08 -0700 (Tue, 10 Jul 2007) Log Message: ----------- Update read.xls() code and docs with enhacements by Gabor Grothendieck Modified Paths: -------------- trunk/gdata/R/read.xls.R trunk/gdata/man/read.xls.Rd Modified: trunk/gdata/R/read.xls.R =================================================================== --- trunk/gdata/R/read.xls.R 2007-06-27 18:34:24 UTC (rev 1098) +++ trunk/gdata/R/read.xls.R 2007-07-10 17:51:08 UTC (rev 1099) @@ -1,6 +1,6 @@ # $Id$ -read.xls <- function(xls, sheet = 1, verbose=FALSE, ..., perl="perl") +xls2csv <- function(xls, sheet = 1, verbose=FALSE, ..., perl="perl") { # Creating a temporary function to quote the string @@ -16,6 +16,12 @@ ### # files + tf <- NULL + if (substring(xls, 1, 7) == "http://") { + tf <- paste(tempfile(), "xls", sep = ".") + download.file(xls, tf, mode = "wb") + xls <- tf + } xls <- dQuote.ascii(xls) # dQuote.ascii in case of spaces in path xls2csv <- file.path(perl.dir,'xls2csv.pl') csv <- paste(tempfile(), "csv", sep = ".") @@ -39,13 +45,29 @@ ### # prepare for cleanup now, in case of error reading file - on.exit(file.remove(csv)) - - # now read the csv file - out <- read.csv(csv, ...) + file(csv) +} - # clean up - file.remove(csv) - - return(out) + +read.xls <- function(xls, sheet = 1, verbose=FALSE, pattern, ..., perl="perl") { + con <- tfn <- NULL + on.exit({ + if (inherits(con, "connection") && isOpen(con)) close(con) + if (file.exists(tfn)) file.remove(tfn) + }) + con <- xls2csv(xls, sheet, verbose, ..., perl = perl) + open(con) + tfn <- summary(con)$description + print(tfn) + if (missing(pattern)) read.csv(con, ...) + else { + idx <- grep(pattern, readLines(con)) + if (length(idx) == 0) { + warning("pattern not found") + return(NULL) + } + seek(con, 0) + read.csv(con, skip = idx[1]-1, ...) + } } + Modified: trunk/gdata/man/read.xls.Rd =================================================================== --- trunk/gdata/man/read.xls.Rd 2007-06-27 18:34:24 UTC (rev 1098) +++ trunk/gdata/man/read.xls.Rd 2007-07-10 17:51:08 UTC (rev 1099) @@ -1,22 +1,28 @@ \name{read.xls} \alias{read.xls} +\alias{xls2csv} \title{Read Excel files} \description{Reads a Microsoft Excel file into a data frame} \usage{ -read.xls(xls, sheet=1, verbose=FALSE, ..., perl="perl") +read.xls(xls, sheet=1, verbose=FALSE, pattern, ..., perl="perl") +xls2csv(xls, sheet=1, verbose=FALSE, ..., perl="perl") } \arguments{ - \item{xls}{name of the Microsoft Excel file} + \item{xls}{name of the Microsoft Excel file. If on internet it + should begin with code{"http://"}.} \item{sheet}{number of sheet within the Excel file from which data are to be read} \item{verbose}{logical flag indicating whether details should be printed as the file is processed.} + \item{pattern}{if specified, them skip all lines before the first + containing this string} \item{perl}{name of the perl executable to be called.} \item{...}{additional arguments to read.table. The defaults of read.csv are used.} } \value{ - a data frame + \code{"read.xls"} returns a data frame. \code{"xls2csv"} returns a + connection to a temporary file in csv format. } \details{ This function works translating the named Microsoft Excel file into a @@ -27,6 +33,9 @@ problem if you are trying to use the \code{comment.char} option of \code{read.table} since the first character of all lines (including comment lines) will be "\"" after conversion. + + Caution: With \code{"xls2csv"} it is the responsibility of the user + to close and delete the file after using it. } \references{http://www.analytics.washington.edu/statcomp/downloads/xls2csv} \note{ Either a working version of Perl must be present in the executable @@ -49,9 +58,24 @@ # Example specifying exact Perl path for Unix systems iris <- read.xls(xlsfile, perl="/usr/bin/perl") + + # read xls file from net + nba.url <- "http://lcb1.uoregon.edu/sergiok/DSC330HSP04/week5/NBA.xls" + nba <- read.xls(nba.url) + + # read xls file ignoring all lines prior to first containing State + crime.url <- "http://www.jrsainfo.org/jabg/state_data2/Tribal_Data00.xls" + crime <- read.xls(crime.url, pattern = "State") + + # use of xls2csv - open con, print two lines, close con + con <- xls2csv(nba.url) + print(readLines(con, 2)) + file.remove(summary(con)$description) + } } \author{Jim Rogers \email{jam...@pf...}, modified - and extended by Gregory R. Warnes \email{wa...@bs...}. + and extended by Gregory R. Warnes \email{gr...@ra...} + Gabor Grothendiek \email{ggr...@gm...}. } \keyword{file} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-06-27 18:34:26
|
Revision: 1098 http://svn.sourceforge.net/r-gregmisc/?rev=1098&view=rev Author: warnes Date: 2007-06-27 11:34:24 -0700 (Wed, 27 Jun 2007) Log Message: ----------- Remove duplicated word Modified Paths: -------------- trunk/PathwayModeling/thesispaper/methods.Snw trunk/PathwayModeling/thesispaper/paper.pdf Modified: trunk/PathwayModeling/thesispaper/methods.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/methods.Snw 2007-06-06 10:24:15 UTC (rev 1097) +++ trunk/PathwayModeling/thesispaper/methods.Snw 2007-06-27 18:34:24 UTC (rev 1098) @@ -289,7 +289,7 @@ \subsubsection{Burn-in and Thinning} Many MCMC papers recommend the removal of an initial ``burn-in'' - segment of the MCMC run since these initial MCMC samples can can + segment of the MCMC run since these initial MCMC samples can be heavily influenced by the initial starting point, and can result in bias in the computed estimates. We adopted an alternative approach to avoiding bias in our estimates; each MCMC sampler was Modified: trunk/PathwayModeling/thesispaper/paper.pdf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2007-06-06 10:24:17
|
Revision: 1097 http://svn.sourceforge.net/r-gregmisc/?rev=1097&view=rev Author: ggorjan Date: 2007-06-06 03:24:15 -0700 (Wed, 06 Jun 2007) Log Message: ----------- last edits from newsletter Modified Paths: -------------- trunk/gdata/inst/doc/unknown.pdf trunk/gdata/inst/doc/unknown.tex Modified: trunk/gdata/inst/doc/unknown.pdf =================================================================== (Binary files differ) Modified: trunk/gdata/inst/doc/unknown.tex =================================================================== --- trunk/gdata/inst/doc/unknown.tex 2007-06-06 10:19:15 UTC (rev 1096) +++ trunk/gdata/inst/doc/unknown.tex 2007-06-06 10:24:15 UTC (rev 1097) @@ -7,108 +7,109 @@ \begin{article} -\title{Working with unknown values} -\subtitle{The gdata package} +\title{Working with Unknown Values} +\subtitle{The \pkg{gdata} package} \author{by Gregor Gorjanc} \maketitle -Published as \cite{Gorjanc}. +This vignette has been published as \cite{Gorjanc}. \section{Introduction} Unknown or missing values can be represented in various ways. For example -SAS uses \code{.} (dot), while \R{} uses \code{NA}, which we can read as +SAS uses \code{.}~(dot), while \R{} uses \code{NA}, which we can read as Not Available. When we import data into \R{}, say via \code{read.table} or its derivatives, conversion of blank fields to \code{NA} (according to \code{read.table} help) is done for \code{logical}, \code{integer}, -\code{numeric} and \code{complex} classes. Additionally, \code{na.strings} +\code{numeric} and \code{complex} classes. Additionally, +the \code{na.strings} argument can be used to specify values that should also be converted to -\code{NA}. Inversely there is an argument \code{na} in \code{write.table} +\code{NA}. Inversely, there is an argument \code{na} in \code{write.table} and its derivatives to define value that will replace \code{NA} in exported data. There are also other ways to import/export data into \R{} as -described in ``R Data Import/Export'' Manual \citep{RImportExportManual}, -however all approaches lack the possibility to define unknown value(s) for -particular column. It is possible that unknown value in one column is a -valid value in another column. For example I have seen many datasets where -values as 0, -9, 999 and specific dates are used as column specific unknown -values in one dataset. +described in the {\emph R Data Import/Export} manual \citep{RImportExportManual}. +However, all approaches lack the possibility to define unknown value(s) for +some particular column. It is possible that an unknown value in one column is a +valid value in another column. For example, I have seen many datasets where +values such as 0, -9, 999 and specific dates are used as column specific unknown +values. -This note represents set of functions in \pkg{gdata}\footnote{from version - 2.3.1} package \citep{WarnesGdata}: \code{isUnknown}, \code{unknownToNA} -and \code{NAToUnknown}, which can help with testing for unknown values and -conversions between unknown values and \code{NA}. All three functions are -generic (S3) and were tested (at the time of writing) to work with: -\code{integer}, \code{numeric}, \code{character}, \code{factor}, -\code{Date}, \code{POSIXct}, \code{POSIXlt}, \code{list}, \code{data.frame} -and \code{matrix} classes. +This note describes a set of functions in package \pkg{gdata}\footnote{ +package version 2.3.1} \citep{WarnesGdata}: \code{isUnknown}, +\code{unknownToNA} and \code{NAToUnknown}, which can help with testing for +unknown values and conversions between unknown values and \code{NA}. All +three functions are generic (S3) and were tested (at the time of writing) +to work with: \code{integer}, \code{numeric}, \code{character}, +\code{factor}, \code{Date}, \code{POSIXct}, \code{POSIXlt}, \code{list}, +\code{data.frame} and \code{matrix} classes. \section{Description with examples} -The following examples show simple usage of this functions on +The following examples show simple usage of these functions on \code{numeric} and \code{factor} classes, where value \code{0} (beside -\code{NA}) should be treated as unknown value: +\code{NA}) should be treated as an unknown value: \begin{smallverbatim} -> library(gdata) +> library("gdata") > xNum <- c(0, 6, 0, 7, 8, 9, NA) > isUnknown(x=xNum) -[1] FALSE FALSE FALSE FALSE FALSE FALSE TRUE +[1] FALSE FALSE FALSE FALSE FALSE FALSE TRUE \end{smallverbatim} The default unknown value in \code{isUnknown} is \code{NA}, which means -that output is the same to \code{is.na} - at least for atomic -classes. However, we can pass argument \code{unknown} to define which -values should be treated as unknown. +that output is the same as \code{is.na} --- at least for atomic +classes. However, we can pass the argument \code{unknown} to define which +values should be treated as unknown: \begin{smallverbatim} > isUnknown(x=xNum, unknown=0) -[1] TRUE FALSE TRUE FALSE FALSE FALSE FALSE +[1] TRUE FALSE TRUE FALSE FALSE FALSE FALSE \end{smallverbatim} -This skipped \code{NA}, but we can get expected answer after appropriately -adding \code{NA} into argument \code{unknown}. +This skipped \code{NA}, but we can get the expected answer after appropriately +adding \code{NA} into the argument \code{unknown}: \begin{smallverbatim} > isUnknown(x=xNum, unknown=c(0, NA)) -[1] TRUE FALSE TRUE FALSE FALSE FALSE TRUE +[1] TRUE FALSE TRUE FALSE FALSE FALSE TRUE \end{smallverbatim} Now, we can change all unknown values to \code{NA} with \code{unknownToNA}. There is clearly no need to add \code{NA} here. This step is very handy -after importing data from external source, where many different unknown +after importing data from an external source, where many different unknown values might be used. Argument \code{warning=TRUE} can be used, if there is -a need to be warned about ``original'' \code{NA}s. +a need to be warned about ``original'' \code{NA}s: \begin{smallverbatim} > xNum2 <- unknownToNA(x=xNum, unknown=0) [1] NA 6 NA 7 8 9 NA \end{smallverbatim} -Prior to export from \R{}, we might want to change unknown value (\code{NA} +Prior to export from \R{}, we might want to change unknown values (\code{NA} in \R{}) to some other value. Function \code{NAToUnknown} can be used for -this. +this: \begin{smallverbatim} > NAToUnknown(x=xNum2, unknown=999) [1] 999 6 999 7 8 9 999 \end{smallverbatim} -Converting \code{NA} to value that already exists in \code{x} issues an -error, however \code{force=TRUE} can be used to overcome this if -needed. But be warned that there is no way back from this step. +Converting \code{NA} to a value that already exists in \code{x} issues an +error, but \code{force=TRUE} can be used to overcome this if +needed. But be warned that there is no way back from this step: \begin{smallverbatim} > NAToUnknown(x=xNum2, unknown=7, force=TRUE) [1] 7 6 7 7 8 9 7 \end{smallverbatim} -Examples bellow show all peculiarities with \code{factor} class. +Examples below show all peculiarities with class \code{factor}. \code{unknownToNA} removes \code{unknown} value from levels and inversely \code{NAToUnknown} adds it with a warning. Additionally, \code{"NA"} is -properly distinguished from \code{NA}. It can also be seen that argument +properly distinguished from \code{NA}. It can also be seen that the argument \code{unknown} in functions \code{isUnknown} and \code{unknownToNA} need -not match class of \code{x} (otherwise factor should be used) as the test +not match the class of \code{x} (otherwise factor should be used) as the test is internally done with \code{\%in\%}, which nicely resolves coercing issues. @@ -137,33 +138,34 @@ new level is introduced: 0 \end{smallverbatim} -These two examples with numeric an factor classes are fairly simple and we +These two examples with classes \code{numeric} and \code{factor} are fairly simple and we could get the same results with one or two lines of \R{} code. The real -benefit of presented set of functions is in \code{list} and +benefit of the set of functions presented here is in \code{list} and \code{data.frame} methods, where \code{data.frame} methods are merely wrappers for \code{list} methods. We need additional flexibility for \code{list}/\code{data.frame} methods, -due to possibility of having multiple unknown values that can be different +due to possibly having multiple unknown values that can be different among \code{list} components or \code{data.frame} columns. For these two -methods, argument \code{unknown} can be either a \code{vector} or +methods, the argument \code{unknown} can be either a \code{vector} or \code{list}, both possibly named. Of course, greater flexibility (defining multiple unknown values per component/column) can be achieved with a \code{list}. -When \code{vector}/\code{list} passed to argument \code{unknown} is not -named, first value/component of a \code{vector}/\code{list} matches first +When a \code{vector}/\code{list} object passed to the argument \code{unknown} is not +named, the first value/component of a \code{vector}/\code{list} matches the first component/column of a \code{list}/\code{data.frame}. This can be quite -error prone, especially with \code{vectors}. Therefore, I encourage use of +error prone, especially with \code{vectors}. Therefore, I encourage the use of a \code{list}. In case \code{vector}/\code{list} passed to argument \code{unknown} is named, names are matched to names of \code{list} or \code{data.frame}. If lengths of \code{unknown} and \code{list} or \code{data.frame} do not match, recycling occurs. -Example bellow shows usage of described functions on a list, that is +The example below illustrates the application of the +described functions to a list which is composed of previously defined and modified numeric (\code{xNum}) and -factor (\code{xFac}) classes. First function \code{isUnknown} is used with -\code{0} as unknown value. Note that we get \code{FALSE} for \code{NA}s as +factor (\code{xFac}) classes. First, function \code{isUnknown} is used with +\code{0} as an unknown value. Note that we get \code{FALSE} for \code{NA}s as has been the case in the first example. \begin{smallverbatim} @@ -176,33 +178,33 @@ Levels: 0 BA NA RA > isUnknown(x=xList, unknown=0) $a -[1] TRUE FALSE TRUE FALSE FALSE FALSE FALSE +[1] TRUE FALSE TRUE FALSE FALSE FALSE FALSE $b -[1] TRUE FALSE FALSE FALSE TRUE FALSE +[1] TRUE FALSE FALSE FALSE TRUE FALSE \end{smallverbatim} -We need to add \code{NA} as unknown value. However, we do not get the +We need to add \code{NA} as an unknown value. However, we do not get the expected result this way! \begin{smallverbatim} > isUnknown(x=xList, unknown=c(0, NA)) $a -[1] TRUE FALSE TRUE FALSE FALSE FALSE FALSE +[1] TRUE FALSE TRUE FALSE FALSE FALSE FALSE $b [1] FALSE FALSE FALSE FALSE FALSE FALSE \end{smallverbatim} -This is due to matching of values in argument \code{unknown} and components -in a \code{list} i.e. \code{0} is used for component \code{a} and \code{NA} +This is due to matching of values in the argument \code{unknown} and components +in a \code{list}; i.e., \code{0} is used for component \code{a} and \code{NA} for component \code{b}. Therefore, it is less error prone and more -flexible to pass \code{list} (preferably named one) to argument -\code{unknown} as shown bellow. +flexible to pass a \code{list} (preferably a named list) to the argument +\code{unknown}, as shown below. \begin{smallverbatim} > xList1 <- unknownToNA(x=xList, -+ unknown=list(b=c(0, "NA"), a=0)) ++ unknown=list(b=c(0, "NA"), a=0)) $a [1] NA 6 NA 7 8 9 NA @@ -212,7 +214,7 @@ \end{smallverbatim} Changing \code{NA}s to some other value (only one per component/column) can -be now something like this: +be accomplished as follows: \begin{smallverbatim} > NAToUnknown(x=xList1, unknown=list(b="no", a=0)) @@ -227,11 +229,11 @@ new level is introduced: no \end{smallverbatim} -Named component \code{.default} of a \code{list} passed to argument -\code{unknown} has a special meaning as it will match component/column with +A named component \code{.default} of a \code{list} passed to argument +\code{unknown} has a special meaning as it will match a component/column with that name and any other not defined in \code{unknown}. As such it is very useful if the number of components/columns with the same unknown value(s) -is large. Imagine a wide \code{data.frame} named \code{df}. Now +is large. Consider a wide \code{data.frame} named \code{df}. Now \code{.default} can be used to define unknown value for several columns: \begin{smallverbatim} @@ -242,8 +244,8 @@ \end{smallverbatim} If there is a need to work only on some components/columns you can of -course ``skip'' columns with standard \R{} mechanisms i.e. -with subsetting \code{list} or \code{data.frame} objects. +course ``skip'' columns with standard \R{} mechanisms, i.e., +by subsetting \code{list} or \code{data.frame} objects: \begin{smallverbatim} > cols <- c("col1", "col2") @@ -255,7 +257,7 @@ \section{Summary} Functions \code{isUnknown}, \code{unknownToNA} and \code{NAToUnknown} -provide a nice interface to work with various representations of +provide a useful interface to work with various representations of unknown/missing values. Their use is meant primarily for shaping the data after importing to or before exporting from \R{}. I welcome any comments or suggestions. @@ -272,8 +274,8 @@ \bibitem[Gorjanc(2007)]{Gorjanc} G.~Gorjanc. \newblock Working with unknown values: the gdata package. -\newblock \emph{R News}, 1\penalty0 (1):\penalty0 ?--?, ? 2007. -\newblock URL \url{http://CRAN.R-project.org/doc/Rnews/Rnews_2007-?.pdf}. +\newblock \emph{R News}, 7\penalty0 (1):\penalty0 24--26, 2007. +\newblock URL \url{http://CRAN.R-project.org/doc/Rnews/Rnews_2007-1.pdf}. \bibitem[{R Development Core Team}(2006)]{RImportExportManual} {R Development Core Team}. @@ -281,7 +283,7 @@ \newblock URL \url{http://cran.r-project.org/manuals.html}. \newblock ISBN 3-900051-10-0. -\bibitem[Warnes.(2006)]{WarnesGdata} +\bibitem[Warnes (2006)]{WarnesGdata} G.~R. Warnes. \newblock \emph{gdata: Various R programming tools for data manipulation}, 2006. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2007-06-06 10:19:17
|
Revision: 1096 http://svn.sourceforge.net/r-gregmisc/?rev=1096&view=rev Author: ggorjan Date: 2007-06-06 03:19:15 -0700 (Wed, 06 Jun 2007) Log Message: ----------- drop levels as suggested by Brian Ripley Modified Paths: -------------- trunk/gdata/R/drop.levels.R trunk/gdata/man/drop.levels.Rd Modified: trunk/gdata/R/drop.levels.R =================================================================== --- trunk/gdata/R/drop.levels.R 2007-06-06 10:17:52 UTC (rev 1095) +++ trunk/gdata/R/drop.levels.R 2007-06-06 10:19:15 UTC (rev 1096) @@ -1,13 +1,13 @@ drop.levels <- function(x, reorder=TRUE, ...) - UseMethod("drop.levels", x=x) + UseMethod("drop.levels") drop.levels.default <- function(x, reorder=TRUE, ...) x drop.levels.factor <- function(x, reorder=TRUE, ...) { - x <- factor(x) + x <- x[, drop=TRUE] if(reorder) x <- reorder(x, ...) x } Modified: trunk/gdata/man/drop.levels.Rd =================================================================== --- trunk/gdata/man/drop.levels.Rd 2007-06-06 10:17:52 UTC (rev 1095) +++ trunk/gdata/man/drop.levels.Rd 2007-06-06 10:19:15 UTC (rev 1096) @@ -1,9 +1,9 @@ % $Id$ -% + \name{drop.levels} \alias{drop.levels} \title{Drop unused factor levels} -\description{Drop unused levels in a factor.} +\description{Drop unused levels in a factor} \usage{ drop.levels(x, reorder=TRUE, ...) } @@ -11,22 +11,24 @@ \item{x}{object to be processed} \item{reorder}{should factor levels be reordered using \code{\link{reorder.factor}}?} - \item{...}{additional arguments to \code{reorder.factor}} + \item{...}{additional arguments to \code{\link{reorder.factor}}} } \details{ \code{drop.levels} is a generic function, where default method does -nothing, while method for factor \code{s} drops all unused levels. There -are also convinient methods for \code{list} and \code{data.frame}, where -all unused levels are droped in all factors (one by one) in a +nothing, while method for factor \code{s} drops all unused levels. Drop +is done with \code{x[, drop=TRUE]}. + +There are also convenient methods for \code{list} and \code{data.frame}, +where all unused levels are dropped in all factors (one by one) in a \code{list} or a \code{data.frame}. } -\value{a data frame} +\value{Input object without unused levels.} -\author{Jim Rogers \email{jam...@pf...}} +\author{Jim Rogers \email{jam...@pf...} and Gregor Gorjanc} \examples{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2007-06-06 10:17:53
|
Revision: 1095 http://svn.sourceforge.net/r-gregmisc/?rev=1095&view=rev Author: ggorjan Date: 2007-06-06 03:17:52 -0700 (Wed, 06 Jun 2007) Log Message: ----------- better integration of unit tests Modified Paths: -------------- trunk/gdata/inst/unitTests/Makefile trunk/gdata/tests/doRUnit.R Modified: trunk/gdata/inst/unitTests/Makefile =================================================================== --- trunk/gdata/inst/unitTests/Makefile 2007-06-06 10:15:49 UTC (rev 1094) +++ trunk/gdata/inst/unitTests/Makefile 2007-06-06 10:17:52 UTC (rev 1095) @@ -1,7 +1,7 @@ -PKG=gdata TOP=../.. +PKG=${shell cd ${TOP};pwd} SUITE=doRUnit.R -R=R +R=${R_HOME}/bin/R all: inst test @@ -13,3 +13,12 @@ export RCMDCHECK=FALSE;\ cd ${TOP}/tests;\ ${R} --vanilla --slave < ${SUITE} + +echo: # Echo env. variables + @echo "Package folder: ${PKG}" + @echo "R binary: ${R}" + +help: # Help + @echo -e '\nTarget: Dependency # Description'; \ + echo '=================================================='; \ + egrep '^[[:alnum:].+_()%]*:' ./Makefile Modified: trunk/gdata/tests/doRUnit.R =================================================================== --- trunk/gdata/tests/doRUnit.R 2007-06-06 10:15:49 UTC (rev 1094) +++ trunk/gdata/tests/doRUnit.R 2007-06-06 10:17:52 UTC (rev 1095) @@ -1,47 +1,62 @@ ### doRUnit.R ###------------------------------------------------------------------------ -### What: Run RUnit tests +### What: Run unit tests with RUnit ### $Id$ -### Time-stamp: <2006-10-29 16:37:40 ggorjan> +### Time-stamp: <2007-06-06 14:02:41 ggorjan> ###------------------------------------------------------------------------ +## unit tests will not be done if RUnit is not available if(require("RUnit", quietly=TRUE)) { ## --- Setup --- - wd <- getwd() - pkg <- basename(sub(pattern="tests$", replacement="", wd)) - ## Path for standalone i.e. not by R CMD check testing + pkg <- "gdata" if(Sys.getenv("RCMDCHECK") == "FALSE") { - path <- file.path("..", "inst") + ## Path to unit tests for standalone running under Makefile (not R CMD check) + ## PKG/tests/../inst/unitTests + path <- file.path(getwd(), "..", "inst", "unitTests") } else { - pkg <- sub(pattern="\.Rcheck$", replacement="", pkg) - path <- file.path("..", pkg) + ## Path to unit tests for R CMD check + ## PKG.Rcheck/tests/../PKG/unitTests + path <- system.file(package=pkg, "unitTests") } - path <- file.path(wd, path, "unitTests") - pathReport <- file.path(path, "report") + cat("\nRunning unit tests\n") + print(list(pkg=pkg, getwd=getwd(), pathToUnitTests=path)) library(package=pkg, character.only=TRUE) ## --- Testing --- ## Define tests - testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), dirs=path) + testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), + dirs=path) ## Run tests <- runTestSuite(testSuite) - ## Print results - printTextProtocol(tests) - printTextProtocol(tests, fileName=paste(pathReport, ".txt", sep="")) + ## Default report name + pathReport <- file.path(path, "report") - ## Print HTML version to a file + ## Report to stdout and text files + cat("------------------- UNIT TEST SUMMARY ---------------------\n\n") + printTextProtocol(tests, showDetails=FALSE) + printTextProtocol(tests, showDetails=FALSE, + fileName=paste(pathReport, "Summary.txt", sep="")) + printTextProtocol(tests, showDetails=TRUE, + fileName=paste(pathReport, ".txt", sep="")) + + ## Report to HTML file printHTMLProtocol(tests, fileName=paste(pathReport, ".html", sep="")) - ## Return stop() if there are any failures i.e. FALSE to unit test. - ## This will cause R CMD check to return error and stop - if(getErrors(tests)$nFail > 0) { - stop("one of unit tests failed") + ## Return stop() to cause R CMD check stop in case of + ## - failures i.e. FALSE to unit tests or + ## - errors i.e. R errors + tmp <- getErrors(tests) + if(tmp$nFail > 0 | tmp$nErr > 0) { + stop(paste("\n\nunit testing failed (#test failures: ", tmp$nFail, + ", #R errors: ", tmp$nErr, ")\n\n", sep="")) } +} else { + warning("cannot run unit tests -- package RUnit is not available") } ###------------------------------------------------------------------------ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2007-06-06 10:15:52
|
Revision: 1094 http://svn.sourceforge.net/r-gregmisc/?rev=1094&view=rev Author: ggorjan Date: 2007-06-06 03:15:49 -0700 (Wed, 06 Jun 2007) Log Message: ----------- making codetools happy Modified Paths: -------------- trunk/gdata/R/mapLevels.R trunk/gdata/R/unknown.R Modified: trunk/gdata/R/mapLevels.R =================================================================== --- trunk/gdata/R/mapLevels.R 2007-05-20 23:57:18 UTC (rev 1093) +++ trunk/gdata/R/mapLevels.R 2007-06-06 10:15:49 UTC (rev 1094) @@ -2,7 +2,7 @@ ###------------------------------------------------------------------------ ### What: Mapping levels ### $Id$ -### Time-stamp: <2006-10-29 16:45:20 ggorjan> +### Time-stamp: <2007-04-26 13:16:18 ggorjan> ###------------------------------------------------------------------------ ### {{{ mapLevels @@ -12,7 +12,7 @@ mapLevels <- function(x, codes=TRUE, sort=TRUE, drop=FALSE, combine=FALSE, ...) { - UseMethod("mapLevels", x=x) + UseMethod("mapLevels") } mapLevels.default <- function(x, codes=TRUE, sort=TRUE, drop=FALSE, @@ -282,6 +282,7 @@ ### }}} ### {{{ mapLevels<- + ###------------------------------------------------------------------------ "mapLevels<-" <- function(x, value) Modified: trunk/gdata/R/unknown.R =================================================================== --- trunk/gdata/R/unknown.R 2007-05-20 23:57:18 UTC (rev 1093) +++ trunk/gdata/R/unknown.R 2007-06-06 10:15:49 UTC (rev 1094) @@ -2,14 +2,15 @@ ###------------------------------------------------------------------------ ### What: Change given unknown value to NA and vice versa ### $Id$ -### Time-stamp: <2006-11-28 15:02:19 ggorjan> +### Time-stamp: <2007-04-26 13:16:10 ggorjan> ###------------------------------------------------------------------------ ### {{{ isUnknown + ###------------------------------------------------------------------------ isUnknown <- function(x, unknown=NA, ...) - UseMethod("isUnknown", x=x) + UseMethod("isUnknown") isUnknown.default <- function(x, unknown=NA, ...) { @@ -49,6 +50,7 @@ ### }}} ### {{{ unknownToNA + ###------------------------------------------------------------------------ unknownToNA <- function(x, unknown, warning=FALSE, ...) @@ -95,6 +97,7 @@ ### }}} ### {{{ NAToUnknown + ###------------------------------------------------------------------------ NAToUnknown <- function(x, unknown, force=FALSE, call.=FALSE, ...) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-04-17 19:36:46
|
Revision: 1092 http://svn.sourceforge.net/r-gregmisc/?rev=1092&view=rev Author: warnes Date: 2007-04-17 12:36:45 -0700 (Tue, 17 Apr 2007) Log Message: ----------- Fix typo and add Rhode Island Modified Paths: -------------- trunk/PathwayModeling/thesispaper/acknowledgment.Snw trunk/PathwayModeling/thesispaper/paper.pdf Modified: trunk/PathwayModeling/thesispaper/acknowledgment.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/acknowledgment.Snw 2007-04-17 16:34:50 UTC (rev 1091) +++ trunk/PathwayModeling/thesispaper/acknowledgment.Snw 2007-04-17 19:36:45 UTC (rev 1092) @@ -1,7 +1,7 @@ \section{Acknowledgment} -Robert "Bing" Burroughs, Ph.D., who was primarily responsible for the +Robert "Bing" Burrows, Ph.D., who was primarily responsible for the writing of, and work described by, this manuscript passed away unexpectedly on December 27, 2006. Both of the co-authors are glad to have shared a very pleasant and collegial relationship with Dr. @@ -13,15 +13,15 @@ portion of Dr. Burrows obituary: \begin{quote} - BURROWS, ROBERT BERNARD, II, 63, of North Scituate, died Wednesday, - December 27, 2006. He was a long time resident of Lexington, MA - before moving to Rhode Island in 2001. After graduating from - Lexington High School, Dr. Burrows earned his Bachelor of Arts from - Northeastern University, a Ph.D. in Biochemistry from the - Massachusetts Institute of Technology, and a Master of Science in - Statistics from the University of Rhode Island. He was a - self-employed Research Biochemist and previously worked for the - Boston Biomedical Research Institute. He leaves his sister Ellen + BURROWS, ROBERT BERNARD, II, 63, of North Scituate [Rhode Island], + died Wednesday, December 27, 2006. He was a long time resident of + Lexington, MA before moving to Rhode Island in 2001. After + graduating from Lexington High School, Dr. Burrows earned his + Bachelor of Arts from Northeastern University, a Ph.D. in + Biochemistry from the Massachusetts Institute of Technology, and a + Master of Science in Statistics from the University of Rhode Island. + He was a self-employed Research Biochemist and previously worked for + the Boston Biomedical Research Institute. He leaves his sister Ellen Conner and her husband Donald of Coventry, his dearest friend Sally Glanz of North Scituate and many cousins. \cite{projo} \end{quote} Modified: trunk/PathwayModeling/thesispaper/paper.pdf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-04-17 16:35:13
|
Revision: 1091 http://svn.sourceforge.net/r-gregmisc/?rev=1091&view=rev Author: warnes Date: 2007-04-17 09:34:50 -0700 (Tue, 17 Apr 2007) Log Message: ----------- Add acknowledgement for Robert Modified Paths: -------------- trunk/PathwayModeling/thesispaper/R/plotConverged_nocolor.R trunk/PathwayModeling/thesispaper/bibliography.Snw trunk/PathwayModeling/thesispaper/figure5.Snw trunk/PathwayModeling/thesispaper/paper.Snw trunk/PathwayModeling/thesispaper/paper.pdf Added Paths: ----------- trunk/PathwayModeling/thesispaper/acknowledgment.Snw Modified: trunk/PathwayModeling/thesispaper/R/plotConverged_nocolor.R =================================================================== --- trunk/PathwayModeling/thesispaper/R/plotConverged_nocolor.R 2007-04-17 15:00:06 UTC (rev 1090) +++ trunk/PathwayModeling/thesispaper/R/plotConverged_nocolor.R 2007-04-17 16:34:50 UTC (rev 1091) @@ -1,7 +1,8 @@ `plotConverged_nocolor` <- function() { oldpar <- par(no.readonly=TRUE) - par(mfrow=c(1,3)) + #par(mfrow=c(1,3)) + par(mfrow=c(3,1)) par(mar=c(4, 3, 0.75, 0.75) + 0.1) maxY <- 0.0012 Added: trunk/PathwayModeling/thesispaper/acknowledgment.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/acknowledgment.Snw (rev 0) +++ trunk/PathwayModeling/thesispaper/acknowledgment.Snw 2007-04-17 16:34:50 UTC (rev 1091) @@ -0,0 +1,28 @@ + +\section{Acknowledgment} + +Robert "Bing" Burroughs, Ph.D., who was primarily responsible for the +writing of, and work described by, this manuscript passed away +unexpectedly on December 27, 2006. Both of the co-authors are glad to +have shared a very pleasant and collegial relationship with Dr. +Burrows and are sad to see him go. We are, however, gratified that +\emph{IET Systems Biology} has elected to publish Dr. Burrows' +manuscript posthumously. With his passing, one of the co-authors, Dr. +Warnes, has committed to actively continuing his research into +modeling the biochemistry of diabetic complications. We cite a +portion of Dr. Burrows obituary: + +\begin{quote} + BURROWS, ROBERT BERNARD, II, 63, of North Scituate, died Wednesday, + December 27, 2006. He was a long time resident of Lexington, MA + before moving to Rhode Island in 2001. After graduating from + Lexington High School, Dr. Burrows earned his Bachelor of Arts from + Northeastern University, a Ph.D. in Biochemistry from the + Massachusetts Institute of Technology, and a Master of Science in + Statistics from the University of Rhode Island. He was a + self-employed Research Biochemist and previously worked for the + Boston Biomedical Research Institute. He leaves his sister Ellen + Conner and her husband Donald of Coventry, his dearest friend Sally + Glanz of North Scituate and many cousins. \cite{projo} +\end{quote} + Modified: trunk/PathwayModeling/thesispaper/bibliography.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/bibliography.Snw 2007-04-17 15:00:06 UTC (rev 1090) +++ trunk/PathwayModeling/thesispaper/bibliography.Snw 2007-04-17 16:34:50 UTC (rev 1091) @@ -58,4 +58,7 @@ Byrd, R.H., Lu, P., Nocedal, J., and Zhu, C., 1995, A limited memory algorithm for bound constrained optimization, \emph{SIAM J. Sci. Comput.}, \textbf{16}, 1190--1208. + \bibitem{projo}%16 + OBITUARIES-SCITUATE-BURROWS. \emph{The Providence Journal/Evening + Bulletin} 2006 Dec. 31; Sec. B5 \end{thebibliography} Modified: trunk/PathwayModeling/thesispaper/figure5.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/figure5.Snw 2007-04-17 15:00:06 UTC (rev 1090) +++ trunk/PathwayModeling/thesispaper/figure5.Snw 2007-04-17 16:34:50 UTC (rev 1091) @@ -9,13 +9,13 @@ # pdf(file="figures/tempDir/converged.pdf",width=6,height=6) # postscript(file="figures/tempDir/converged.eps",width=6,height=6) -pdf(file="figures/tempDir/converged_nocolor.pdf",width=6,height=2) +pdf(file="figures/tempDir/converged_nocolor.pdf",width=6,height=6) # plotConverged() plotConverged_nocolor() N <- dev.off() -postscript(file="figures/tempDir/converged_nocolor.eps",width=3*6,height=3*2) +postscript(file="figures/tempDir/converged_nocolor.eps",width=6,height=6) # plotConverged() plotConverged_nocolor() N <- dev.off() Modified: trunk/PathwayModeling/thesispaper/paper.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/paper.Snw 2007-04-17 15:00:06 UTC (rev 1090) +++ trunk/PathwayModeling/thesispaper/paper.Snw 2007-04-17 16:34:50 UTC (rev 1091) @@ -79,6 +79,8 @@ \SweaveInput{discussion} +\SweaveInput{acknowledgment} + %\bibliography{./refs} \SweaveInput{bibliography} Modified: trunk/PathwayModeling/thesispaper/paper.pdf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-04-17 15:00:17
|
Revision: 1090 http://svn.sourceforge.net/r-gregmisc/?rev=1090&view=rev Author: warnes Date: 2007-04-17 08:00:06 -0700 (Tue, 17 Apr 2007) Log Message: ----------- Finalize revisions for IET Systems Biology Modified Paths: -------------- trunk/PathwayModeling/thesispaper/R/plotConverged_nocolor.R trunk/PathwayModeling/thesispaper/R/plotDensity_nocolor.R trunk/PathwayModeling/thesispaper/bibliography.Snw trunk/PathwayModeling/thesispaper/discussion.Snw trunk/PathwayModeling/thesispaper/figure1.Snw trunk/PathwayModeling/thesispaper/figure2.Snw trunk/PathwayModeling/thesispaper/figure3.Snw trunk/PathwayModeling/thesispaper/figure4.Snw trunk/PathwayModeling/thesispaper/figure5.Snw trunk/PathwayModeling/thesispaper/figure6.Snw trunk/PathwayModeling/thesispaper/figure7.Snw trunk/PathwayModeling/thesispaper/figure8.Snw trunk/PathwayModeling/thesispaper/methods.Snw trunk/PathwayModeling/thesispaper/paper.Snw trunk/PathwayModeling/thesispaper/paper.pdf trunk/PathwayModeling/thesispaper/priorPlot.Snw trunk/PathwayModeling/thesispaper/results.Snw Modified: trunk/PathwayModeling/thesispaper/R/plotConverged_nocolor.R =================================================================== --- trunk/PathwayModeling/thesispaper/R/plotConverged_nocolor.R 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/R/plotConverged_nocolor.R 2007-04-17 15:00:06 UTC (rev 1090) @@ -7,19 +7,17 @@ maxY <- 0.0012 # for (i in 1:8) { - for (i in c(1,3,8)) { + for (i in c(1,4)) { p <- paste("d",i,sep="") plotDensity_nocolor(output12[,i],p,5000,Ylim=maxY,lineType=2) - par(new=T) - plotDensity_nocolor(output16[,i],p,5000,Ylim=maxY,lineType=3) - par(new=T) - plotDensity_nocolor(output25[,i],p,5000,Ylim=maxY,lineType=4) + plotDensity_nocolor(output16[,i],p,5000,Ylim=maxY,lineType=3, add=TRUE) + plotDensity_nocolor(output25[,i],p,5000,Ylim=maxY,lineType=4, add=TRUE) } -# plotDensity_nocolor(output12[,9],'d9',5,Ylim=5.7,lineType=2) -# par(new=T) -# plotDensity_nocolor(output16[,9],'d9',5,Ylim=5.7,lineType=3) -# par(new=T) -# plotDensity_nocolor(output25[,9],'d9',5,Ylim=5.7,lineType=4) + # prior mode is 5, but fits are all much less than 5 so scale down so range + # is [0,5] + plotDensity_nocolor(output12[,9],'d9',5,Ylim=5.7,lineType=2, Xlim=5) + plotDensity_nocolor(output16[,9],'d9',5,Ylim=5.7,lineType=3, Xlim=5, add=TRUE) + plotDensity_nocolor(output25[,9],'d9',5,Ylim=5.7,lineType=4, Xlim=5, add=TRUE) par(oldpar) Modified: trunk/PathwayModeling/thesispaper/R/plotDensity_nocolor.R =================================================================== --- trunk/PathwayModeling/thesispaper/R/plotDensity_nocolor.R 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/R/plotDensity_nocolor.R 2007-04-17 15:00:06 UTC (rev 1090) @@ -2,7 +2,9 @@ parameter="di", prior, Ylim=0, - lineType=1 + Xlim=5*prior, + lineType=1, + add=FALSE ) { @@ -10,13 +12,18 @@ deltaX<-(max(dens$x)-min(dens$x))/length(dens$x) sumY<-sum(dens$y) maxY<-max(dens$y, Ylim) - X<-seq(1,5*prior, 0.05*prior) - - plot(X, 3*dchisq(3*X/prior, 5)/prior, type='l', - xlim=c(0, 5*prior), ylim=c(0, maxY), - ylab="density", xlab=parameter, - lty=1, lwd=2) + X <- seq(0,Xlim, 0.05*prior) + if(!add) + plot(X, + 3*dchisq(3*X/prior, 5)/prior, + type='l', + xlim=c(0,Xlim), + ylim=c(0, maxY), + ylab="density", + xlab=parameter, + lty=1, lwd=2) + lines(dens$x, dens$y, lty=lineType, lwd=2) } Modified: trunk/PathwayModeling/thesispaper/bibliography.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/bibliography.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/bibliography.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -58,7 +58,4 @@ Byrd, R.H., Lu, P., Nocedal, J., and Zhu, C., 1995, A limited memory algorithm for bound constrained optimization, \emph{SIAM J. Sci. Comput.}, \textbf{16}, 1190--1208. - \bibitem{Geyer}%16 - Geyer, CJ, (no date), \emph{Burn-In is Unnecessary}, web site, - http://www.stat.umn.edu/~charlie/mcmc/burn.html \end{thebibliography} Modified: trunk/PathwayModeling/thesispaper/discussion.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/discussion.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/discussion.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -25,7 +25,7 @@ of the system and use the experimental data to refine the estimates (Figure~\ref{converged}). Thus the model fitting procedure described here lends itself to iterative experimentation where the experimental -results, even if they consit of a single datum, can be used to update +results, even if they consist of a single datum, can be used to update the prior for the next experiment. The models used here have the form of the Hill function, @@ -53,7 +53,7 @@ times varied considerably depending on the size of the model. The all-component Metropolis and NKC algorithms converged quickly while the 1-component algorithm was quite slow to converge. This is -undoubtably due to the high correlations between some parameters (see +undoubtedly due to the high correlations between some parameters (see Figure~\ref{scatter}). The 1-component algorithm has trouble sampling from this density because it is restricted to moves parallel to the coordinate axes. This is less of a problem for the all-components and Modified: trunk/PathwayModeling/thesispaper/figure1.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/figure1.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/figure1.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -1,6 +1,6 @@ -\begin{figure} +\begin{figure*} \centering \includegraphics[scale=0.9]{figures/glycolysis} \caption{Production of methylglyoxal in hyperglycemia} \label{glycolysis} -\end{figure} +\end{figure*} Modified: trunk/PathwayModeling/thesispaper/figure2.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/figure2.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/figure2.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -21,12 +21,18 @@ N <- dev.off() detach(rawdata.trimmed) @ - \begin{figure} + +\begin{figure*} + \centering % \includegraphics[scale=0.5]{figures/tempDir/pulse} \includegraphics[scale=0.5]{figures/tempDir/pulse_nocolor} - \caption[Reactant concentrations following a pulse of R1]{Reactant concentrations following a pulse of R1 at - $time=20$ for the sequence of reactions $R1\rightarrow - R2\rightarrow R3\rightarrow R4\rightarrow R5\rightarrow sink$.} + \caption[Reactant concentrations following a pulse of R1]{ + Reactant concentrations following a pulse of R1 at + $time=20$ for the sequence of reactions $R1\rightarrow + R2\rightarrow R3\rightarrow R4\rightarrow R5\rightarrow sink$. + } \label{pulse} - \end{figure} + +\end{figure*} + Modified: trunk/PathwayModeling/thesispaper/figure3.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/figure3.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/figure3.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -1,4 +1,5 @@ - \begin{figure} +\begin{figure*} + \centering \subfloat[1-component]{\includegraphics[scale=0.45]{figures/1comp} \label{1comp}} @@ -8,12 +9,14 @@ \qquad \subfloat[NKC]{\includegraphics[scale=0.45]{figures/nkc}\label{nkc}} \qquad - \caption[Movement of Markov chains with the - Metropolis algorithms]{Movement of Markov chains with the component-wise and - all-components Metropolis algorithms. Movement in a - 2-dimensional space is illustrated, so each point has 2 - components. The dotted lines are contours of equal probability - density for the proposal distributions and the dashed lines are - probabilty contours of the target distribution.} + \caption[Movement of Markov chains with the Metropolis algorithms]{ + Movement of Markov chains with the component-wise and + all-components Metropolis algorithms. Movement in a + 2-dimensional space is illustrated, so each point has 2 + components. The dotted lines are contours of equal probability + density for the proposal distributions and the dashed lines are + probability contours of the target distribution. + } \label{1comp_vs_all} - \end{figure} + +\end{figure*} Modified: trunk/PathwayModeling/thesispaper/figure4.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/figure4.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/figure4.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -36,17 +36,24 @@ par(mfrow=c(1,1)) detach(input16) @ -\begin{figure} + +\begin{figure*} + \centering % \includegraphics[scale=0.8]{figures/tempDir/densities} \includegraphics[scale=0.8]{figures/tempDir/densities_nocolor} - \caption[Histograms of the marginal probability distributions]{Histograms of the marginal probability distributions for - the 5-reaction model generated with the all-components Metropolis - algorithm and the 16-point dataset. The curves are normal densities with means equal to the - medians of the distributions and variances equal to the variances of - the distributions. Broken + \caption[Histograms of the marginal probability distributions]{ + + Histograms of the marginal probability distributions for + the 5-reaction model generated with the all-components Metropolis + algorithm and the 16-point dataset. The curves are normal + densities with means equal to the medians of the distributions and + variances equal to the variances of the distributions. Broken % Red -vertical lines indicate the parameters values that - minimize the mean squared residuals.} + vertical lines indicate the parameters values that minimize the + mean squared residuals. + } \label{densities} -\end{figure} + +\end{figure*} + Modified: trunk/PathwayModeling/thesispaper/figure5.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/figure5.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/figure5.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -1,4 +1,4 @@ -<<fig5,echo=F,eval=F>>=4 +<<fig5,echo=F,eval=T>>=4 # source("R/plotDensity.R") # source("R/plotConverged.R") source("R/plotDensity_nocolor.R") @@ -9,7 +9,7 @@ # pdf(file="figures/tempDir/converged.pdf",width=6,height=6) # postscript(file="figures/tempDir/converged.eps",width=6,height=6) -pdf(file="figures/tempDir/converged_nocolor.pdf",width=2*6,height=2*2) +pdf(file="figures/tempDir/converged_nocolor.pdf",width=6,height=2) # plotConverged() plotConverged_nocolor() N <- dev.off() @@ -22,11 +22,11 @@ par(mfrow=c(1,1)) @ -\begin{figure} +\begin{figure*} \centering \includegraphics[width=1.0\textwidth]{figures/tempDir/converged_nocolor} \caption{% - Posterior distributions for selected parameters fitte1d using the % + Posterior distributions for selected parameters fitted using the % all-components algorithm. For each parameter, the model was fitted % with 4 different time point granularities across the fixed time interval: % --------- prior distribution (0 points), % @@ -35,4 +35,4 @@ -- $\cdot$ -- $\cdot$ -- 25 points % } \label{converged} -\end{figure} +\end{figure*} Modified: trunk/PathwayModeling/thesispaper/figure6.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/figure6.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/figure6.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -20,14 +20,14 @@ N <- dev.off() par(pch=1) @ -\begin{figure} +\begin{figure*} \centering % \includegraphics[width=1.0\textwidth]{figures/tempDir/scatterPlot} \includegraphics[width=1.0\textwidth]{figures/tempDir/scatterPlot_nocolor} \caption[Bivariate scatter plots of the parameter distributions]{Bivariate scatter plots of the parameter distributions for the 5-reaction model found with the all-components Metropolis algorithm (upper triangle); correlation coefficients (lower - triangle). The veritcal and horizontal lines indicate the maximum + triangle). The vertical and horizontal lines indicate the maximum likelihood estimates of the parameters.} \label{scatter} -\end{figure} +\end{figure*} Modified: trunk/PathwayModeling/thesispaper/figure7.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/figure7.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/figure7.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -23,7 +23,7 @@ N <- dev.off() detach(input16) @ -\begin{figure} +\begin{figure*} \centering % \subfloat[v2]{\includegraphics[scale=0.30]{figures/tempDir/V1fitted}} % \subfloat[v3]{\includegraphics[scale=0.30]{figures/tempDir/V2fitted}}\\ @@ -42,4 +42,4 @@ function. } \label{fits} -\end{figure} +\end{figure*} Modified: trunk/PathwayModeling/thesispaper/figure8.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/figure8.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/figure8.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -30,7 +30,7 @@ N <- dev.off() detach(input16) @ -\begin{figure} +\begin{figure*} \centering % \includegraphics[scale=0.5]{figures/tempDir/MSR16} \includegraphics[scale=0.5]{figures/tempDir/MSR16_nocolor} @@ -38,4 +38,4 @@ evaluations]{Mean squared residuals vs. number of likelihood evaluations for the 5-reaction model} \label{SSQvsIter} -\end{figure} +\end{figure*} Modified: trunk/PathwayModeling/thesispaper/methods.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/methods.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/methods.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -6,9 +6,11 @@ \subsection{The Pathway} - While we examined several pathway structures, in this paper we - present the results for a 5-reaction sequence that is sampled at 12, - 16, or 25 time points with 3 replicates at each time point. The + We examined pathways containing 3, 5, 7, and 9 reactions with both + linear and branched structures using two sets of parameter values. + As essentially identical modeling performance was obtained for each, + we present only the results for a 5-reaction sequence, sampled at + 12, 16, or 25 time points with 3 replicates at each time point. The units for time and concentration are arbitrary; for the purpose of illustration we will use minutes as the unit of time and micromoles/liter ($\mu$M) as the unit of concentration. @@ -112,7 +114,7 @@ half-maximal velocity} \end{eqnarray*} This form of the equation is very useful because $v$ and $S$ are - usually measureable and $V_{max}$ and $K_m$ can be obtained by + usually measurable and $V_{max}$ and $K_m$ can be obtained by fitting equation 3 to the data. In contrast, modeling $v$ as a function of the individual rate constants is less useful because that requires the measurement of the concentration of the @@ -236,38 +238,39 @@ The Normal Kernel Coupler (NKC) algorithm operates on multiple chains, so that there are several ``current'' states. The NKC uses - a normal kernel density estimate as the proposal distribution for - choosing candidate states. The estimate is generated using the - entire set of current points. Since the algorithm uses the entire - set of current points it can move over areas of low probability in - the parameter space, especially if the user takes care to seed - each mode with a few points in the starting set. + a normal kernel density estimate based on the entire set of + current states as the proposal distribution for choosing candidate + states. Since the algorithm uses the entire set of current points + it can move over areas of low probability in the parameter space, + especially if the user takes care to seed the starting set with a + few points in each mode. \subsection{Computation} \subsubsection{Tuning} All three MCMC algorithms require an appropriate covariance matrix - to move efficiently through the paramter space. The optimal - covaraince matrix for each method is a scaled version of the true - covarance matrix. To obtain this covariance matrix, we performed + to move efficiently through the parameter space. The optimal + covariance matrix for each method is a scaled version of the true + covariance matrix. To obtain this covariance matrix, we performed several runs of the all-components algorithm. After each run, two calculations were performed. First, an estimate of the posterior covariance matrix was computed from the MCMC output to be used in the next run. Second, \textit{mcgibbsit} (see \ref{convergence} below) was used to estimate the necessary length of the next - run. Only three runs were required to achieve both an acceptible + run. Only three runs were required to achieve both an acceptable estimate according to \textit{mcgibbsit} and a covariance matrix with good performance for all three algorithms. \subsubsection{Execution} To enable a ``fair'' comparison between the methods, each MCMC - algorithm was started at the same starting point (jittered for - the multiple starting states of the NKC) and the proposal covariance - was set to an appropriately scaled version of the posterior - covariance matrix described above. With this covariance matrix, each - of the algorithms demonstrated an appropriate acceptance rate. + algorithm was started at the same starting point (jittered to + provide the multiple starting states of the NKC) and the proposal + covariance was set to an appropriately scaled version of the + posterior covariance matrix described above. With this covariance + matrix, each of the algorithms demonstrated an appropriate + acceptance rate. \subsubsection{Convergence} \label{convergence} @@ -275,10 +278,10 @@ The MCMC simulations were run until the Markov chains have reached stable distributions as assessed by the \textit{mcgibbsit} algorithm \cite{Warnes00}. \textit{mcgibbsit} calculates the - number of iterations necessary to estimate a user-specfied quantile + number of iterations necessary to estimate a user-specified quantile $q$ to within $\pm r$ with probability $s$, i.e., \textit{mcgibbsit} indicates when the MCMC sampler has run long - enough to provide good confidence interval estimates. The defaults, + enough to provide good credible interval estimates. The defaults, which are used in this paper, are $q=0.025$, $r=0.0125$, and $s=0.95$. These values generate estimates of the 2.5\% and 97.5\% quantiles to $\pm$ 0.0125 quantiles with probability 0.95. @@ -290,7 +293,7 @@ be heavily influenced by the initial starting point, and can result in bias in the computed estimates. We adopted an alternative approach to avoiding bias in our estimates; each MCMC sampler was - run until \textit{mcgibbsit} was satistified that the quantile + run until \textit{mcgibbsit} was satisfied that the quantile estimates were properly estimated. One necessary condition for \textit{mcgibbsit} to declare that these quantiles are properly estimated is stability of these estimates. This will only occur @@ -299,7 +302,7 @@ posterior distribution. Likewise, the high serial correlation of most MCMC samples has - induced many MCMC papers to recommend \emph{thinning} the ouput of + induced many MCMC papers to recommend \emph{thinning} the output of the MCMC sampler by discarding all but 1 out of,say, every 10 or 100 generated values. While this does not improve in the quality of estimates obtained from the MCMC run itself, it can dramatically Modified: trunk/PathwayModeling/thesispaper/paper.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/paper.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/paper.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -15,6 +15,7 @@ \usepackage{dchem} %\usepackage{color} \usepackage{setspace} +\usepackage{endfloat} \bibliographystyle{vancouver} \newcommand{\deriv}[2]{\ensuremath{\frac{\mathrm{d} #1}{\mathrm{d} #2}}} Modified: trunk/PathwayModeling/thesispaper/paper.pdf =================================================================== (Binary files differ) Modified: trunk/PathwayModeling/thesispaper/priorPlot.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/priorPlot.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/priorPlot.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -1,4 +1,6 @@ -\begin{figure} + +\begin{figure*} + \centering <<priorPlot,echo=F,eval=T,fig=T,width=6,height=3>>= @@ -17,7 +19,11 @@ mtext(text="3", side=1, at=3, line=0.5) @ -\caption{Prior density (scaled $\chi^2 <- 5$) for $\mu_i$ and $\sigma$ - model parameters.} +\caption{ + Prior density (scaled $\chi^2 <- 5$) for $\mu_i$ and $\sigma$ + model parameters. +} \label{priorPlot} -\end{figure} + +\end{figure*} + Modified: trunk/PathwayModeling/thesispaper/results.Snw =================================================================== --- trunk/PathwayModeling/thesispaper/results.Snw 2007-04-17 03:13:14 UTC (rev 1089) +++ trunk/PathwayModeling/thesispaper/results.Snw 2007-04-17 15:00:06 UTC (rev 1090) @@ -15,14 +15,16 @@ The effect of the number of data points within a fixed time window on the parameter distributions can be seen in Figure~\ref{converged}. +% \SweaveInput{figure5} -We see some improved precision as the number of points -increases from 16 to 25 but it is not pronounced. Overall, the -reduction in width varied from 18-fold for $d_9$ and 9-fold for $d_1$ to -1.5-fold for $d_4$. -Figure~\ref{scatter} is an example of a bivariate scatterplot of the -distributions. There is correlation between some pairs of parameters, e.g., -$d_1$ -- $d_2$, but no evidence of multi-modality. +% +We see some improved precision as the number of +points increases from 16 to 25 but it is not pronounced. Overall, the +reduction in width varied from 18-fold for $d_9$ and 9-fold for $d_1$ +to 1.5-fold for $d_4$. Figure~\ref{scatter} is an example of a +bivariate scatterplot of the distributions. There is strong +correlation between some pairs of parameters, e.g., $d_1$ -- $d_2$, +but no evidence of multi-modality. \SweaveInput{figure6} The value of the posterior probability density for inference was @@ -30,7 +32,7 @@ maximum posterior density estimate for the model parameters and the 95\% credible intervals. The fits of the resulting models to the 16-point data set is shown in Figure~\ref{fits}. Quantitative measures -of the fits for +of the fits for % \SweaveInput{figure7} % This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-04-12 21:17:00
|
Revision: 1088 http://svn.sourceforge.net/r-gregmisc/?rev=1088&view=rev Author: warnes Date: 2007-04-12 14:16:41 -0700 (Thu, 12 Apr 2007) Log Message: ----------- Add ask() function to prompt the user and collect a single response. Modified Paths: -------------- trunk/gtools/NAMESPACE trunk/gtools/NEWS Added Paths: ----------- trunk/gtools/R/ask.R trunk/gtools/man/ask.Rd Modified: trunk/gtools/NAMESPACE =================================================================== --- trunk/gtools/NAMESPACE 2007-04-07 13:41:51 UTC (rev 1087) +++ trunk/gtools/NAMESPACE 2007-04-12 21:16:41 UTC (rev 1088) @@ -2,6 +2,7 @@ export( addLast, + ask, assert, capture, combinations, Modified: trunk/gtools/NEWS =================================================================== --- trunk/gtools/NEWS 2007-04-07 13:41:51 UTC (rev 1087) +++ trunk/gtools/NEWS 2007-04-12 21:16:41 UTC (rev 1088) @@ -1,3 +1,9 @@ +SVN +---- + +- Add ask() function to prompt the user and collect a single response. + + gtools 2.3.0 ------------ Added: trunk/gtools/R/ask.R =================================================================== --- trunk/gtools/R/ask.R (rev 0) +++ trunk/gtools/R/ask.R 2007-04-12 21:16:41 UTC (rev 1088) @@ -0,0 +1,5 @@ +ask <- function(msg="Press <RETURN> to continue: ") + { + cat(msg); + readLines(con=stdin(),n=1) + } Added: trunk/gtools/man/ask.Rd =================================================================== --- trunk/gtools/man/ask.Rd (rev 0) +++ trunk/gtools/man/ask.Rd 2007-04-12 21:16:41 UTC (rev 1088) @@ -0,0 +1,36 @@ +\name{ask} +\alias{ask} +\title{Display a prompt and collect the user's response} +\description{ + Display a prompt and collect the user's response +} +\usage{ +ask(msg = "Press <RETURN> to continue: ") +} +\arguments{ + \item{msg}{Character vetor providing the message to be displayed} +} +\details{ + The prompt message will be displayed, and then \code{readLines} is + used to collect a single input value (possibly empty), which is then + returned. +} +\value{ + A character scalar containing the input providede by the user. +} +\author{Gregory R. Warnes \email{gr...@ra...}} +\seealso{ \code{\link{readLines}}, \code{\link{scan}} } +\examples{ + +# use default prompt +ask() + +silly <- function() +{ + age <- ask("How old aroe you? ") + age <- as.numeric(age) + cat("In 10 years you will be", age+10, "years old!\n") +} + +} +\keyword{IO} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-04-07 13:41:53
|
Revision: 1087 http://svn.sourceforge.net/r-gregmisc/?rev=1087&view=rev Author: warnes Date: 2007-04-07 06:41:51 -0700 (Sat, 07 Apr 2007) Log Message: ----------- Fix improper escapes in regexp detected by R 2.5.0 package check. Modified Paths: -------------- trunk/gtools/DESCRIPTION trunk/gtools/R/mixedsort.R Modified: trunk/gtools/DESCRIPTION =================================================================== --- trunk/gtools/DESCRIPTION 2007-03-24 21:31:01 UTC (rev 1086) +++ trunk/gtools/DESCRIPTION 2007-04-07 13:41:51 UTC (rev 1087) @@ -2,7 +2,7 @@ Title: Various R programming tools Description: Various R programming tools Depends: R -Version: 2.3.0 +Version: 2.3.1 Author: Gregory R. Warnes. Includes R source code and/or documentation contributed by Ben Bolker and Thomas Lumley Maintainer: Gregory R. Warnes <wa...@bs...> Modified: trunk/gtools/R/mixedsort.R =================================================================== --- trunk/gtools/R/mixedsort.R 2007-03-24 21:31:01 UTC (rev 1086) +++ trunk/gtools/R/mixedsort.R 2007-04-07 13:41:51 UTC (rev 1087) @@ -45,7 +45,7 @@ #### # find and mark numbers in the form of +1.23e+45.67 - delimited <- gsub("([+-]{0,1}[0-9\.]+([eE][\+\-]{0,1}[0-9\.]+){0,1})", + delimited <- gsub("([+-]{0,1}[0-9\\.]+([eE][\\+\\-]{0,1}[0-9\\.]+){0,1})", paste(delim,"\\1",delim,sep=""), x) # separate out numbers This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2007-03-24 21:31:07
|
Revision: 1086 http://svn.sourceforge.net/r-gregmisc/?rev=1086&view=rev Author: warnes Date: 2007-03-24 14:31:01 -0700 (Sat, 24 Mar 2007) Log Message: ----------- Update version number and date Modified Paths: -------------- trunk/fork/DESCRIPTION Modified: trunk/fork/DESCRIPTION =================================================================== --- trunk/fork/DESCRIPTION 2007-03-24 21:30:26 UTC (rev 1085) +++ trunk/fork/DESCRIPTION 2007-03-24 21:31:01 UTC (rev 1086) @@ -1,7 +1,7 @@ Package: fork Title: R functions for handling multiple processes. -Version: 1.2.0 -Date: 2007-03-22 +Version: 1.2.1 +Date: 2007-03-24 Author: Gregory R. Warnes <gr...@ra...>. Financial support for some aspects of this package provided by Metrum Research Group, LLC <http://www.metrumrg.com>. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |