aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DESCRIPTION4
-rw-r--r--R/drfit.R43
-rw-r--r--man/drfit.Rd4
3 files changed, 26 insertions, 25 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index eb6d9b2..e59d6c6 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: drfit
-Version: 0.04-33
-Date: 2005-07-27
+Version: 0.04-34
+Date: 2005-08-02
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 d8ad40b..f2480d2 100644
--- a/R/drfit.R
+++ b/R/drfit.R
@@ -126,11 +126,11 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE,
}
}
- if (weibull &&
+ if (probit &&
length(subset(allWrong,allWrong == i))==0) {
- m <- try(nls(response ~ pweibull(-log10(dose)+location,shape),
- data=tmp,
- start=list(location=startlogEC50[[i]],shape=s0)))
+ m <- try(nls(response ~ pnorm(-log10(dose),-logEC50,scale),
+ data=tmp,
+ start=list(logEC50=startlogEC50[[i]],scale=1)))
if (chooseone==FALSE || fit==FALSE) {
if (!inherits(m, "try-error")) {
fit <- TRUE
@@ -142,13 +142,8 @@ 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) {
- (0.5 - pweibull( - logdose + a[[ri]], b[[ri]]))^2
- }
- logEC50[[ri]] <- nlm(sqrdev,startlogEC50[[i]])$estimate
+ mtype[[ri]] <- "probit"
+ logEC50[[ri]] <- coef(m)[["logEC50"]]
c[[ri]] <- NA
if (logEC50[[ri]] > rlhd[[ri]]) {
logEC50[[ri]] <- NA
@@ -156,7 +151,9 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE,
a[[ri]] <- NA
b[[ri]] <- NA
} else {
- stderrlogEC50[[ri]] <- NA
+ stderrlogEC50[[ri]] <- s$parameters["logEC50","Std. Error"]
+ a[[ri]] <- coef(m)[["logEC50"]]
+ b[[ri]] <- coef(m)[["scale"]]
}
}
}
@@ -194,11 +191,11 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE,
}
}
- if (probit &&
+ if (weibull &&
length(subset(allWrong,allWrong == i))==0) {
- m <- try(nls(response ~ pnorm(-log10(dose),-logEC50,scale),
- data=tmp,
- start=list(logEC50=startlogEC50[[i]],scale=1)))
+ m <- try(nls(response ~ pweibull(-log10(dose)+location,shape),
+ data=tmp,
+ start=list(location=startlogEC50[[i]],shape=s0)))
if (chooseone==FALSE || fit==FALSE) {
if (!inherits(m, "try-error")) {
fit <- TRUE
@@ -210,8 +207,13 @@ 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"]]
+ mtype[[ri]] <- "weibull"
+ a[[ri]] <- coef(m)[["location"]]
+ b[[ri]] <- coef(m)[["shape"]]
+ sqrdev <- function(logdose) {
+ (0.5 - pweibull( - logdose + a[[ri]], b[[ri]]))^2
+ }
+ logEC50[[ri]] <- nlm(sqrdev,startlogEC50[[i]])$estimate
c[[ri]] <- NA
if (logEC50[[ri]] > rlhd[[ri]]) {
logEC50[[ri]] <- NA
@@ -219,14 +221,13 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE,
a[[ri]] <- NA
b[[ri]] <- NA
} else {
- stderrlogEC50[[ri]] <- s$parameters["logEC50","Std. Error"]
- a[[ri]] <- coef(m)[["logEC50"]]
- b[[ri]] <- coef(m)[["scale"]]
+ stderrlogEC50[[ri]] <- NA
}
}
}
}
+
} else {
inactive <- TRUE
}
diff --git a/man/drfit.Rd b/man/drfit.Rd
index 35d6d94..75f48ed 100644
--- a/man/drfit.Rd
+++ b/man/drfit.Rd
@@ -51,8 +51,8 @@
An optional vector containing the names of the substances for which all
functions produce a wrong fit.}
\item{chooseone}{
- If TRUE (default), the models are tried in the order linlogit, weibull,
- logit, probit, and the first model that produces a valid fit is used.
+ If TRUE (default), the models are tried in the order linlogit, probit,
+ logit, weibull, and the first model that produces a valid fit is used.
If FALSE, all models that are set to TRUE and that can be fitted will be
reported.}
\item{s0}{

Contact - Imprint