diff options
author | ranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc> | 2006-03-06 09:59:51 +0000 |
---|---|---|
committer | ranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc> | 2006-03-06 09:59:51 +0000 |
commit | c73795e7ce30c88b68339d9d978b34bf4a0cb2bc (patch) | |
tree | 2d48337231629b906fbdd48d0f5e8c42158c5c45 | |
parent | 424d3633234125cf2c8f65fd220fb92ddc0d2686 (diff) |
Added the drfit-package help page, a new sample data file
and a preliminary version of the drfit-Rnews article.
R/drfit.R
- the possibility to directly write pdf graphs was added
- the results dataframe now has numbered lines where it didn't
The checkplate and checksubstance functions are now classified
internal in their help files.
git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/drfit@57 d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc
-rw-r--r-- | DESCRIPTION | 4 | ||||
-rw-r--r-- | R/drfit.R | 31 | ||||
-rw-r--r-- | data/XY.rda | bin | 0 -> 1602 bytes | |||
-rw-r--r-- | inst/doc/drfit-Rnews.pdf | bin | 0 -> 138018 bytes | |||
-rw-r--r-- | inst/doc/index.html | 15 | ||||
-rw-r--r-- | man/XY.Rd | 16 | ||||
-rw-r--r-- | man/checkplate.Rd | 1 | ||||
-rw-r--r-- | man/checksubstance.Rd | 1 | ||||
-rw-r--r-- | man/drfit-package.Rd | 29 | ||||
-rw-r--r-- | man/drfit.Rd | 74 | ||||
-rw-r--r-- | man/drplot.Rd | 11 |
11 files changed, 133 insertions, 49 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index f1277e1..11639f2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: drfit -Version: 0.04-56 -Date: 2006-02-27 +Version: 0.04-57 +Date: 2006-03-04 Title: Dose-response data evaluation Author: Johannes Ranke <jranke@uni-bremen.de> Maintainer: Johannes Ranke <jranke@uni-bremen.de> @@ -48,8 +48,8 @@ drfit <- function(data, startlogED50 = NA, chooseone=TRUE, linlogit = FALSE, linlogitWrong = NA, allWrong = NA, s0 = 0.5, b0 = 2, f0 = 0) { - if(!is.null(data$ok)) data <- subset(data,ok!="no fit") # Don't use data where ok - # was set to "no fit" + if(!is.null(data$ok)) data <- subset(data,ok!="no fit") # Don't use data with + # ok set to "no fit" substances <- levels(data$substance) ri <- rix <- 0 # ri is the index over the result rows @@ -57,7 +57,8 @@ drfit <- function(data, startlogED50 = NA, chooseone=TRUE, # model result was appended rsubstance <- array() # the substance names in the results rndl <- vector() # number of dose levels - rn <- vector() # mean number of replicates in each dose level + rn <- vector() # mean number of replicates + # in each dose level runit <- vector() # vector of units for each result row rlhd <- rlld <- vector() # highest and lowest doses tested mtype <- array() # the modeltypes @@ -292,13 +293,15 @@ drfit <- function(data, startlogED50 = NA, chooseone=TRUE, if (linlogit) { results$c <- c } + rownames(results) <- 1:ri return(results) } drplot <- function(drresults, data, dtype = "std", alpha = 0.95, ctype = "none", path = "./", fileprefix = "drplot", overlay = FALSE, - postscript = FALSE, png = FALSE, bw = TRUE, + postscript = FALSE, png = FALSE, pdf = FALSE, + bw = TRUE, pointsize = 12, colors = 1:8, devoff=T, lpos="topright") { @@ -353,13 +356,19 @@ drplot <- function(drresults, data, paper="special",width=7,height=7,horizontal=FALSE, pointsize=pointsize) cat("Created File: ",filename,"\n") } + if (pdf) { + filename = paste(path,fileprefix,".pdf",sep="") + pdf(file=filename, + paper="special",width=7,height=7,horizontal=FALSE, pointsize=pointsize) + cat("Created File: ",filename,"\n") + } if (png) { filename = paste(path,fileprefix,".png",sep="") png(filename=filename, width=500, height=500, pointsize=pointsize) cat("Created File: ",filename,"\n") } - if (!postscript && !png) { + if (!postscript && !png && !pdf) { get(getOption("device"))(width=7,height=7) } @@ -391,13 +400,19 @@ drplot <- function(drresults, data, paper="special",width=7,height=7,horizontal=FALSE,pointsize=pointsize) cat("Created File: ",filename,"\n") } + if (pdf) { + filename = paste(path,fileprefix,sub(" ","_",i),".pdf",sep="") + pdf(file=filename, + paper="special",width=7,height=7,horizontal=FALSE,pointsize=pointsize) + cat("Created File: ",filename,"\n") + } if (png) { filename = paste(path,fileprefix,sub(" ","_",i),".png",sep="") png(filename=filename, width=500, height=500, pointsize=pointsize) cat("Created File: ",filename,"\n") } - if (!postscript && !png) { + if (!postscript && !png && !pdf) { get(getOption("device"))(width=7,height=7) } @@ -484,14 +499,14 @@ drplot <- function(drresults, data, } } } - if (!overlay && (postscript || png)) dev.off() + if (!overlay && (postscript || png || pdf)) dev.off() } else { cat("No data for ",i,"\n") } } } if (overlay) legend(lpos, dsubstances,lty = 1, col = colors, inset=0.05) - if (overlay && (postscript || png)) { + if (overlay && (postscript || png || pdf)) { if (devoff) { dev.off() } diff --git a/data/XY.rda b/data/XY.rda Binary files differnew file mode 100644 index 0000000..158285a --- /dev/null +++ b/data/XY.rda diff --git a/inst/doc/drfit-Rnews.pdf b/inst/doc/drfit-Rnews.pdf Binary files differnew file mode 100644 index 0000000..6abbcaf --- /dev/null +++ b/inst/doc/drfit-Rnews.pdf diff --git a/inst/doc/index.html b/inst/doc/index.html new file mode 100644 index 0000000..efdd9bd --- /dev/null +++ b/inst/doc/index.html @@ -0,0 +1,15 @@ +<html> +<head> + <title>R: drfit User Guide</title> + <link rel="stylesheet" type="text/css" href="../../R.css"> +</head> +<body> + +<h2>User Guide for package drfit</h2> +<dl> + <dt><a href="drfit-Rnews.pdf">drfit-Rnews.pdf</a>:</dt> + <dd> Introductory article on drfit</dd> +</dl> + +</body> +</html> diff --git a/man/XY.Rd b/man/XY.Rd new file mode 100644 index 0000000..ae28e99 --- /dev/null +++ b/man/XY.Rd @@ -0,0 +1,16 @@ +\name{XY} +\docType{data} +\alias{XY} +\title{Dose-Response data for two substances X and Y} +\description{ + This is just a sample data set for two substances named X and Y. +} +\usage{data(antifoul)} +\format{ + A dataframe containing dose (concentration) and response data, as well as + control values where the dose is zero. +} +\source{ + \url{http://www.uft.uni-bremen.de/chemie} +} +\keyword{datasets} diff --git a/man/checkplate.Rd b/man/checkplate.Rd index 39eea85..794b3f6 100644 --- a/man/checkplate.Rd +++ b/man/checkplate.Rd @@ -30,3 +30,4 @@ \url{http://www.uft.uni-bremen.de/chemie/ranke} } \keyword{database} +\keyword{internal} diff --git a/man/checksubstance.Rd b/man/checksubstance.Rd index 3871a87..59759e8 100644 --- a/man/checksubstance.Rd +++ b/man/checksubstance.Rd @@ -43,3 +43,4 @@ \url{http://www.uft.uni-bremen.de/chemie/ranke} } \keyword{database} +\keyword{internal} diff --git a/man/drfit-package.Rd b/man/drfit-package.Rd new file mode 100644 index 0000000..ac91a35 --- /dev/null +++ b/man/drfit-package.Rd @@ -0,0 +1,29 @@ +\name{drfit-package} +\alias{drfit-package} +\docType{package} +\title{ +Dose-response data evaluation +} +\description{ +See \url{../DESCRIPTION} +} +\details{ +There is an introductory article located in \url{../doc/drfit-Rnews.pdf}. +} +\author{ +Author and Maintainer: Johannes Ranke <jranke@uni-bremen.de> +} +\keyword{ package } +\keyword{ models } +\keyword{ regression } +\keyword{ nonlinear } +\seealso{ +There is another, more sophisticated package with similar functionality +called \code{\link[drc:drc-package]{drc} +} +\examples{ +data(antifoul) +r <- drfit(antifoul) +format(r,digits=2) +\dontrun{drplot(r,antifoul,overlay=TRUE,bw=FALSE)} +} diff --git a/man/drfit.Rd b/man/drfit.Rd index bbe7496..6e9ef47 100644 --- a/man/drfit.Rd +++ b/man/drfit.Rd @@ -12,17 +12,17 @@ } \arguments{ \item{data}{ - A data frame containing dose-response data. The data frame has to - contain at least a factor called "substance", a numeric vector "dose" with - the dose values, a vector called "unit" containing the unit used for the - dose and a numeric vector "response" with the response values of the test system - normalized between 0 and 1. Such a data frame can be easily obtained if a - compliant RODBC data source is available for use in conjunction with the - function \code{\link{drdata}}. + A data frame containing dose-response data. The data frame has to contain + at least a factor called \dQuote{substance}, a numeric vector \dQuote{dose} + with the dose values, a vector called \dQuote{unit} containing the unit + used for the dose and a numeric vector \dQuote{response} with the response + values of the test system normalized between 0 and 1. Such a data frame can + be easily obtained if a compliant RODBC data source is available for use in + conjunction with the function \code{\link{drdata}}. - If there is a column called "ok" and it is set to "no fit" in a specific - line, then the corresponding data point will be excluded from the fitting - procedure, although it will be plotted. + If there is a column called \dQuote{ok} and it is set to \dQuote{no fit} in + a specific line, then the corresponding data point will be excluded from + the fitting procedure, although it will be plotted. } \item{startlogED50}{ Especially for the linlogit model, a suitable log10 of the ED50 has to be given @@ -64,32 +64,34 @@ } \value{ \item{results}{ - A data frame containing at least one line for each substance. If the data - did not show a mean response < 0.5 at the highest dose level, the - modeltype is set to "inactive". If the mean response at the lowest dose - is smaller than 0.5, the modeltype is set to "active". In both cases, - no fitting procedure is carried out. - Every successful fit is reported in one line. Parameters of the fitted - curves are only reported if the fitted ED50 is not higher than the - highest dose. - \code{ndl} is the number of dose levels in the raw data, \code{n} is the - rounded mean of the number of replicates at each dose level in the raw - data, \code{lld} is the decadic logarithm of the lowest dose and - \code{lhd} is the decadic logarithm of the highest dose. - For the "linlogit", "logit" and "probit" models, the parameter - \code{a} that is reported coincides with the logED50, i.e the logED50 is - one of the model parameters that is being fitted, and therefore - a standard deviation \code{std} is reported for the logED50. In the - case of the "weibull" model, \code{a} is a location parameter. - Parameter \code{b} in the case of the "linlogit" fit is the variable - b from the \code{\link{linlogitf}} function. In the case of "probit" fit - it is the standard deviation of the fitted normal distribution, in the case - of the "logit" fit it is the \code{scale} parameter in the \code{\link{plogis}} - function, and in the "weibull" fit it is the \code{shape} parameter of the - fitted \code{\link{pweibull}} function. Only the "linlogit" fit produces a - third parameter \code{c} which is the variable f from the - \code{\link{linlogitf}} function.} - } + A data frame containing at least one line for each substance. If the data + did not show a mean response < 0.5 at the highest dose level, the + modeltype is set to \dQuote(inactive). If the mean response at the lowest + dose is smaller than 0.5, the modeltype is set to \dQuote(active). In + both cases, no fitting procedure is carried out. Every successful fit is + reported in one line. Parameters of the fitted curves are only reported + if the fitted ED50 is not higher than the highest dose. + + \code{ndl} is the number of dose levels in the raw data, \code{n} is the + rounded mean of the number of replicates at each dose level in the raw + data, \code{lld} is the decadic logarithm of the lowest dose and + \code{lhd} is the decadic logarithm of the highest dose. For the + \dQuote{linlogit}, \dQuote{logit} and \dQuote{probit} models, the + parameter \code{a} that is reported coincides with the logED50, i.e the + logED50 is one of the model parameters that is being fitted, and + therefore a standard deviation \code{std} is reported for the logED50. In + the case of the \dQuote(weibull) model, \code{a} is a location parameter. + Parameter \code{b} in the case of the \dQuote(linlogit) fit is the + variable b from the \code{\link{linlogitf}} function. In the case of + \dQuote(probit) fit it is the standard deviation of the fitted normal + distribution, in the case of the \dQuote(logit) fit it is the + \code{scale} parameter in the \code{\link{plogis}} function, and in the + \dQuote(weibull) fit it is the \code{shape} parameter of the fitted + \code{\link{pweibull}} function. Only the \dQuote(linlogit) fit produces + a third parameter \code{c} which is the variable f from the + \code{\link{linlogitf}} function.} + +} \examples{ data(antifoul) r <- drfit(antifoul) diff --git a/man/drplot.Rd b/man/drplot.Rd index 99f77ab..09a8517 100644 --- a/man/drplot.Rd +++ b/man/drplot.Rd @@ -53,13 +53,18 @@ } \item{postscript}{ If TRUE, (a) postscript graph(s) will be created. Otherwise, and if - the png argument is also FALSE, graphics will be + the pdf and png arguments are also FALSE, graphics will be + displayed with a screen graphics device. + } + \item{pdf}{ + If TRUE, (a) pdf graph(s) will be created. Otherwise, and if + the postscript and png arguments are also FALSE, graphics will be displayed with a screen graphics device. } \item{png}{ If TRUE, (a) png graph(s) will be created. Otherwise, and if the - postscript argument is also FALSE, graphics will be displayed with a - screen graphics device. + postscript and pdf arguments are also FALSE, graphics will be displayed + with a screen graphics device. } \item{bw}{ A boolean deciding if the plots will be black and white or not. Default |