From ca1420000183be00ede5333ad9a34e5a9d703953 Mon Sep 17 00:00:00 2001 From: jranke Date: Thu, 17 Oct 2013 13:24:42 +0000 Subject: - Fix reweighting for the case of many metabolites git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@118 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- ChangeLog | 5 +++-- R/mkinfit.R | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d87fa0d..a57894d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2013-10-17 Johannes Ranke for mkin (0.9-22) +2013-10-17 Johannes Ranke for mkin (0.9-22) * Fix plot.mkinfit as it passed graphical arguments like main to the solver * Do not use plot=TRUE in mkinfit example * The first successful fits in the not so simple GUI + * Fix iteratively reweighted least squares for the case of many metabolites 2013-10-16 Johannes Ranke for mkin (0.9-22) @@ -16,7 +17,7 @@ * Implement IRLS assuming different variances for observed variables -2013-10-09 Johannes Ranke for mkin (0.9-22) +2013-10-09 Johannes Ranke for version (0.9-22) * Do not use 0 values at time zero for chi2 error level calculations. This is the way it is done in KinGUII and it makes sense diff --git a/R/mkinfit.R b/R/mkinfit.R index 70ca9c0..83ac087 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -215,7 +215,7 @@ mkinfit <- function(mkinmod, observed, while (reweight.diff > reweight.tol & n.iter < reweight.max.iter) { n.iter <- n.iter + 1 sigma.old <- sqrt(fit$var_ms_unweighted) - observed[err] <- sqrt(fit$var_ms_unweighted)[observed$name] + observed[err] <- sqrt(fit$var_ms_unweighted)[as.character(observed$name)] fit <- modFit(cost, fit$par, method = method.modFit, control = control.modFit, ...) reweight.diff = sum((sqrt(fit$var_ms_unweighted) - sigma.old)^2) -- cgit v1.2.1