From ebf00aeb389424b09be4a1051044291b01555153 Mon Sep 17 00:00:00 2001 From: jranke Date: Wed, 16 Oct 2013 15:18:14 +0000 Subject: - More consistent output regarding optimised and fixed parameters (see ChangeLog) - Switch from gcanvas to gsvg - Start setting up the fits in the GUI - add files for testing gWidgetsWWW2 functionality git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@115 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- R/mkinfit.R | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'R') diff --git a/R/mkinfit.R b/R/mkinfit.R index b46184b..70ca9c0 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -89,11 +89,16 @@ mkinfit <- function(mkinmod, observed, state.ini.fixed <- state.ini[fixed_initials] state.ini.optim <- state.ini[setdiff(names(state.ini), fixed_initials)] - # Preserve names of state variables before renaming initial state variable parameters + # Preserve names of state variables before renaming initial state variable + # parameters state.ini.optim.boxnames <- names(state.ini.optim) + state.ini.fixed.boxnames <- names(state.ini.fixed) if(length(state.ini.optim) > 0) { names(state.ini.optim) <- paste(names(state.ini.optim), "0", sep="_") } + if(length(state.ini.fixed) > 0) { + names(state.ini.fixed) <- paste(names(state.ini.fixed), "0", sep="_") + } # Decide if the solution of the model can be based on a simple analytical # formula, the spectral decomposition of the matrix (fundamental system) @@ -138,8 +143,8 @@ mkinfit <- function(mkinmod, observed, if(length(state.ini.optim) > 0) { odeini <- c(P[1:length(state.ini.optim)], state.ini.fixed) - names(odeini) <- c(state.ini.optim.boxnames, names(state.ini.fixed)) - } else odeini <- state.ini.fixed + names(odeini) <- c(state.ini.optim.boxnames, state.ini.fixed.boxnames) + } else odeini <- state.ini.fixed.boxnames odeparms <- c(P[(length(state.ini.optim) + 1):length(P)], parms.fixed) @@ -235,7 +240,7 @@ mkinfit <- function(mkinmod, observed, fit$predicted <- mkin_wide_to_long(out_predicted, time = "time") # Collect initial parameter values in two dataframes - fit$start <- data.frame(initial = c(state.ini.optim, + fit$start <- data.frame(value = c(state.ini.optim, backtransform_odeparms(parms.optim, mod_vars))) fit$start$type = c(rep("state", length(state.ini.optim)), rep("deparm", length(parms.optim))) -- cgit v1.2.1