aboutsummaryrefslogtreecommitdiff
path: root/R
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 /R
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
Diffstat (limited to 'R')
-rw-r--r--R/drfit.R43
1 files changed, 22 insertions, 21 deletions
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
}

Contact - Imprint