aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc>2005-08-02 12:15:15 +0000
committerranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc>2005-08-02 12:15:15 +0000
commitc5f30593d42ecd9a21f799a4943709b1b73a1162 (patch)
treeaea2b1301d9fc924c1a4363bfa354a1ceea5ce7b
parent19542fd64a83200cc97177982c5f9d20a7c6312b (diff)
drplot: Added the pointsize argument for postscript and png graphs
drfit: Changed the order of fits in the case of chooseone=TRUE git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/drfit@34 d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc
-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