aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2018-09-15 11:03:08 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2018-09-15 11:03:08 +0200
commit5b87e5d81a42d36616678fd65889b352cc8d6ff3 (patch)
tree8436d593c018c4c76aaef580ffac006ca27a062f /R
parent074ba16b2f5a27f92492b129120d25f33cd33f70 (diff)
Remove correlation test as gmkin on windows still crashes
Clean up the code a bit
Diffstat (limited to 'R')
-rw-r--r--R/mkinfit.R28
1 files changed, 10 insertions, 18 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index dec55a4e..2f05e81a 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -413,21 +413,12 @@ mkinfit <- function(mkinmod, observed,
}
if (reweight.method == "tc") {
# We need unweighted residuals to update the weighting
- cost_tmp <- cost(fit$par)
-
- # We need to supress warnings as we may have ties
- p_tmp <- suppressWarnings(cor.test(abs(cost_tmp$residuals$res.unweighted),
- cost_tmp$residuals$obs, method = "kendall")$p.value)
-
- if (p_tmp > 0.1) {
- stop("No correlation of absolute residuals with observed values found.\n",
- "Try without reweighting or with reweight.method = 'obs'.")
- }
+ tmp_res <- cost(fit$par)$residuals
tc_fit <- try(
nls(abs(res.unweighted) ~ sigma_twocomp(obs, sigma_low, rsd_high),
start = list(sigma_low = tc["sigma_low"], rsd_high = tc["rsd_high"]),
- data = cost_tmp$residuals,
+ data = tmp_res,
lower = 0,
algorithm = "port"))
@@ -467,13 +458,14 @@ mkinfit <- function(mkinmod, observed,
sr_new <- fit$var_ms_unweighted
}
if (reweight.method == "tc") {
- cost_tmp <- cost(fit$par)
-
- tc_fit <- try(nls(abs(res.unweighted) ~ sigma_twocomp(obs, sigma_low, rsd_high),
- start = as.list(tc_fitted),
- data = cost_tmp$residuals,
- lower = 0,
- algorithm = "port"))
+ tmp_res <- cost(fit$par)$residuals
+
+ tc_fit <- try(
+ nls(abs(res.unweighted) ~ sigma_twocomp(obs, sigma_low, rsd_high),
+ start = list(sigma_low = tc["sigma_low"], rsd_high = tc["rsd_high"]),
+ data = tmp_res,
+ lower = 0,
+ algorithm = "port"))
if (inherits(tc_fit, "try-error")) {
stop("Estimation of the two error model components failed during reweighting.\n",

Contact - Imprint