aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DESCRIPTION4
-rw-r--r--R/drfit.R16
2 files changed, 13 insertions, 7 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index 07ea94d..87a1302 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: drfit
-Version: 0.04-45
-Date: 2005-10-11
+Version: 0.04-47
+Date: 2005-11-25
Title: Dose-response data evaluation
Author: Johannes Ranke <jranke@uni-bremen.de>
Maintainer: Johannes Ranke <jranke@uni-bremen.de>
diff --git a/R/drfit.R b/R/drfit.R
index 9c99b1a..d8631e6 100644
--- a/R/drfit.R
+++ b/R/drfit.R
@@ -117,15 +117,16 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE,
runit[[ri]] <- unit
rlld[[ri]] <- log10(lowestdose)
rlhd[[ri]] <- log10(highestdose)
- mtype[[ri]] <- "linlogit"
logEC50[[ri]] <- coef(m)[["logEC50"]]
if (logEC50[[ri]] > rlhd[[ri]]) {
+ mtype[[ri]] <- "no fit"
logEC50[[ri]] <- NA
stderrlogEC50[[ri]] <- NA
a[[ri]] <- NA
b[[ri]] <- NA
c[[ri]] <- NA
} else {
+ mtype[[ri]] <- "linlogit"
stderrlogEC50[[ri]] <- s$parameters["logEC50","Std. Error"]
a[[ri]] <- coef(m)[["logEC50"]]
b[[ri]] <- coef(m)[["b"]]
@@ -150,15 +151,16 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE,
runit[[ri]] <- unit
rlld[[ri]] <- log10(lowestdose)
rlhd[[ri]] <- log10(highestdose)
- mtype[[ri]] <- "probit"
logEC50[[ri]] <- coef(m)[["logEC50"]]
c[[ri]] <- NA
if (logEC50[[ri]] > rlhd[[ri]]) {
+ mtype[[ri]] <- "no fit"
logEC50[[ri]] <- NA
stderrlogEC50[[ri]] <- NA
a[[ri]] <- NA
b[[ri]] <- NA
} else {
+ mtype[[ri]] <- "probit"
stderrlogEC50[[ri]] <- s$parameters["logEC50","Std. Error"]
a[[ri]] <- coef(m)[["logEC50"]]
b[[ri]] <- coef(m)[["scale"]]
@@ -183,16 +185,17 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE,
runit[[ri]] <- unit
rlld[[ri]] <- log10(lowestdose)
rlhd[[ri]] <- log10(highestdose)
- mtype[[ri]] <- "logit"
logEC50[[ri]] <- a[[ri]] <- coef(m)[["logEC50"]]
b[[ri]] <- coef(m)[["scale"]]
c[[ri]] <- NA
if (logEC50[[ri]] > rlhd[[ri]]) {
+ mtype[[ri]] <- "no fit"
logEC50[[ri]] <- NA
stderrlogEC50[[ri]] <- NA
a[[ri]] <- NA
b[[ri]] <- NA
} else {
+ mtype[[ri]] <- "logit"
stderrlogEC50[[ri]] <- s$parameters["logEC50","Std. Error"]
}
}
@@ -215,7 +218,6 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE,
runit[[ri]] <- unit
rlld[[ri]] <- log10(lowestdose)
rlhd[[ri]] <- log10(highestdose)
- mtype[[ri]] <- "weibull"
a[[ri]] <- coef(m)[["location"]]
b[[ri]] <- coef(m)[["shape"]]
sqrdev <- function(logdose) {
@@ -224,11 +226,13 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE,
logEC50[[ri]] <- nlm(sqrdev,startlogEC50[[i]])$estimate
c[[ri]] <- NA
if (logEC50[[ri]] > rlhd[[ri]]) {
+ mtype[[ri]] <- "no fit"
logEC50[[ri]] <- NA
stderrlogEC50[[ri]] <- NA
a[[ri]] <- NA
b[[ri]] <- NA
} else {
+ mtype[[ri]] <- "weibull"
stderrlogEC50[[ri]] <- NA
}
}
@@ -280,6 +284,7 @@ drplot <- function(drresults, data, dtype = "std", alpha = 0.95,
pointsize = 12,
colors = 1:8, devoff=T, lpos="topright")
{
+ # Check if all data have the same unit
unitlevels <- levels(as.factor(drresults$unit))
if (length(unitlevels) == 1) {
unit <- unitlevels
@@ -289,7 +294,7 @@ drplot <- function(drresults, data, dtype = "std", alpha = 0.95,
# Get the plot limits on the x-axis (log of the dose)
if(is.data.frame(data)) {
- if (min(data$dose == 0)) {
+ if (min(data$dose) == 0) {
cat("At least one of the dose levels is 0 - this is not a valid dose.")
} else {
lld <- log10(min(data$dose))
@@ -336,6 +341,7 @@ drplot <- function(drresults, data, dtype = "std", alpha = 0.95,
# Plot the data either as raw data or as error bars
if(is.data.frame(data)) {
splitted <- split(data,data$substance)
+ # n is the index for the dose-response curves
n <- 0
if (bw) colors <- rep("black",length(dsubstances))
# Loop over the substances in the data

Contact - Imprint