r-gregmisc-users Mailing List for R gregmisc package (Page 29)
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: <ar...@us...> - 2008-06-30 22:29:39
|
Revision: 1299 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1299&view=rev Author: arnima Date: 2008-06-30 15:29:35 -0700 (Mon, 30 Jun 2008) Log Message: ----------- Simplified default 'unit' argument from c("KB","MB","bytes") to "KB". Modified Paths: -------------- trunk/gdata/R/env.R trunk/gdata/R/ll.R trunk/gdata/man/env.Rd trunk/gdata/man/ll.Rd Modified: trunk/gdata/R/env.R =================================================================== --- trunk/gdata/R/env.R 2008-06-23 23:51:13 UTC (rev 1298) +++ trunk/gdata/R/env.R 2008-06-30 22:29:35 UTC (rev 1299) @@ -1,6 +1,4 @@ -# $Id$ - -env <- function(unit=c("KB","MB","bytes"), digits=0) +env <- function(unit="KB", digits=0) { get.object.size <- function(object.name, pos) { @@ -26,7 +24,7 @@ return(nobjects) } - unit <- match.arg(unit) + unit <- match.arg(unit, c("bytes","KB","MB")) denominator <- switch(unit, "KB"=1024, "MB"=1024^2, 1) size.vector <- sapply(seq(along=search()), get.environment.size) size.vector <- round(size.vector/denominator, digits) Modified: trunk/gdata/R/ll.R =================================================================== --- trunk/gdata/R/ll.R 2008-06-23 23:51:13 UTC (rev 1298) +++ trunk/gdata/R/ll.R 2008-06-30 22:29:35 UTC (rev 1299) @@ -1,5 +1,5 @@ -ll <- function(pos=1, unit=c("KB","MB","bytes"), digits=0, dimensions=FALSE, - function.dim="", sort.elements=FALSE, ...) +ll <- function(pos=1, unit="KB", digits=0, dimensions=FALSE, function.dim="", + sort.elements=FALSE, ...) { get.object.classname <- function(object.name, pos) { @@ -29,7 +29,7 @@ return(size) } - unit <- match.arg(unit) + unit <- match.arg(unit, c("bytes","KB","MB")) denominator <- switch(unit, "KB"=1024, "MB"=1024^2, 1) if(is.character(pos)) # pos is an environment name Modified: trunk/gdata/man/env.Rd =================================================================== --- trunk/gdata/man/env.Rd 2008-06-23 23:51:13 UTC (rev 1298) +++ trunk/gdata/man/env.Rd 2008-06-30 22:29:35 UTC (rev 1299) @@ -7,7 +7,7 @@ Display name, number of objects, and size of all loaded environments. } \usage{ -env(unit=c("KB","MB","bytes"), digits=0) +env(unit="KB", digits=0) } \arguments{ \item{unit}{required unit for displaying environment size: "bytes", Modified: trunk/gdata/man/ll.Rd =================================================================== --- trunk/gdata/man/ll.Rd 2008-06-23 23:51:13 UTC (rev 1298) +++ trunk/gdata/man/ll.Rd 2008-06-30 22:29:35 UTC (rev 1299) @@ -9,8 +9,8 @@ object, its elements are listed and described. } \usage{ -ll(pos=1, unit=c("KB","MB","bytes"), digits=0, dimensions=FALSE, - function.dim="", sort.elements=FALSE, ...) +ll(pos=1, unit="KB", digits=0, dimensions=FALSE, function.dim="", + sort.elements=FALSE, ...) } \arguments{ \item{pos}{environment position number, environment name, data frame, @@ -39,8 +39,7 @@ } \author{Arni Magnusson \email{arnima@u.washington.edu}, with a - contribution by Jim Rogers - \email{jam...@pf...}} + contribution by Jim Rogers \email{jam...@pf...}} \seealso{ \code{\link{ls}} displays names of objects in a given environment. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-16 14:18:51
|
Revision: 1296 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1296&view=rev Author: warnes Date: 2008-06-16 07:18:50 -0700 (Mon, 16 Jun 2008) Log Message: ----------- Add TODO list to gplots Added Paths: ----------- trunk/gplots/TODO trunk/gplots/inst/TODO Added: trunk/gplots/TODO =================================================================== --- trunk/gplots/TODO (rev 0) +++ trunk/gplots/TODO 2008-06-16 14:18:50 UTC (rev 1296) @@ -0,0 +1 @@ +link inst/TODO \ No newline at end of file Property changes on: trunk/gplots/TODO ___________________________________________________________________ Name: svn:special + * Added: trunk/gplots/inst/TODO =================================================================== --- trunk/gplots/inst/TODO (rev 0) +++ trunk/gplots/inst/TODO 2008-06-16 14:18:50 UTC (rev 1296) @@ -0,0 +1,10 @@ + +plot.lm2 +-------- + +- Upgrade to match current plot.lm code +- For predictor vs resid, use boxplot when predictor is a factor +- Rug plot or histogram for residuals/fitted values in both dimensions +- Confidence region for normal distribution with equivalent number of points on QQ plot +- display "bad" cutoff line for cook's distance plot + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-14 21:03:54
|
Revision: 1295 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1295&view=rev Author: warnes Date: 2008-06-14 14:03:53 -0700 (Sat, 14 Jun 2008) Log Message: ----------- Minor changes to improve R CMD CHECK results Modified Paths: -------------- trunk/SII/R/reload.constants.R trunk/SII/R/sii.excel.R trunk/SII/man/critical.Rd trunk/SII/man/sic.critical.Rd Added Paths: ----------- trunk/SII/man/undocumented.Rd Modified: trunk/SII/R/reload.constants.R =================================================================== --- trunk/SII/R/reload.constants.R 2008-06-14 20:51:59 UTC (rev 1294) +++ trunk/SII/R/reload.constants.R 2008-06-14 21:03:53 UTC (rev 1295) @@ -4,6 +4,8 @@ if(!require("gdata")) stop("'gdata' package must be installed to run this function.") + + read.xls <- gdata::read.xls "critical" <- read.xls( xls=file.path(xls.path,"SII_Constants.xls"), Modified: trunk/SII/R/sii.excel.R =================================================================== --- trunk/SII/R/sii.excel.R 2008-06-14 20:51:59 UTC (rev 1294) +++ trunk/SII/R/sii.excel.R 2008-06-14 21:03:53 UTC (rev 1295) @@ -15,7 +15,7 @@ if(matlab.spline) { - ispl <- interpSpline( THDI ~ freq ) + ispl <- splines::interpSpline( THDI ~ freq ) THDI <- predict(ispl, sii.freqs)$y THDI[sii.freqs<freq[1]] <- THDI[1] } Modified: trunk/SII/man/critical.Rd =================================================================== --- trunk/SII/man/critical.Rd 2008-06-14 20:51:59 UTC (rev 1294) +++ trunk/SII/man/critical.Rd 2008-06-14 21:03:53 UTC (rev 1295) @@ -3,6 +3,7 @@ \alias{equal} \alias{onethird} \alias{octave} +\alias{overall.spl} \docType{data} \title{Constants Tables for ANSI S3.5-1997 Speech Intelligibility Index (SII)} Modified: trunk/SII/man/sic.critical.Rd =================================================================== --- trunk/SII/man/sic.critical.Rd 2008-06-14 20:51:59 UTC (rev 1294) +++ trunk/SII/man/sic.critical.Rd 2008-06-14 21:03:53 UTC (rev 1295) @@ -1,6 +1,6 @@ \name{sic.critical} \alias{sic.critical} -\alias{sic.threeoctave} +\alias{sic.onethird} \alias{sic.octave} \docType{data} \title{Alternative ANSI S3.5-1997 SII Transfer Function Weights} @@ -10,7 +10,7 @@ } \usage{ data(sic.critical) -data(sic.threeoctave) +data(sic.onethird) data(sic.octave) } \format{ Added: trunk/SII/man/undocumented.Rd =================================================================== --- trunk/SII/man/undocumented.Rd (rev 0) +++ trunk/SII/man/undocumented.Rd 2008-06-14 21:03:53 UTC (rev 1295) @@ -0,0 +1,13 @@ +\name{undocumented} +\alias{sii.constants} +\docType{data} +\title{Undocuumented objects in package 'SII'} +\description{ + Undocuumented objects in package 'SII' +} +\usage{data(sii.constants)} +\details{ + This page notes objects containied in the 'SII' package that are not + intende for public use, hence are undocumented. +} +\keyword{datasets} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-14 20:52:00
|
Revision: 1294 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1294&view=rev Author: warnes Date: 2008-06-14 13:51:59 -0700 (Sat, 14 Jun 2008) Log Message: ----------- Add funding to DESCRIPTION file Modified Paths: -------------- trunk/SII/DESCRIPTION Modified: trunk/SII/DESCRIPTION =================================================================== --- trunk/SII/DESCRIPTION 2008-06-14 20:48:11 UTC (rev 1293) +++ trunk/SII/DESCRIPTION 2008-06-14 20:51:59 UTC (rev 1294) @@ -17,6 +17,10 @@ The initial purpose of this package is to support use of SII as a standard measure of severity of presbycusis (age-related of hearing loss). + -- + Development of this package was funded by the Center for Bioscience + Educationand Technology (CBET) of the Rochester Institute of + Technology (RIT). Depends: Recommends: splines, gdata License: GPLv2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-14 20:48:13
|
Revision: 1293 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1293&view=rev Author: warnes Date: 2008-06-14 13:48:11 -0700 (Sat, 14 Jun 2008) Log Message: ----------- Update package DESCRIPTION file. Modified Paths: -------------- trunk/SII/DESCRIPTION Modified: trunk/SII/DESCRIPTION =================================================================== --- trunk/SII/DESCRIPTION 2008-06-14 20:03:25 UTC (rev 1292) +++ trunk/SII/DESCRIPTION 2008-06-14 20:48:11 UTC (rev 1293) @@ -1,23 +1,23 @@ Package: SII Type: Package Title: Calculate ANSI S3.5-1997 Speech Intelligibility Index -Version: 0.1.0 -Date: 2008-06-07 +Version: 0.1.1 +Date: 2008-06-14 Author: Gregory R. Warnes Maintainer: Gregory R. Warnes <su...@ra...> Description: This package calculates ANSI S3.5-1997 Speech Intelligibility Index (SII), which is a standard method for computing the intelligibility - of speeck from acoustical measurments of speech and noise. This + of speech from acoustical measurements of speech and noise. This package includes data frames corresponding to Tables 1 - 4 in the ANSI - standard as well as a function utlilizing these tables and - user-provided hearing threshold and noise level measurments to + standard as well as a function utilizing these tables and + user-provided hearing threshold and noise level measurements to compute the SII score. -- - The intial purpose of this package is to support use of SII as a + The initial purpose of this package is to support use of SII as a standard measure of severity of presbycusis (age-related of hearing loss). Depends: -Recommands: splines, gdata +Recommends: splines, gdata License: GPLv2 LazyLoad: yes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-14 20:03:34
|
Revision: 1292 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1292&view=rev Author: warnes Date: 2008-06-14 13:03:25 -0700 (Sat, 14 Jun 2008) Log Message: ----------- Implement 'interpolate' as a separate argument, and when 'interpolate=TRUE' replace NA's in any provided measurement vector. Modified Paths: -------------- trunk/SII/R/sii.R trunk/SII/man/sii.Rd Modified: trunk/SII/R/sii.R =================================================================== --- trunk/SII/R/sii.R 2008-06-14 20:01:31 UTC (rev 1291) +++ trunk/SII/R/sii.R 2008-06-14 20:03:25 UTC (rev 1292) @@ -5,7 +5,6 @@ loss, freq, method=c( - "interpolate", "critical", "equal-contributing", "one-third octave", @@ -20,7 +19,8 @@ "ShortPassage", "SPIN", "CST" - ) + ), + interpolate=FALSE ) { ## Assumptions: @@ -28,7 +28,7 @@ ## freq: If provided, frequencies in Hz at which speech, noise, and/or ## threshold values are measured. If missing, frequencies will ## corresponding to those utilized by the specified method. - ## Note that, frequencies must be provided for method="interpolate" + ## Note that, frequencies must be provided if "interpolate=TRUE" ## ## speech: Speech level in dB at each frequency, or one of levels of ## stated vocal effort ("raised", "normal", "loud", "shout") @@ -49,7 +49,6 @@ ## Get the appropriate table of constants data.name <- switch(method, - "interpolate"="critical", "critical"="critical", "one-third octave"="onethird", "equal-contributing"="equal", @@ -79,8 +78,8 @@ ## Handle missing freq if(missing(freq)) - if(method=="interpolate") - stop("`freq' must be specified when `method=\"interpolate\"'") + if(interpolate) + stop("`freq' must be specified when `interpolate=TRUE'") else freq <- table$fi @@ -117,29 +116,13 @@ ) stop("`noise', `threshold', and `loss` must have the same length as `freq'.") - ## Check for & handle missing values - nas <- (is.na(noise) | is.na(threshold) | is.na(loss) | is.na(freq) ) + ## Check for missing values + any.nas <- any(is.na(c(noise,threshold,loss,freq)) ) if(!const.speech) - nas <- nas | is.na(speech) + any.nas <- any.nas || any(is.na(speech)) + if(any.nas && !interpolate) + stop("Missing values only permitted when `interpolate=TRUE'") - if(any(nas) ) - { - if(method=="interpolate") - { - warning(sum(nas), " missing values omitted.") - if(!const.speech) - speech <- speech [!nas] - - noise <- noise [!nas] - threshold <- threshold[!nas] - loss <- loss [!nas] - freq <- freq [!nas] - - } - else - stop("Missing values only permitted for method `interpolate'") - } - ## Sort values into frequency order ord <- order(freq) freq <- freq [ord] @@ -155,30 +138,41 @@ retval <- list() retval$call <- match.call() retval$orig <- list( freq, speech, noise, threshold, loss ) + - if(method=="interpolate") + if(interpolate) { - approx.l <- function(x,y) - { + + sii.freqs <- table[,"fi"] + + approx.l <- function(obs.freq,value,target.freq) + { + nas <- is.na(value) + if(any(nas)) + { + warning(sum(nas), " missing values ommitted") + value <- value[!nas] + obs.freq <- obs.freq[!nas] + } + tmp <- approx( - log(x), - y, - log(sii.freqs), + x=log10(obs.freq), + y=value, + xout=log10(target.freq), method="linear", rule=2 ) tmp$y } - - sii.freqs <- table[,"fi"] + #debug(approx.l) ## Interpolate unobserved frequencies - noise <- approx.l(freq, noise) - threshold <- approx.l(freq, threshold) - loss <- approx.l(freq, loss) + noise <- approx.l(freq, noise, sii.freqs) + threshold <- approx.l(freq, threshold, sii.freqs) + loss <- approx.l(freq, loss, sii.freqs) if(!const.speech) - speech <- approx.l(freq, speech) + speech <- approx.l(freq, speech, sii.freqs) freq <- sii.freqs } @@ -231,7 +225,6 @@ ## 4.3.2.3 slope per octive of spread of masking, Ci if(method=="critical" || - method=="interpolate" || method=="equal-contributing") { sii.tab$"Ci" <- -80 + 0.6*( sii.tab$"Bi" + 10*log10(table$"hi" - table$"li") ) @@ -242,7 +235,6 @@ } if(method=="critical" || - method=="interpolate" || method=="equal-contributing") { Zifun <- function(i) Modified: trunk/SII/man/sii.Rd =================================================================== --- trunk/SII/man/sii.Rd 2008-06-14 20:01:31 UTC (rev 1291) +++ trunk/SII/man/sii.Rd 2008-06-14 20:03:25 UTC (rev 1292) @@ -12,10 +12,11 @@ \usage{ sii(speech = c("normal", "raised", "loud", "shout"), noise, threshold, loss, freq, - method = c("interpolate", "critical", "equal-contributing", + method = c("critical", "equal-contributing", "one-third octave", "octave"), importance = c("SII", "NNS", "CID22", "NU6", "DRT", - "ShortPassage", "SPIN", "CST")) + "ShortPassage", "SPIN", "CST"), + interpolate=FALSE) \method{print}{SII}(x, digits=2, ...) \method{plot}{SII}(x, ...) \method{summary}{SII}(object, digits=2, ...) @@ -38,21 +39,24 @@ defaults to 0 dB for each frequency.} \item{freq}{Vector of frequencies for which \code{speech}, \code{noise}, \code{threshold}, and/or \code{loss} are specified. - If \code{method="interpolate"}, \code{freq} must be specified. + If \code{interpolate=TRUE}, \code{freq} must be specified. Otherwise, it must either match the required value for SII calculation method given by argument \code{method}, or be missing, in which case it will default to the values required for the specified method.} \item{method}{A character string specifying the SII calculation method ("critical", "one-third octave", "equal-contributing", - "octave"), or \code{"interpolate"} in which case the critical-band - method will be applied, with interpolation from the provided - frequencies to the required 21 frequency values.} + "octave")} \item{importance}{Either a numeric vector providing $F_i$, the - transfer function (importance weights) at each frequency, or a character - string indicating which transfer function to employ ("SII", "NNS", - "CID22", "NU6", "DRT", "ShortPassage", "SPIN", "CST"). Defaults to - the standard SII transfer function, \code{importance="SII"}.} + transfer function (importance weights) at each frequency, or a + character string indicating which transfer function to employ + ("SII", "NNS", "CID22", "NU6", "DRT", "ShortPassage", "SPIN", + "CST"). Defaults to the standard SII transfer function, + \code{importance="SII"}.} + \item{interpolate}{Logical flag indicating whether to interpolate + from the provide measurement values and frequencies to those + required by the specified method via linear interpolation on the log + scale.} \item{object,x}{SII object} \item{digits}{Number of digits to display} \item{...}{Optional arguments to \code{print}, \code{summary}, and @@ -78,13 +82,11 @@ Further, this implementation provides a mechanism for interpolating/extrapolating available measurements to those required - for calculating the critical band procedure (via the argument - \code{method="interpolate"}). Interpolation is accomplished using - linear interpolation (on log-scaled data) to the frequencies - required for the critical-band SII procedure. Interpolation is - performed (if necessary) for \code{noise}, \code{threshold}, and - \code{loss}. - + for the specified calculation procedure. When + \code{interpolate=TRUE}, required values for \code{speech}, + \code{noise}, \code{threshold}, and \code{loss} will be computed + using linear interpolation (on log-scaled data). In this case, + missing values may be provided and will be appropriately interpolated. } \value{ The return value is an object of class SII, containing the following @@ -196,7 +198,9 @@ speech="raised", threshold=c(25,25,30,35,45,45,55,60), freq=c(250, 500, 1000, 2000, 3000, 4000, 6000, 8000), - importance="NU6" + method="critical", + importance="NU6", + interpolate=TRUE ) sii.left This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-14 20:01:37
|
Revision: 1291 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1291&view=rev Author: warnes Date: 2008-06-14 13:01:31 -0700 (Sat, 14 Jun 2008) Log Message: ----------- Add SII to importance weight tables Modified Paths: -------------- trunk/SII/man/sic.critical.Rd Modified: trunk/SII/man/sic.critical.Rd =================================================================== --- trunk/SII/man/sic.critical.Rd 2008-06-14 19:59:29 UTC (rev 1290) +++ trunk/SII/man/sic.critical.Rd 2008-06-14 20:01:31 UTC (rev 1291) @@ -19,7 +19,8 @@ speech material: \describe{ \item{\code{fi}}{Center frequency, Hz} - \item{\code{NNS}}{NNS (various nonsense syllable tessz where + \item{\code{SII}}{Standard SII transfer function (weights)} + \item{\code{NNS}}{NNS (various nonsense syllable tests where most of the English phonems occur equally often)} \item{\code{CID22}}{CID-W22 (PB-words)} \item{\code{NU6}}{NU6 monosyllables} @@ -66,15 +67,21 @@ round(sic.critical,3) ## draw a comparison plot -matplot(x=sic.critical[,1], y=sic.critical[,-1], type="o", - xlab="Frequency, Hz", ylab="Weight", - log="x") +ngroup <- ncol(sic.critical) +matplot(x=sic.critical[,1], y=sic.critical[,-1], + type="o", + xlab="Frequency, Hz", + ylab="Weight", + log="x", + lty=1:ngroup, + col=rainbow(ngroup) +) legend( "topright", legend=names(sic.critical)[-1], - pch=1:ncol(sic.critical), - lty=1:ncol(sic.critical), - col=1:ncol(sic.critical) + pch=as.character(1:ngroup), + lty=1:ngroup, + col=rainbow(ngroup) ) data(threeoctave) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-14 19:59:31
|
Revision: 1290 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1290&view=rev Author: warnes Date: 2008-06-14 12:59:29 -0700 (Sat, 14 Jun 2008) Log Message: ----------- Add SII to importance weight tables Modified Paths: -------------- trunk/SII/data/SII_Constants.xls trunk/SII/data/critical.rda trunk/SII/data/equal.rda trunk/SII/data/octave.rda trunk/SII/data/onethird.rda trunk/SII/data/sic.critical.rda trunk/SII/data/sic.octave.rda trunk/SII/data/sic.onethird.rda Modified: trunk/SII/data/SII_Constants.xls =================================================================== (Binary files differ) Modified: trunk/SII/data/critical.rda =================================================================== (Binary files differ) Modified: trunk/SII/data/equal.rda =================================================================== (Binary files differ) Modified: trunk/SII/data/octave.rda =================================================================== (Binary files differ) Modified: trunk/SII/data/onethird.rda =================================================================== (Binary files differ) Modified: trunk/SII/data/sic.critical.rda =================================================================== (Binary files differ) Modified: trunk/SII/data/sic.octave.rda =================================================================== (Binary files differ) Modified: trunk/SII/data/sic.onethird.rda =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-12 05:56:50
|
Revision: 1289 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1289&view=rev Author: warnes Date: 2008-06-11 22:56:39 -0700 (Wed, 11 Jun 2008) Log Message: ----------- More documentation, and some code cleanup Modified Paths: -------------- trunk/SII/DESCRIPTION trunk/SII/NAMESPACE trunk/SII/R/summary.SII.R trunk/SII/data/sic.octave.rda trunk/SII/man/SII-package.Rd trunk/SII/man/critical.Rd trunk/SII/man/sii.Rd Added Paths: ----------- trunk/SII/man/sic.critical.Rd Removed Paths: ------------- trunk/SII/R/sii.constants.Rd trunk/SII/man/plot.SII.Rd trunk/SII/man/print.SII.Rd trunk/SII/man/sii.excel.Rd Modified: trunk/SII/DESCRIPTION =================================================================== --- trunk/SII/DESCRIPTION 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/DESCRIPTION 2008-06-12 05:56:39 UTC (rev 1289) @@ -1,12 +1,12 @@ Package: SII Type: Package -Title: Calcluate ANSI S3.5-1997 Speech Intelligibility Index +Title: Calculate ANSI S3.5-1997 Speech Intelligibility Index Version: 0.1.0 Date: 2008-06-07 Author: Gregory R. Warnes Maintainer: Gregory R. Warnes <su...@ra...> Description: - This package calculates ANSI S3.5-199 Speech Intelligibility Index + This package calculates ANSI S3.5-1997 Speech Intelligibility Index (SII), which is a standard method for computing the intelligibility of speeck from acoustical measurments of speech and noise. This package includes data frames corresponding to Tables 1 - 4 in the ANSI @@ -15,6 +15,9 @@ compute the SII score. -- The intial purpose of this package is to support use of SII as a - standard measure of the impact age-related of hearing loss. + standard measure of severity of presbycusis (age-related of hearing + loss). +Depends: +Recommands: splines, gdata License: GPLv2 LazyLoad: yes Modified: trunk/SII/NAMESPACE =================================================================== --- trunk/SII/NAMESPACE 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/NAMESPACE 2008-06-12 05:56:39 UTC (rev 1289) @@ -1,7 +1,10 @@ export( - sii + sii, + plot.SII, + print.SII, + summary.SII ) -s3method(plot, SII) -s3method(print, SII) -s3method(summary, SII) +S3method(plot, SII) +S3method(print, SII) +S3method(summary, SII) Deleted: trunk/SII/R/sii.constants.Rd =================================================================== --- trunk/SII/R/sii.constants.Rd 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/R/sii.constants.Rd 2008-06-12 05:56:39 UTC (rev 1289) @@ -1,39 +0,0 @@ -\name{sii.constants} -\alias{sii.constants} -\docType{data} -\title{ ~~ data name/kind ... ~~} -\description{ - ~~ A concise (1-5 lines) description of the dataset. ~~ -} -\usage{data(sii.constants)} -\format{ - A data frame with 21 observations on the following 12 variables. - \describe{ - \item{\code{.NFreqLin}}{a numeric vector} - \item{\code{.NFreqLog}}{a numeric vector} - \item{\code{I.BandImp}}{a numeric vector} - \item{\code{Ti'.THDN}}{a numeric vector} - \item{\code{Ei.Raised}}{a numeric vector} - \item{\code{Xi.Ref.Int.Nz}}{a numeric vector} - \item{\code{Xi'.Int.Noise}}{a numeric vector} - \item{\code{Di.Equiv.Dist}}{a numeric vector} - \item{\code{Li.Distortion}}{a numeric vector} - \item{\code{ki.Temp.Var}}{a numeric vector} - \item{\code{Ai.BandAud}}{a numeric vector} - \item{\code{Si.SII.band.}}{a numeric vector} - } -} -\details{ - ~~ If necessary, more details than the __description__ above ~~ -} -\source{ - ~~ reference to a publication or URL from which the data were obtained ~~ -} -\references{ - ~~ possibly secondary sources and usages ~~ -} -\examples{ -data(sii.constants) -## maybe str(sii.constants) ; plot(sii.constants) ... -} -\keyword{datasets} Modified: trunk/SII/R/summary.SII.R =================================================================== --- trunk/SII/R/summary.SII.R 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/R/summary.SII.R 2008-06-12 05:56:39 UTC (rev 1289) @@ -1,5 +1,5 @@ `summary.SII` <- -function (x, digits = 2, ...) +function (object, digits = 2, ...) { cat("\n") cat("Speech Intellibility Index\n") @@ -7,9 +7,9 @@ cat("\n") cat("Call:\n") cat("\n") - print(x$call) + print(object$call) cat("\n") - methodStr <- switch(x$method, + methodStr <- switch(object$method, "interpolate"="Interpolation + Critical Band", "critical"="Critical band SII procedure", "equal-contributing"="Equally-contrlbutlng (17 band) critical-band SII procedure ", @@ -21,10 +21,10 @@ cat("\n") cat("Calculation table:\n") cat("\n") - print(round(x$table, digits=digits)) + print(object$table, digits=digits) cat("\n") - cat("SII:", round(x$sii, digits), "\n") + cat("SII:", round(object$sii, digits), "\n") cat("\n") - invisible(x) + invisible(object) } Modified: trunk/SII/data/sic.octave.rda =================================================================== (Binary files differ) Modified: trunk/SII/man/SII-package.Rd =================================================================== --- trunk/SII/man/SII-package.Rd 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/man/SII-package.Rd 2008-06-12 05:56:39 UTC (rev 1289) @@ -3,41 +3,46 @@ \alias{SII} \docType{package} \title{ -What the package does (short line) -~~ package title ~~ + Calculate ANSI S3.5-1997 Speech Intelligibility Index } \description{ -More about what it does (maybe more than one line) -~~ A concise (1-5 lines) description of the package ~~ +This package calculates ANSI S3.5-199 Speech Intelligibility Index +(SII), which is a standard method for computing the intelligibility +of speeck from acoustical measurments of speech and noise. This +package includes data frames corresponding to Tables 1 - 4 in the ANSI +standard as well as a function utlilizing these tables and +user-provided hearing threshold and noise level measurments to +compute the SII score. + + +The intial purpose of this package is to support use of SII as a +standard measure of the impact age-related of hearing loss. } \details{ -\tabular{ll}{ -Package: \tab SII\cr -Type: \tab Package\cr -Version: \tab 1.0\cr -Date: \tab 2008-06-07\cr -License: \tab What license is it under?\cr -LazyLoad: \tab yes\cr } -~~ An overview of how to use the package, including the most important ~~ -~~ functions ~~ -} \author{ -Who wrote it - -Maintainer: Who to complain to <you...@so...> -~~ The author and/or maintainer of the package ~~ + Gregory R. Warnes \email{su...@ra...} } \references{ -~~ Literature or other references for background information ~~ +ANSI S3.5-1997, "American National Standard Methods for +Calculation of the Speech Intelligibility Index" American National Stan- +dards Institute, New York. + +Other software programs for calculating SII are available from +\url{http://www.sii.to/html/programs.html}. } -~~ Optionally other standard keywords, one per line, from file KEYWORDS in ~~ -~~ the R documentation directory ~~ \keyword{ package } -\seealso{ -~~ Optional links to other man pages, e.g. ~~ -~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~ -} \examples{ -~~ simple examples of the most important functions ~~ +## Example C.1 from ANSI S3.5-1997 Annex C +sii.C1 <- sii( + speech = c(50.0, 40.0, 40.0, 30.0, 20.0, 0.0), + noise = c(70.0, 65.0, 45.0, 25.0, 1.0,-15.0), + threshold= c( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + method="octave" + ) +sii.C1 # rounded to 2 digits by default +print(sii.C1$sii, digits=20) # full precision +summary(sii.C1) # full details +plot(sii.C1) # plot +## The value given in the Standard is $0.504$. } Modified: trunk/SII/man/critical.Rd =================================================================== --- trunk/SII/man/critical.Rd 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/man/critical.Rd 2008-06-12 05:56:39 UTC (rev 1289) @@ -4,37 +4,77 @@ \alias{onethird} \alias{octave} \docType{data} -\title{ ~~ data name/kind ... ~~} +\title{Constants Tables for ANSI S3.5-1997 Speech Intelligibility Index + (SII)} \description{ - ~~ A concise (1-5 lines) description of the dataset. ~~ + Tables of constants for ANSI S3.5-1997 Speech Intelligibility Index + (SII) } -\usage{data(critical)} +\usage{ +data(critical) +data(equal) +data(onethird) +data(octave) +data(overall.spl) +} + \format{ - A data frame with 21 observations on the following 10 variables. + Each data frames has 6-21 observations and a subset of the following + variables: \describe{ - \item{\code{fi}}{a numeric vector} - \item{\code{li}}{a numeric vector} - \item{\code{hi}}{a numeric vector} - \item{\code{Ii}}{a numeric vector} - \item{\code{normal}}{a numeric vector} - \item{\code{raised}}{a numeric vector} - \item{\code{loud}}{a numeric vector} - \item{\code{shout}}{a numeric vector} - \item{\code{Xi}}{a numeric vector} - \item{\code{Fi}}{a numeric vector} + \item{\code{fi}}{Center frequency of SII band, Hz} + \item{\code{li}}{Lower limit of frequency band, Hz} + \item{\code{hi}}{Upper limit of frequency band, Hz} + \item{\code{Deltai}}{Band width adjustment, dB} + \item{\code{Ii}}{Band importance function} + \item{\code{normal}, \code{raised}, \code{loud} and + \code{shout}}{Standard spectrum levels for vocal effort levels + "normal", "raised", "loud", and "shout", respectively, dB} + \item{\code{Xi}}{Spectrum level of internal noise, dB} + \item{\code{Fi}}{Band importance function (weight)} } } \details{ - ~~ If necessary, more details than the __description__ above ~~ + These data objects provide constant tables 1 -- 4 from the ANSI + S3.5-1997. + \describe{ + \item{\code{critical}}{Table 1: Critical band SII procedure + constants} + \item{\code{equal}}{Table 2:Equally contributing (17 band) critical + band SII} + \item{\code{onethird}}{Table 3: One-third octave band SII procedure + constants} + \item{\code{octave}}{Table 4: Octave band SII procedure constants} + \item{\code{overall.spl}}{Overall sound pressure level (SPL) for the + for vocal effort levels "normal", "raised", "loud", and "shout", + in dB} + } } \source{ - ~~ reference to a publication or URL from which the data were obtained ~~ +ANSI S3.5-1997, "American National Standard Methods for +Calculation of the Speech Intelligibility Index" American National +Standards Institute, New York. } \references{ - ~~ possibly secondary sources and usages ~~ +ANSI S3.5-1997, "American National Standard Methods for +Calculation of the Speech Intelligibility Index" American National +Standards Institute, New York. } \examples{ data(critical) -## maybe str(critical) ; plot(critical) ... +critical # show entire table + +data(equal) +names(equal) +equal$fi # extract just the frequency band centers + +data(onethird) +barplot(onethird$Ii) # plot band importance function (weights) + +data(octave) +round(octave, digits=2) # just 2 digits + +data(overall.spl) +overall.spl } \keyword{datasets} Deleted: trunk/SII/man/plot.SII.Rd =================================================================== --- trunk/SII/man/plot.SII.Rd 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/man/plot.SII.Rd 2008-06-12 05:56:39 UTC (rev 1289) @@ -1,63 +0,0 @@ -\name{plot.SII} -\alias{plot.SII} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{ ~~function to do ... ~~ } -\description{ - ~~ A concise (1-5 lines) description of what the function does. ~~ -} -\usage{ -plot.SII(x, matlab, title, ...) -} -%- maybe also 'usage' for other objects documented here. -\arguments{ - \item{x}{ ~~Describe \code{x} here~~ } - \item{matlab}{ ~~Describe \code{matlab} here~~ } - \item{title}{ ~~Describe \code{title} here~~ } - \item{\dots}{ ~~Describe \code{\dots} here~~ } -} -\details{ - ~~ If necessary, more details than the description above ~~ -} -\value{ - ~Describe the value returned - If it is a LIST, use - \item{comp1 }{Description of 'comp1'} - \item{comp2 }{Description of 'comp2'} - ... -} -\references{ ~put references to the literature/web site here ~ } -\author{ ~~who you are~~ } -\note{ ~~further notes~~ - - ~Make other sections like Warning with \section{Warning }{....} ~ -} -\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ } -\examples{ -##---- Should be DIRECTLY executable !! ---- -##-- ==> Define data, use random, -##-- or do help(data=index) for the standard data sets. - -## The function is currently defined as -function (x, matlab, title, ...) -{ - plot(x = x$freq.orig, y = x$x.orig, col = "black", cex = 2, - log = "x", xlab = "Frequency (Herz)", ylab = "Threshhold of Detection (dB)", - ylim = c(1, 80), xlim = c(100, 8500)) - if (!missing(matlab)) - lines(sii.constants[, 1], matlab, type = "l", col = "red", - lwd = 3) - lines(x = sii.constants[, 1], y = x$table[, "T'i"], col = "blue", - lwd = 2) - abline(v = sii.constants[, 1], lty = 2) - legend("topleft", legend = c("Measured data", "Matlab INTERP1(X, Y, XI, 'spline', 'extrap')", - "R's approx(X,Y, XI, xout=XI,\n method='linear', rule=2)"), - col = c("black", "red", "blue", "green", "orange", "magenta"), - pch = c(1, NA, NA, NA, NA, NA), lty = c(NA, 1, 1, 1, - 1, 1), lwd = c(NA, 3, 2, 2, 2, 2), bg = "white") - title(title) - } -} -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 } -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line Deleted: trunk/SII/man/print.SII.Rd =================================================================== --- trunk/SII/man/print.SII.Rd 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/man/print.SII.Rd 2008-06-12 05:56:39 UTC (rev 1289) @@ -1,48 +0,0 @@ -\name{print.SII} -\alias{print.SII} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{ ~~function to do ... ~~ } -\description{ - ~~ A concise (1-5 lines) description of what the function does. ~~ -} -\usage{ -print.SII(x, digits = 2, ...) -} -%- maybe also 'usage' for other objects documented here. -\arguments{ - \item{x}{ ~~Describe \code{x} here~~ } - \item{digits}{ ~~Describe \code{digits} here~~ } - \item{\dots}{ ~~Describe \code{\dots} here~~ } -} -\details{ - ~~ If necessary, more details than the description above ~~ -} -\value{ - ~Describe the value returned - If it is a LIST, use - \item{comp1 }{Description of 'comp1'} - \item{comp2 }{Description of 'comp2'} - ... -} -\references{ ~put references to the literature/web site here ~ } -\author{ ~~who you are~~ } -\note{ ~~further notes~~ - - ~Make other sections like Warning with \section{Warning }{....} ~ -} -\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ } -\examples{ -##---- Should be DIRECTLY executable !! ---- -##-- ==> Define data, use random, -##-- or do help(data=index) for the standard data sets. - -## The function is currently defined as -function (x, digits = 2, ...) -{ - print(unclass(round(x$sii, digits))) - } -} -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 } -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line Added: trunk/SII/man/sic.critical.Rd =================================================================== --- trunk/SII/man/sic.critical.Rd (rev 0) +++ trunk/SII/man/sic.critical.Rd 2008-06-12 05:56:39 UTC (rev 1289) @@ -0,0 +1,83 @@ +\name{sic.critical} +\alias{sic.critical} +\alias{sic.threeoctave} +\alias{sic.octave} +\docType{data} +\title{Alternative ANSI S3.5-1997 SII Transfer Function Weights} +\description{ + Alternative ANSI S3.5-1997 Speech Intelligibility Index (SII) transfer + function weights for for various types of speech material. +} +\usage{ +data(sic.critical) +data(sic.threeoctave) +data(sic.octave) +} +\format{ + Each data frame contains the following 8 variables, each + corresponding the the transfer function weights for a specific type of + speech material: + \describe{ + \item{\code{fi}}{Center frequency, Hz} + \item{\code{NNS}}{NNS (various nonsense syllable tessz where + most of the English phonems occur equally often)} + \item{\code{CID22}}{CID-W22 (PB-words)} + \item{\code{NU6}}{NU6 monosyllables} + \item{\code{DRT}}{DRT (Diagnostic Rhyme Test)} + \item{\code{ShortPassage}}{short passages of easy reading material} + \item{\code{SPIN}}{SPIN monosyllables} + \item{\code{CST}}{Connected Speech Test} + } +} +\details{ + \describe{ + \item{\code{sic.critical}}{provides alternative weights for the + critical band SII procedure.} + \item{\code{sic.threeoctave}}{provides alternative weights for the + one-third octave frequency band SII procedure.} + \item{\code{octave}}{provides alternative weights for the + octave frequency band SII procedure.} + } +} +\section{note}{There is no table of alternative weights for the + equally-weighted SII band procedure as the weights for this method are + (by definition) constant across all bands. + } +\source{ + All values except the \code{CST} columns are from: + + ANSI S3.5-1997, "American National Standard Methods for + Calculation of the Speech Intelligibility Index" American National + Standards Institute, New York. + + Values in the \code{CST} columns are from: + \url{http://www.sii.to/CSTdata.txt} +} +\references{ + ANSI S3.5-1997, "American National Standard Methods for + Calculation of the Speech Intelligibility Index" American National + Standards Institute, New York. +} +\examples{ +## Load the alternative weights for the critical band method +data(sic.critical) + +## display the weights +round(sic.critical,3) + +## draw a comparison plot +matplot(x=sic.critical[,1], y=sic.critical[,-1], type="o", + xlab="Frequency, Hz", ylab="Weight", + log="x") +legend( + "topright", + legend=names(sic.critical)[-1], + pch=1:ncol(sic.critical), + lty=1:ncol(sic.critical), + col=1:ncol(sic.critical) + ) + +data(threeoctave) +data(octave) +} +\keyword{datasets} Modified: trunk/SII/man/sii.Rd =================================================================== --- trunk/SII/man/sii.Rd 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/man/sii.Rd 2008-06-12 05:56:39 UTC (rev 1289) @@ -1,172 +1,207 @@ \name{sii} \alias{sii} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{ ~~function to do ... ~~ } +\alias{print.SII} +\alias{plot.SII} +\alias{summary.SII} +\title{Compute ANSI S3.5-1997 Speech Intelligibility Index (SII)} \description{ - ~~ A concise (1-5 lines) description of what the function does. ~~ + Compute the Speech Intelligibility Index (SII) described by ANSI + specification S3.5-1997, including extensions for conductive + hearing loss. } \usage{ -sii(x, freq, noise, method = c("interpolate", "critical", "one-third octave", "equal-contributing", "octave"), voice = c("raised", "normal", "loud", "shout")) +sii(speech = c("normal", "raised", "loud", "shout"), + noise, threshold, loss, freq, + method = c("interpolate", "critical", "equal-contributing", + "one-third octave", "octave"), + importance = c("SII", "NNS", "CID22", "NU6", "DRT", + "ShortPassage", "SPIN", "CST")) +\method{print}{SII}(x, digits=2, ...) +\method{plot}{SII}(x, ...) +\method{summary}{SII}(object, digits=2, ...) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{ ~~Describe \code{x} here~~ } - \item{freq}{ ~~Describe \code{freq} here~~ } - \item{noise}{ ~~Describe \code{noise} here~~ } - \item{method}{ ~~Describe \code{method} here~~ } - \item{voice}{ ~~Describe \code{voice} here~~ } + \item{speech}{Either a numeric vector providing $E'_i$, the equivalent + speech spectrum level (in dB) at each frequency, or a character + string indicating the stated vocal effort corresponding to one of + the standard standard speech spectrum levels ("normal", "raised", + "loud", "shout"). Defaults to \code{speech="normal"} correspoding to + the normal level of stated vocal effort. } + \item{noise}{A numeric vector providing $N'_i$, the equivalent + noise spectrum level (in dB) at each frequency. If missing, + defaults to -50 dB for each frequency.} + \item{threshold}{A numeric vector providing $T'_i$, the equivalent + hearing threshold level (in dB) at each frequency. If missing, + defaults to 0 dB for each frequency.} + \item{loss}{A numeric vector providing $J'_i$, the conductive hearing + loss level (in dB) at each frequency. If missing, + defaults to 0 dB for each frequency.} + \item{freq}{Vector of frequencies for which \code{speech}, + \code{noise}, \code{threshold}, and/or \code{loss} are specified. + If \code{method="interpolate"}, \code{freq} must be specified. + Otherwise, it must either match the required value for SII + calculation method given by argument \code{method}, or be missing, + in which case it will default to the values required for the + specified method.} + \item{method}{A character string specifying the SII calculation + method ("critical", "one-third octave", "equal-contributing", + "octave"), or \code{"interpolate"} in which case the critical-band + method will be applied, with interpolation from the provided + frequencies to the required 21 frequency values.} + \item{importance}{Either a numeric vector providing $F_i$, the + transfer function (importance weights) at each frequency, or a character + string indicating which transfer function to employ ("SII", "NNS", + "CID22", "NU6", "DRT", "ShortPassage", "SPIN", "CST"). Defaults to + the standard SII transfer function, \code{importance="SII"}.} + \item{object,x}{SII object} + \item{digits}{Number of digits to display} + \item{...}{Optional arguments to \code{print}, \code{summary}, and + \code{plot} methods} } \details{ - ~~ If necessary, more details than the description above ~~ + American National Standard ANSI S3.5-1997 ("Methods for Calculation of + the Speech Intelligibility Index") defines a method for computing a + physical measure that is highly correlated with the intelligibility + of speech as evaluated by speech perception tests given a group of + talkers and listeners. This measure is called the Speech + Intelligibility Index, or SII. The SII is calculated from acoustical + measurements of speech and noise. + + The \code{sii} function implements ANSI S3.5-1997 as described in + the standard, without any attempt to optimize the performance. The + implementation does, however, include the extension for handling + conductive hearing loss from Annex A (utilizing the optional + \code{loss} argument, and for utilizing alternative band weights + (i.e. transfer function) appropriate for differing message contents + (e.g. types of speech) as described in Annex B or user-specified + band weights (utilizing the optional argument \code{importance}). + + Further, this implementation provides a mechanism for + interpolating/extrapolating available measurements to those required + for calculating the critical band procedure (via the argument + \code{method="interpolate"}). Interpolation is accomplished using + linear interpolation (on log-scaled data) to the frequencies + required for the critical-band SII procedure. Interpolation is + performed (if necessary) for \code{noise}, \code{threshold}, and + \code{loss}. + } \value{ - ~Describe the value returned - If it is a LIST, use - \item{comp1 }{Description of 'comp1'} - \item{comp2 }{Description of 'comp2'} - ... + The return value is an object of class SII, containing the following + components: + \item{call}{Function call used to generate the SII object} + \item{orig}{List containing original (pre-extrapolation) values for + \code{freq}, \code{speech}, \code{noise}, \code{threshold}, and + \code{loss}.} + \item{speech, noise, threshold, loss, and freq}{Values used in + calculations (extrapolated if necessary)} + \item{table}{SII calculation worksheet, containing columns + corresponding to both Table C.1 and C.2 in Annex C of the + standard. Table columns are + \describe{ + \item{Fi}{Center frequency of SII band, Hz} + \item{E'i}{Spectrum level of equivalent speech, dB} + \item{N'i}{Spectrum level of equivalent noise, dB} + \item{T'i}{Equivalent hearing threshold level, dB} + \item{Vi}{Spectrum level for self-speech masking, dB} + \item{Bi}{Larger of the specrum levels for equivalent noise and + self-speech masking, dB} + \item{Ci}{Slope per octave (doubling of frequency) of the upward + spread of masking, dB/octave} + \item{Zi}{Spectrum level for equivalent masking, dB} + \item{Xi}{Spectrum level of internal noise, dB} + \item{X'i}{Spectrum level of equivalent internal noise, dB} + \item{Di}{Spectrum level for equivalent disturbance, dB} + \item{Ui}{Spectrum level of standard speech for normal vocal + effort, dB} + \item{Ji}{Equivalent hearing threshold due to conductive hearing + loss, dB} + \item{Li}{Speech level distortion factor, dB} + \item{Ki}{Temporary variable used in the calculation of the band + auditability function} + \item{Ai}{Band auditability function} + \item{Ii}{Band importance function} + \item{IiAi}{Product of the band importance function (Ii), and band + auditability function(Ai)} + } + } + \item{sii}{Calculated SII value} } -\references{ ~put references to the literature/web site here ~ } -\author{ ~~who you are~~ } -\note{ ~~further notes~~ +\references{ +ANSI S3.5-1997, "American National Standard Methods for +Calculation of the Speech Intelligibility Index" American National +Standards Institute, New York. - ~Make other sections like Warning with \section{Warning }{....} ~ +Other software programs for calculating SII are available from +\url{http://www.sii.to/html/programs.html}. + } -\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ } +\author{Gregory R. Warnes \email{gr...@ra...}} +\seealso{ SII Constants: \code{\link{critical}}, and + \code{\link{sic.critical}} } \examples{ -##---- Should be DIRECTLY executable !! ---- -##-- ==> Define data, use random, -##-- or do help(data=index) for the standard data sets. -## The function is currently defined as -function (x, freq, noise, method = c("interpolate", "critical", - "one-third octave", "equal-contributing", "octave"), voice = c("raised", - "normal", "loud", "shout")) -{ - if (!(is.matrix(x) || is.data.frame(x))) - x <- matrix(x, nrow = 1) - method = match.arg(method) - voice = match.arg(voice) - if (method == "interpolate") - data.name = "critical" - else data.name = method - table <- read.csv("SII_Table1.csv", skip = 3, header = TRUE, - nrows = 21, check.names = FALSE) - if (method == "interpolate") { - if (missing(freq) || length(freq) != ncol(x)) - stop("`freq' must contain the frequencies corresponding to the measurements in `x'.") - } - else { - if (missing(freq)) - freq <- table[, "fi"] - else if (freq != table[, "fi"]) - stop("`freq' does not match frequencies specified in table ", - data.name, ".") - } - if (missing(noise)) - noise <- rep(0, length(freq)) - nas <- is.na(x) - if (any(nas)) { - if (method == "interpolate") { - x <- x[!nas] - freq <- freq[!nas] - noise <- noise[!nas] - } - else stop("NA's only permitted for method 'interpolate'") - } - ord <- order(freq) - x <- x[ord] - freq <- freq[ord] - noise <- noise[ord] - retval <- list() - retval$call <- match.call() - retval$x.orig <- x - retval$freq.orig <- freq - retval$noise.orig <- noise - if (method == "interpolate") { - approx.l <- function(x, y, xout, ...) { - retval <- approx(log(x), y, log(xout), ...) - retval$x <- xout - retval - } - sii.freqs <- table[, "fi"] - THDI <- approx.l(x = freq, y = x, method = "linear", - xout = sii.freqs, rule = 2)$y - noise <- approx.l(x = freq, y = noise, method = "linear", - xout = sii.freqs, rule = 2)$y - freq <- sii.freqs - x <- THDI - } - col.names <- c("Fi", "E'i", "N'i", "T'i", "Vi", "Bi", "Ci", - "Z'i", "Xi", "X'i", "Di", "Ui", "Li", "Ki", "Ai", "Ii", - "IiAi") - sii.tab <- matrix(nrow = length(freq), ncol = length(col.names)) - colnames(sii.tab) <- col.names - rownames(sii.tab) <- 1:nrow(sii.tab) - sii.tab[, "Fi"] <- freq - sii.tab[, "E'i"] <- table[, voice] - sii.tab[, "N'i"] <- noise - sii.tab[, "T'i"] <- x - if (method == "octave") - sii.tab[, "Zi"] <- sii.tab[, "N'i"] - else { - sii.tab[, "Vi"] <- sii.tab[, "E'i"] - 24 - sii.tab[, "Bi"] <- pmax(sii.tab[, "N'i"], sii.tab[, "Vi"]) - if (method == "critical" || method == "interpolate" || - method == "equal-contributing") { - sii.tab[, "Ci"] = -80 + 0.6 * (sii.tab[, "Bi"] + - 10 * log10(table[, "fi.high"] - table[, "fi.low"])) - Zifun <- function(i) { - if (i > 1) - inner <- sum(10^(0.1 * sii.tab[1:(i - 1), "Bi"] + - 3.32 * sii.tab[1:(i - 1), "Ci"] * log10(table[i, - "Fi"]/table[1:(i - 1), "Fi.high"]))) - else inner <- 0 - 10 * log10(10^(0.1 * sii.tab[i, "N'i"]) + inner) - } - sii.tab[, "Z'i"] = sapply(1:nrow(sii.tab), Zifun) - } - else { - sii.tab[, "Ci"] = -80 + 0.6 * (sii.tab[, "Bi"] + - 10 * log10(sii.tab[, "Fi"]) - 6.353) - Zifun <- function(i) { - if (i > 1) - inner <- sum(10^(0.1 * sii.tab[1:(i - 1), "Bi"] + - 3.32 * sii.tab[1:(i - 1), "Ci"] * log10(0.89 * - table[i, "Fi"]/table[1:(i - 1), "Fi.high"]))) - else inner <- 0 - 10 * log10(10^(0.1 * sii.tab[i, "N'i"]) + inner) - } - sii.tab[, "Z'i"] = sapply(1:nrow(sii.tab), Zifun) - } - sii.tab[1, "Z'i"] <- sii.tab[1, "Bi"] - } - sii.tab[, "Xi"] <- table[, "Xi"] - sii.tab[, "X'i"] <- sii.tab[, "T'i"] + sii.tab[, "Xi"] - sii.tab[, "Di"] <- max(sii.tab[, "Z'i"], sii.tab[, "X'i"]) - sii.tab[, "Ui"] <- table[, "normal"] - enforce.range <- function(x) { - x[x < 0] <- 0 - x[x > 1] <- 1 - x - } - sii.tab[, "Li"] <- enforce.range(1 - (sii.tab[, "E'i"] - - sii.tab[, "Ui"] - 10)/160) - sii.tab[, "Ki"] <- enforce.range((sii.tab[, "E'i"] - sii.tab[, - "Di"] + 15)/30) - sii.tab[, "Ai"] <- sii.tab[, "Li"] * sii.tab[, "Ki"] - sii.tab[, "Ii"] <- table[, "Ii"] - sii.tab[, "IiAi"] <- table[, "Ii"] * sii.tab[, "Ai"] - sii.val <- sum(sii.tab[, "IiAi"]) - retval$THDN <- x - retval$freq <- freq - retval$sii <- sii.val - retval$table <- sii.tab - class(retval) <- "SII" - retval - } +## Example C.1 from ANSI S3.5-1997 Annex C +sii.C1 <- sii( + speech = c(50.0, 40.0, 40.0, 30.0, 20.0, 0.0), + noise = c(70.0, 65.0, 45.0, 25.0, 1.0,-15.0), + threshold= c( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + method="octave" + ) +sii.C1 # rounded to 2 digits by default +print(sii.C1$sii, digits=20) # full precision +summary(sii.C1) # full details +plot(sii.C1) # plot +## The value given in the Standard is $0.504$. + + + +## Same calculation, but manually specify the frequencies +## and importance function, and use default for threshold + +sii.C1 <- sii( + speech = c(50.0, 40.0, 40.0, 30.0, 20.0, 0.0), + noise = c(70.0, 65.0, 45.0, 25.0, 1.0,-15.0), + method="octave", + freq=c(250, 500, 1000, 2000, 4000, 8000), + importance=c(0.0617, 0.1671, 0.2373, 0.2648, 0.2142, 0.0549) + ) +sii.C1 + +## Now perform the calculation using frequency weights for the Connected +## Speech Test (CST) +sii.CST <- sii( + speech = c(50.0, 40.0, 40.0, 30.0, 20.0, 0.0), + noise = c(70.0, 65.0, 45.0, 25.0, 1.0,-15.0), + method="octave", + importance="CST" + ) +round(sii.CST$table[,-c(5:7,13)],2) +sii.CST$sii + +## Example C.2 from ANSI S3.5-1997 Annex C + +sii.C2 <- sii( + speech = rep(54.0, 18), + noise = c(40.0, 30.0, 20.0, rep(0, 18-3) ), + threshold= rep(0.0, 18), + method="one-third" + ) +sii.C2$table[1:3,1:8] +sii.C2 + +## Interpolation example, for 8 frequencies using NU6 importance +## weight, default values for noise. +sii.left <- sii( + speech="raised", + threshold=c(25,25,30,35,45,45,55,60), + freq=c(250, 500, 1000, 2000, 3000, 4000, 6000, 8000), + importance="NU6" + ) +sii.left + + } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 } -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line + +\keyword{math} + Deleted: trunk/SII/man/sii.excel.Rd =================================================================== --- trunk/SII/man/sii.excel.Rd 2008-06-12 00:29:28 UTC (rev 1288) +++ trunk/SII/man/sii.excel.Rd 2008-06-12 05:56:39 UTC (rev 1289) @@ -1,80 +0,0 @@ -\name{sii.excel} -\alias{sii.excel} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{ ~~function to do ... ~~ } -\description{ - ~~ A concise (1-5 lines) description of what the function does. ~~ -} -\usage{ -sii.excel(THDI = c(25, 25, 30, 35, 45, 45, 55, 60), freq = c(250, 500, 1000, 2000, 3000, 4000, 6000, 8000), matlab.spline = TRUE) -} -%- maybe also 'usage' for other objects documented here. -\arguments{ - \item{THDI}{ ~~Describe \code{THDI} here~~ } - \item{freq}{ ~~Describe \code{freq} here~~ } - \item{matlab.spline}{ ~~Describe \code{matlab.spline} here~~ } -} -\details{ - ~~ If necessary, more details than the description above ~~ -} -\value{ - ~Describe the value returned - If it is a LIST, use - \item{comp1 }{Description of 'comp1'} - \item{comp2 }{Description of 'comp2'} - ... -} -\references{ ~put references to the literature/web site here ~ } -\author{ ~~who you are~~ } -\note{ ~~further notes~~ - - ~Make other sections like Warning with \section{Warning }{....} ~ -} -\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ } -\examples{ -##---- Should be DIRECTLY executable !! ---- -##-- ==> Define data, use random, -##-- or do help(data=index) for the standard data sets. - -## The function is currently defined as -function (THDI = c(25, 25, 30, 35, 45, 45, 55, 60), freq = c(250, - 500, 1000, 2000, 3000, 4000, 6000, 8000), matlab.spline = TRUE) -{ - if (length(THDI) != length(freq)) - stop("THDI must have the same length as freq") - sii.freqs <- sii.constants[, 1] - if (matlab.spline) { - ispl <- interpSpline(THDI ~ freq) - THDI <- predict(ispl, sii.freqs)$y - } - else { - approx.l <- function(x, y, xout, ...) { - retval <- approx(log(x), y, log(xout), ...) - retval$x <- xout - retval - } - THDI <- approx.l(x = freq, y = THDI, method = "linear", - xout = sii.freqs, rule = 2)$y - } - sii.tab <- sii.constants - sii.tab[, c("Ti'.THDN", "Xi'.Int.Noise", "Di.Equiv.Dist", - "ki.Temp.Var", "Ai.BandAud", "Si.SII.band.")] <- NA - sii.tab[, "Ti'.THDN"] <- THDI - sii.tab[, "Xi'.Int.Noise"] <- sii.tab[, "Ti'.THDN"] + sii.tab[, - "Xi.Ref.Int.Nz"] - sii.tab[, "Di.Equiv.Dist"] <- sii.tab[, "Xi'.Int.Noise"] - sii.tab[, "ki.Temp.Var"] <- ifelse((sii.tab[, "Ei.Raised"] - - sii.tab[, "Di.Equiv.Dist"] + 15)/30 > 1, 1, 0) - sii.tab[, "Ai.BandAud"] <- sii.tab[, "ki.Temp.Var"] - sii.tab[, "Si.SII.band."] <- sii.tab[, "I.BandImp"] * sii.tab[, - "Ai.BandAud"] - sii.val <- sum(sii.tab[, "Si.SII.band."]) - ret <- list(THDN = THDI, freq = freq, sii = sii.val, table = sii.tab) - class(ret) <- "SII" - ret - } -} -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 } -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-12 00:29:32
|
Revision: 1288 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1288&view=rev Author: warnes Date: 2008-06-11 17:29:28 -0700 (Wed, 11 Jun 2008) Log Message: ----------- Update source code, improve documentation Modified Paths: -------------- trunk/SII/R/print.SII.R trunk/SII/R/reload.constants.R trunk/SII/R/sii.R trunk/SII/R/sii.excel.R Added Paths: ----------- trunk/SII/R/summary.SII.R Modified: trunk/SII/R/print.SII.R =================================================================== --- trunk/SII/R/print.SII.R 2008-06-12 00:28:49 UTC (rev 1287) +++ trunk/SII/R/print.SII.R 2008-06-12 00:29:28 UTC (rev 1288) @@ -1,5 +1,7 @@ `print.SII` <- function (x, digits = 2, ...) { - print(unclass(round(x$sii, digits))) + cat("\n") + cat("SII:", round(x$sii, digits), "\n") + cat("\n") } Modified: trunk/SII/R/reload.constants.R =================================================================== --- trunk/SII/R/reload.constants.R 2008-06-12 00:28:49 UTC (rev 1287) +++ trunk/SII/R/reload.constants.R 2008-06-12 00:29:28 UTC (rev 1288) @@ -1,6 +1,10 @@ reload.constants <- function(xls.path,rda.path=xls.path) { + + if(!require("gdata")) + stop("'gdata' package must be installed to run this function.") + "critical" <- read.xls( xls=file.path(xls.path,"SII_Constants.xls"), sheet=1, @@ -72,8 +76,8 @@ "sic.octave" <- read.xls( xls=file.path(xls.path,"SII_Constants.xls"), - sheet=4, - skip=5, + sheet=7, + skip=3, header=TRUE, nrows=6, check.names=FALSE, Modified: trunk/SII/R/sii.R =================================================================== --- trunk/SII/R/sii.R 2008-06-12 00:28:49 UTC (rev 1287) +++ trunk/SII/R/sii.R 2008-06-12 00:29:28 UTC (rev 1288) @@ -7,8 +7,8 @@ method=c( "interpolate", "critical", + "equal-contributing", "one-third octave", - "equal-contributing", "octave" ), importance=c( @@ -59,16 +59,23 @@ table <- get(data.name) ## Get the correct importance functions - importance=match.arg(importance) - if(importance!="SII") + if(missing(importance) || is.character(importance) ) { - sic.name <- paste("sic.",data.name, sep="") - data(list=sic.name, package="SII") - sic.table <- get(sic.name) - table[,"Ii"] <- sic.table[[importance]] + importance=match.arg(importance) + if(importance!="SII") + { + sic.name <- paste("sic.",data.name, sep="") + data(list=sic.name, package="SII") + sic.table <- get(sic.name) + table[,"Ii"] <- sic.table[[importance]] + } } + else + if(length(importance) != nrow(table)) + stop("`importance' vector have length ", nrow(table), "for method `",method,"'.") + else + table[,"Ii"] <- importance - ## Handle missing freq if(missing(freq)) @@ -355,8 +362,9 @@ retval$threshold <- threshold retval$loss <- loss retval$freq <- freq + retval$method <- method + retval$table <- sii.tab retval$sii <- sii.val - retval$table <- sii.tab class(retval) <- "SII" Modified: trunk/SII/R/sii.excel.R =================================================================== --- trunk/SII/R/sii.excel.R 2008-06-12 00:28:49 UTC (rev 1287) +++ trunk/SII/R/sii.excel.R 2008-06-12 00:29:28 UTC (rev 1288) @@ -4,6 +4,9 @@ matlab.spline=TRUE ) { + if(!require("splines")) + stop("'splines' package must be installed to run this function.") + if(length(THDI) != length(freq)) stop("THDI must have the same length as freq") Added: trunk/SII/R/summary.SII.R =================================================================== --- trunk/SII/R/summary.SII.R (rev 0) +++ trunk/SII/R/summary.SII.R 2008-06-12 00:29:28 UTC (rev 1288) @@ -0,0 +1,30 @@ +`summary.SII` <- +function (x, digits = 2, ...) +{ + cat("\n") + cat("Speech Intellibility Index\n") + cat("--------------------------\n") + cat("\n") + cat("Call:\n") + cat("\n") + print(x$call) + cat("\n") + methodStr <- switch(x$method, + "interpolate"="Interpolation + Critical Band", + "critical"="Critical band SII procedure", + "equal-contributing"="Equally-contrlbutlng (17 band) critical-band SII procedure ", + "one-third octave"="One-third octave band SII procedure", + "octave"="Octave band SII procedure" + ) + + cat("Method:", methodStr, "\n" ) + cat("\n") + cat("Calculation table:\n") + cat("\n") + print(round(x$table, digits=digits)) + cat("\n") + cat("SII:", round(x$sii, digits), "\n") + cat("\n") + invisible(x) +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-06-12 00:28:50
|
Revision: 1287 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1287&view=rev Author: warnes Date: 2008-06-11 17:28:49 -0700 (Wed, 11 Jun 2008) Log Message: ----------- Add namespace file to hide private functions Added Paths: ----------- trunk/SII/NAMESPACE Added: trunk/SII/NAMESPACE =================================================================== --- trunk/SII/NAMESPACE (rev 0) +++ trunk/SII/NAMESPACE 2008-06-12 00:28:49 UTC (rev 1287) @@ -0,0 +1,7 @@ +export( + sii + ) + +s3method(plot, SII) +s3method(print, SII) +s3method(summary, SII) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-29 23:19:04
|
Revision: 1285 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1285&view=rev Author: warnes Date: 2008-05-29 16:19:00 -0700 (Thu, 29 May 2008) Log Message: ----------- Add newVersionAvailable() function to compare running and latest available R versions Added Paths: ----------- trunk/gtools/R/newVersionAvailable.R Added: trunk/gtools/R/newVersionAvailable.R =================================================================== --- trunk/gtools/R/newVersionAvailable.R (rev 0) +++ trunk/gtools/R/newVersionAvailable.R 2008-05-29 23:19:00 UTC (rev 1285) @@ -0,0 +1,28 @@ +newVersionAvailable <- function(quiet=FALSE) + { + page <- scan(file="http://cran.r-project.org/src/base/R-2", what="", quiet=TRUE) + matches <- grep("R-[0-9]\\.[0-9]+\\.[0-9]+", page, value=TRUE) + versionList <- gsub("^.*R-([0-9].[0-9]+.[0-9]+).*$","\\1",matches) + versionList <- numeric_version(versionList) + if( max(versionList) > getRversion() ) + { + if(!quiet) + { + cat("A newer version of R is now available: ") + cat(max(versionList)) + cat("\n") + } + invisible( max(versionList) ) + } + else + { + if(!quiet) + { + cat("The latest version of R is installed: ") + cat(as.character(getRversion())) + cat("\n") + } + invisible( NULL ); + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-26 19:15:47
|
Revision: 1284 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1284&view=rev Author: warnes Date: 2008-05-26 12:15:46 -0700 (Mon, 26 May 2008) Log Message: ----------- Update license specification Modified Paths: -------------- trunk/gtools/DESCRIPTION Modified: trunk/gtools/DESCRIPTION =================================================================== --- trunk/gtools/DESCRIPTION 2008-05-26 15:04:27 UTC (rev 1283) +++ trunk/gtools/DESCRIPTION 2008-05-26 19:15:46 UTC (rev 1284) @@ -6,4 +6,4 @@ Author: Gregory R. Warnes. Includes R source code and/or documentation contributed by Ben Bolker and Thomas Lumley Maintainer: Gregory R. Warnes <wa...@bs...> -License: LGPL 2.1 +License: LGPL-2.1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-26 15:04:33
|
Revision: 1283 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1283&view=rev Author: warnes Date: 2008-05-26 08:04:27 -0700 (Mon, 26 May 2008) Log Message: ----------- Remove 'assert' man page Removed Paths: ------------- trunk/gtools/man/assert-deprecated.Rd Deleted: trunk/gtools/man/assert-deprecated.Rd =================================================================== --- trunk/gtools/man/assert-deprecated.Rd 2008-05-22 16:40:12 UTC (rev 1282) +++ trunk/gtools/man/assert-deprecated.Rd 2008-05-26 15:04:27 UTC (rev 1283) @@ -1,49 +0,0 @@ -\name{assert-deprecated} -\alias{assert-deprecated} -\alias{assert} -\title{DEPRECATED: Generate an error if an expression is not true.} -\description{ - Generate an error if an expression is not true. -} -\note{ - This function is deprecated in favor of \code{\link[base]{stopifnot}} -} -\usage{ -assert(FLAG) -} -\arguments{ - \item{FLAG}{ Expression that should evaluate to a boolean vector} -} -\details{ - Assert generate an error if its aregument does not evaluate to - boolean (vector) containing only \code{TRUE} values. This is useful - for defensinve programming as it provides a mechanism for checking - that certain facts, the 'assertions', do in fact hold. Checking of - 'assertions' is an important tool in the development of robust program - code. -} -\value{ - None. Evaluated only for its side effect. -} -\author{Gregory R. Warnes \email{wa...@bs...} } -\seealso{ - \code{\link[base]{stopifnot}}, \code{\link[base]{stop}}, - \code{\link[base]{warning}} -} -\examples{ - -## Trivial example -posSqrt <- function(x) - { - assert(x>=0) - sqrt(x) - } - -posSqrt(1:10) # works fine, no messages -\dontrun{ -posSqrt(-5:5) # generates an error, since the asssertion is not met -} - - -} -\keyword{programming} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-22 16:40:14
|
Revision: 1282 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1282&view=rev Author: warnes Date: 2008-05-22 09:40:12 -0700 (Thu, 22 May 2008) Log Message: ----------- Finish rename of assert.R to assert-depricated.Rd Removed Paths: ------------- trunk/gtools/man/assert.R Deleted: trunk/gtools/man/assert.R =================================================================== --- trunk/gtools/man/assert.R 2008-05-22 16:35:17 UTC (rev 1281) +++ trunk/gtools/man/assert.R 2008-05-22 16:40:12 UTC (rev 1282) @@ -1,49 +0,0 @@ -\name{assert-deprecated} -\alias{assert-deprecated} -\alias{assert} -\title{DEPRECATED: Generate an error if an expression is not true.} -\description{ - Generate an error if an expression is not true. -} -\note{ - This function is deprecated in favor of \code{\link[base]{stopifnot}} -} -\usage{ -assert(FLAG) -} -\arguments{ - \item{FLAG}{ Expression that should evaluate to a boolean vector} -} -\details{ - Assert generate an error if its aregument does not evaluate to - boolean (vector) containing only \code{TRUE} values. This is useful - for defensinve programming as it provides a mechanism for checking - that certain facts, the 'assertions', do in fact hold. Checking of - 'assertions' is an important tool in the development of robust program - code. -} -\value{ - None. Evaluated only for its side effect. -} -\author{Gregory R. Warnes \email{wa...@bs...} } -\seealso{ - \code{\link[base]{stopifnot}}, \code{\link[base]{stop}}, - \code{\link[base]{warning}} -} -\examples{ - -## Trivial example -posSqrt <- function(x) - { - assert(x>=0) - sqrt(x) - } - -posSqrt(1:10) # works fine, no messages -\dontrun{ -posSqrt(-5:5) # generates an error, since the asssertion is not met -} - - -} -\keyword{programming} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-22 16:35:20
|
Revision: 1281 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1281&view=rev Author: warnes Date: 2008-05-22 09:35:17 -0700 (Thu, 22 May 2008) Log Message: ----------- Add checkRVersion.R file Added Paths: ----------- trunk/gtools/R/checkRVersion.R Added: trunk/gtools/R/checkRVersion.R =================================================================== --- trunk/gtools/R/checkRVersion.R (rev 0) +++ trunk/gtools/R/checkRVersion.R 2008-05-22 16:35:17 UTC (rev 1281) @@ -0,0 +1,28 @@ +checkRVersion <- function(quiet=FALSE) + { + page <- scan(file="http://cran.r-project.org/src/base/R-2", what="", quiet=TRUE) + matches <- grep("R-[0-9]\\.[0-9]+\\.[0-9]+", page, value=TRUE) + versionList <- gsub("^.*R-([0-9].[0-9]+.[0-9]+).*$","\\1",matches) + versionList <- numeric_version(versionList) + if( max(versionList) > getRversion() ) + { + if(!quiet) + { + cat("A newer version of R is now available: ") + cat(max(versionList)) + cat("\n") + } + invisible( max(versionList) ) + } + else + { + if(!quiet) + { + cat("The latest version of R is installed: ") + cat(as.character(getRversion())) + cat("\n") + } + invisible( NULL ); + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-22 16:34:36
|
Revision: 1280 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1280&view=rev Author: warnes Date: 2008-05-22 09:34:35 -0700 (Thu, 22 May 2008) Log Message: ----------- Rename again to get correct extension! Added Paths: ----------- trunk/gtools/man/assert-deprecated.Rd Copied: trunk/gtools/man/assert-deprecated.Rd (from rev 1277, trunk/gtools/man/assert.R) =================================================================== --- trunk/gtools/man/assert-deprecated.Rd (rev 0) +++ trunk/gtools/man/assert-deprecated.Rd 2008-05-22 16:34:35 UTC (rev 1280) @@ -0,0 +1,49 @@ +\name{assert-deprecated} +\alias{assert-deprecated} +\alias{assert} +\title{DEPRECATED: Generate an error if an expression is not true.} +\description{ + Generate an error if an expression is not true. +} +\note{ + This function is deprecated in favor of \code{\link[base]{stopifnot}} +} +\usage{ +assert(FLAG) +} +\arguments{ + \item{FLAG}{ Expression that should evaluate to a boolean vector} +} +\details{ + Assert generate an error if its aregument does not evaluate to + boolean (vector) containing only \code{TRUE} values. This is useful + for defensinve programming as it provides a mechanism for checking + that certain facts, the 'assertions', do in fact hold. Checking of + 'assertions' is an important tool in the development of robust program + code. +} +\value{ + None. Evaluated only for its side effect. +} +\author{Gregory R. Warnes \email{wa...@bs...} } +\seealso{ + \code{\link[base]{stopifnot}}, \code{\link[base]{stop}}, + \code{\link[base]{warning}} +} +\examples{ + +## Trivial example +posSqrt <- function(x) + { + assert(x>=0) + sqrt(x) + } + +posSqrt(1:10) # works fine, no messages +\dontrun{ +posSqrt(-5:5) # generates an error, since the asssertion is not met +} + + +} +\keyword{programming} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-22 16:30:08
|
Revision: 1279 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1279&view=rev Author: warnes Date: 2008-05-22 09:30:01 -0700 (Thu, 22 May 2008) Log Message: ----------- Update NEWS for 2.5.0 Modified Paths: -------------- trunk/gtools/NEWS Modified: trunk/gtools/NEWS =================================================================== --- trunk/gtools/NEWS 2008-05-22 16:17:22 UTC (rev 1278) +++ trunk/gtools/NEWS 2008-05-22 16:30:01 UTC (rev 1279) @@ -1,16 +1,32 @@ -gtools SVN VERSION $Id$ ------------------------ +gtools 2.5.0 +------------ -- Modify odd() and even() to use modulus operator instead of division. - (Doesn't seem to change the results, but looks more elegant!) +New features: +- Add checkRVersion() function to determin if a newer version of R is + available. + +- Deprecated assert() in favor of base::stopifnot + +Bug fixes: + +- Fix bug in binsearch() identified by 2.6.0 R CMD CHECK + +Other changes: + +- Improve text explanation of how defmacro() and strmacro() differ from + function(). + +- Update definitions of odd() and even() to use modulus operator + instead of division. + gtools 2.4.0 ------------ - Add binsearch() function, previously in the genetics() package. -gtoosl 2.3.1 +gtools 2.3.1 ------------ - Add ask() function to prompt the user and collect a single response. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-22 16:22:58
|
Revision: 1276 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1276&view=rev Author: warnes Date: 2008-05-22 09:15:21 -0700 (Thu, 22 May 2008) Log Message: ----------- Add checkRVersion to NAMESPACE, and increment version in DESCRIPTION. Modified Paths: -------------- trunk/gtools/DESCRIPTION trunk/gtools/NAMESPACE Modified: trunk/gtools/DESCRIPTION =================================================================== --- trunk/gtools/DESCRIPTION 2008-05-22 16:14:17 UTC (rev 1275) +++ trunk/gtools/DESCRIPTION 2008-05-22 16:15:21 UTC (rev 1276) @@ -1,7 +1,8 @@ Package: gtools Title: Various R programming tools Description: Various R programming tools -Version: 2.4.0 +Version: 2.5.0 +Date: 2008-05-22 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/NAMESPACE =================================================================== --- trunk/gtools/NAMESPACE 2008-05-22 16:14:17 UTC (rev 1275) +++ trunk/gtools/NAMESPACE 2008-05-22 16:15:21 UTC (rev 1276) @@ -6,6 +6,7 @@ assert, binsearch, capture, + checkRVersion, combinations, ddirichlet, defmacro, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-22 16:17:26
|
Revision: 1278 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1278&view=rev Author: warnes Date: 2008-05-22 09:17:22 -0700 (Thu, 22 May 2008) Log Message: ----------- Add man page for checkRVersion Added Paths: ----------- trunk/gtools/man/checkRVersion.Rd Added: trunk/gtools/man/checkRVersion.Rd =================================================================== --- trunk/gtools/man/checkRVersion.Rd (rev 0) +++ trunk/gtools/man/checkRVersion.Rd 2008-05-22 16:17:22 UTC (rev 1278) @@ -0,0 +1,44 @@ +\name{checkRVersion} +\alias{checkRVersion} +\title{Check if a newer version of R is available} +\description{ + Check if a newer version of R is available +} +\usage{ +checkRVersion(quiet = FALSE) +} +\arguments{ + \item{quiet}{Logical indicating whether printed output should be supressed.} +} +\details{ + This function accesses the R web site to discover the latest released + version of R. It then compares this version to the running version. + If the running version is the same as the latest version, it prints + the message, "The latest version of R is installed:" followed by the + version number, and returns NULL. If the running version is older + than the current version, it displays the message, "A newer version of + R is now available:" followed by the corresponding version number, and + returns the version number. + + If \code{quiet=TRUE}, no printing is performed. + +} +\value{ + Either the version number of the latest version of R, if the running + version is less than the latest version, or NULL. +} +\author{Gregory R. Warnes \email{gre...@ro...>}} +\note{ + This function utilizes the internet to access the R project web + site. If internet access is unavailable, the function will fail. +} +\seealso{ \code{\link[base]{R.Version}} } +\examples{ + +checkRVersion() + +ver <- checkRVersion() +print(ver) + +} +\keyword{utilities} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-22 16:17:00
|
Revision: 1277 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1277&view=rev Author: warnes Date: 2008-05-22 09:16:56 -0700 (Thu, 22 May 2008) Log Message: ----------- Rename assert-deprecated.R to assert.R to meet R file name requirements. Added Paths: ----------- trunk/gtools/man/assert.R Removed Paths: ------------- trunk/gtools/man/assert-deprecated.R Deleted: trunk/gtools/man/assert-deprecated.R =================================================================== --- trunk/gtools/man/assert-deprecated.R 2008-05-22 16:15:21 UTC (rev 1276) +++ trunk/gtools/man/assert-deprecated.R 2008-05-22 16:16:56 UTC (rev 1277) @@ -1,49 +0,0 @@ -\name{assert-deprecated} -\alias{assert-deprecated} -\alias{assert} -\title{DEPRECATED: Generate an error if an expression is not true.} -\description{ - Generate an error if an expression is not true. -} -\note{ - This function is deprecated in favor of \code{\link[base]{stopifnot}} -} -\usage{ -assert(FLAG) -} -\arguments{ - \item{FLAG}{ Expression that should evaluate to a boolean vector} -} -\details{ - Assert generate an error if its aregument does not evaluate to - boolean (vector) containing only \code{TRUE} values. This is useful - for defensinve programming as it provides a mechanism for checking - that certain facts, the 'assertions', do in fact hold. Checking of - 'assertions' is an important tool in the development of robust program - code. -} -\value{ - None. Evaluated only for its side effect. -} -\author{Gregory R. Warnes \email{wa...@bs...} } -\seealso{ - \code{\link[base]{stopifnot}}, \code{\link[base]{stop}}, - \code{\link[base]{warning}} -} -\examples{ - -## Trivial example -posSqrt <- function(x) - { - assert(x>=0) - sqrt(x) - } - -posSqrt(1:10) # works fine, no messages -\dontrun{ -posSqrt(-5:5) # generates an error, since the asssertion is not met -} - - -} -\keyword{programming} Copied: trunk/gtools/man/assert.R (from rev 1258, trunk/gtools/man/assert-deprecated.R) =================================================================== --- trunk/gtools/man/assert.R (rev 0) +++ trunk/gtools/man/assert.R 2008-05-22 16:16:56 UTC (rev 1277) @@ -0,0 +1,49 @@ +\name{assert-deprecated} +\alias{assert-deprecated} +\alias{assert} +\title{DEPRECATED: Generate an error if an expression is not true.} +\description{ + Generate an error if an expression is not true. +} +\note{ + This function is deprecated in favor of \code{\link[base]{stopifnot}} +} +\usage{ +assert(FLAG) +} +\arguments{ + \item{FLAG}{ Expression that should evaluate to a boolean vector} +} +\details{ + Assert generate an error if its aregument does not evaluate to + boolean (vector) containing only \code{TRUE} values. This is useful + for defensinve programming as it provides a mechanism for checking + that certain facts, the 'assertions', do in fact hold. Checking of + 'assertions' is an important tool in the development of robust program + code. +} +\value{ + None. Evaluated only for its side effect. +} +\author{Gregory R. Warnes \email{wa...@bs...} } +\seealso{ + \code{\link[base]{stopifnot}}, \code{\link[base]{stop}}, + \code{\link[base]{warning}} +} +\examples{ + +## Trivial example +posSqrt <- function(x) + { + assert(x>=0) + sqrt(x) + } + +posSqrt(1:10) # works fine, no messages +\dontrun{ +posSqrt(-5:5) # generates an error, since the asssertion is not met +} + + +} +\keyword{programming} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-22 16:14:19
|
Revision: 1275 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1275&view=rev Author: warnes Date: 2008-05-22 09:14:17 -0700 (Thu, 22 May 2008) Log Message: ----------- Remove broken SEE LSO reference Modified Paths: -------------- trunk/gtools/man/gtools-deprecated.Rd Modified: trunk/gtools/man/gtools-deprecated.Rd =================================================================== --- trunk/gtools/man/gtools-deprecated.Rd 2008-05-20 01:13:18 UTC (rev 1274) +++ trunk/gtools/man/gtools-deprecated.Rd 2008-05-22 16:14:17 UTC (rev 1275) @@ -19,6 +19,6 @@ \code{assert} is a deprecated synonym for \code{\link[base]{stopifnot}}. } \seealso{ - \code{\link{Deprecated}}, \code{\link{gtools-defunct}} + \code{\link{Deprecated}} } } \keyword{misc} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-20 01:13:23
|
Revision: 1274 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1274&view=rev Author: warnes Date: 2008-05-19 18:13:18 -0700 (Mon, 19 May 2008) Log Message: ----------- Update man page to match recent changes to plot.lm2() Modified Paths: -------------- trunk/gplots/DESCRIPTION trunk/gplots/man/plot.lm2.Rd Modified: trunk/gplots/DESCRIPTION =================================================================== --- trunk/gplots/DESCRIPTION 2008-05-20 01:08:55 UTC (rev 1273) +++ trunk/gplots/DESCRIPTION 2008-05-20 01:13:18 UTC (rev 1274) @@ -1,9 +1,9 @@ Package: gplots Title: Various R programming tools for plotting data Description: Various R programming tools for plotting data -Depends: R (>= 1.9.0), gtools, gdata, stats, caTools +Depends: R (>= 1.9.0), gtools, gdata, stats, caTools, grid Recommends: datasets, grid -Suggests: gtools, grid +Suggests: gtools Version: 2.7.0 Author: Gregory R. Warnes. Includes R source code and/or documentation contributed by (in alphabetical order): Modified: trunk/gplots/man/plot.lm2.Rd =================================================================== --- trunk/gplots/man/plot.lm2.Rd 2008-05-20 01:08:55 UTC (rev 1273) +++ trunk/gplots/man/plot.lm2.Rd 2008-05-20 01:13:18 UTC (rev 1274) @@ -7,14 +7,25 @@ Plots to assess the goodness of fit for the linear model objects } \usage{ - plot.lm2(x, which = 1:5, caption = c("Residuals vs Fitted", - "Normal Q-Q plot", "Scale-Location plot", - "Cook's distance plot"), panel = panel.smooth, - sub.caption = deparse(x$call), main = "", - ask = interactive() && nb.fig < length(which) - && .Device != "postscript", ..., id.n = 3, - labels.id = names(residuals(x)), - cex.id = 0.75, band = TRUE, rug = TRUE) + plot.lm2( + x, + which = 1:5, + caption = c("Residuals vs Fitted", "Normal Q-Q plot", + "Scale-Location plot", "Cook's distance plot"), + panel = panel.smooth, + sub.caption = deparse(x$call), + main = "", + ask = interactive() && nb.fig < length(which) + && .Device != "postscript", + ..., + id.n = 3, + labels.id = names(residuals(x)), + cex.id = 0.75, + band=TRUE, + rug=TRUE, + width=1/10, + max.n=5000 + ) } \arguments{ \item{x}{lm object} @@ -39,16 +50,22 @@ \item{band}{logical vector indicating whether bandplot should also be plotted } \item{rug}{logical vector indicating whether rug should be added to the existing plot } + \item{width}{Fraction of the data to use for plot smooths} + \item{max.n}{Maximum number of points to display in plots} } \author{Gregory R. Warnes \email{wa...@bs...} and Nitin Jain \email{nit...@pf...}} \examples{ - ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) - trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) - group <- gl(2,10,20, labels=c("Ctl","Trt")) - weight <- c(ctl, trt) - x <- lm(weight ~ group) - plot.lm2(x, which=1) -plot.lm2(x, which=1:3) +ctl <- rnorm(100, 4) +trt <- rnorm(100, 4.5) +group <- gl(2,100,200, labels=c("Ctl","Trt")) +weight <- c(ctl, trt) +wt.err <- rnorm(length(weight), mean=weight, sd=1/2) +x <- lm(weight ~ group + wt.err) + +plot.lm2(x) + +plot.lm2(x, which=1, width=1/3) +plot.lm2(x, which=1:3, widht=1/3) } \keyword{hplot} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-20 01:08:59
|
Revision: 1273 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1273&view=rev Author: warnes Date: 2008-05-19 18:08:55 -0700 (Mon, 19 May 2008) Log Message: ----------- More work on documentation for venn() Modified Paths: -------------- trunk/gplots/man/venn.Rd Modified: trunk/gplots/man/venn.Rd =================================================================== --- trunk/gplots/man/venn.Rd 2008-05-20 01:07:28 UTC (rev 1272) +++ trunk/gplots/man/venn.Rd 2008-05-20 01:08:55 UTC (rev 1273) @@ -5,15 +5,19 @@ Plot Venn diagrams for up to 5 sets } \usage{ -venn(data, small = 0.7, showSetLogicLabel = FALSE, simplify = FALSE) +venn(data, universe=NA, small=0.7, showSetLogicLabel=FALSE, + simplify=FALSE, show.plot=TRUE) } \arguments{ \item{data}{data to be plotted (see below)} + \item{universe}{??} \item{small}{Character size of group labels} \item{showSetLogicLabel}{Logical flag indicating whether the internal group label should be displayed} \item{simplify}{Logical flag indicating whether unobserved group should be omitted.} + \item{show.plot}{Logical flag indicating whether the plot should be + displayed. If false, simply returns the group count matrix.} } \details{ \code{data} should be either a named list of vectors containing @@ -27,7 +31,7 @@ The fist column contains observed counts, subsequent columns contain 0-1 indicators of group membership. } -\author{Steffen Moeller \email{ste...@gm...}, +\author{Steffen Moeller \email{steffen\_mo...@gm...}, with cleanup and packaging by Gregory R. Warnes \email{gr...@ra...}.} \examples{ @@ -57,7 +61,7 @@ ## Omit un-observed groupings -tmp <- venn(input, simplify=T) +tmp <- venn(input, simplify=TRUE) ## show details tmp @@ -65,14 +69,7 @@ ## Show internal binary group labels venn(input, showSetLogicLabel=TRUE) -## Omit un-observed groupings, and show internal binary group labels -venn(input, simplify=T, showSetLogicLabel=TRUE) - - - - +## Specify universe +venn(input, universe=NULL, showSetLogicLabel=TRUE) } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 } -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line +\keyword{hplot} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-20 01:07:33
|
Revision: 1272 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1272&view=rev Author: warnes Date: 2008-05-19 18:07:28 -0700 (Mon, 19 May 2008) Log Message: ----------- Fix code/doc mismatch due to recent changes to bandplot() Modified Paths: -------------- trunk/gplots/R/bandplot.R trunk/gplots/man/bandplot.Rd Modified: trunk/gplots/R/bandplot.R =================================================================== --- trunk/gplots/R/bandplot.R 2008-05-20 00:14:51 UTC (rev 1271) +++ trunk/gplots/R/bandplot.R 2008-05-20 01:07:28 UTC (rev 1272) @@ -9,7 +9,6 @@ sd.lwd=c(2,2,3,2,2), sd.lty=c(2,1,1,1,2), method="frac", width=1/5, - use.runsd=TRUE, n=50 ) { Modified: trunk/gplots/man/bandplot.Rd =================================================================== --- trunk/gplots/man/bandplot.Rd 2008-05-20 00:14:51 UTC (rev 1271) +++ trunk/gplots/man/bandplot.Rd 2008-05-20 01:07:28 UTC (rev 1272) @@ -28,8 +28,8 @@ } \usage{ bandplot(x, y, ..., add = FALSE, sd = c(-2:2), - sd.col = c("lightblue", "blue", "red", "blue", "lightblue"), - sd.lwd = c(1, 2, 3, 2, 1), sd.lty = c(2, 1, 1, 1, 2), + sd.col=c("magenta", "blue", "red", "blue", "magenta"), + sd.lwd=c(2, 2, 3, 2, 2), sd.lty=c(2, 1, 1, 1, 2), method = "frac", width = 1/5, n=50) } \arguments{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |