diff options
| -rw-r--r-- | R/mkinfit.R | 42 | ||||
| -rw-r--r-- | R/mkinmod.R | 12 | 
2 files changed, 27 insertions, 27 deletions
| diff --git a/R/mkinfit.R b/R/mkinfit.R index b5020418..4ac54ce2 100644 --- a/R/mkinfit.R +++ b/R/mkinfit.R @@ -903,25 +903,25 @@ print.summary.mkinfit <- function(x, digits = max(3, getOption("digits") - 3), .  }
  # Alternative way to fit the error model, fitting to modelled instead of
  # observed values
 -.fit_error_model_mad_mod <- function(tmp_res, tc) {
 -  mad_agg <- aggregate(tmp_res$res.unweighted,
 -                       by = list(name = tmp_res$name, time = tmp_res$x),
 -                       FUN = function(x) mad(x, center = 0))
 -  names(mad_agg) <- c("name", "time", "mad")
 -  mod_agg <- aggregate(tmp_res$mod,
 -                       by = list(name = tmp_res$name, time = tmp_res$x),
 -                       FUN = mean)
 -  names(mod_agg) <- c("name", "time", "mod")
 -  mod_mad <- merge(mod_agg, mad_agg)
 -
 -  tc_fit <- tryCatch(
 -    nls(mad ~ sigma_twocomp(mod, sigma_low, rsd_high),
 -      start = list(sigma_low = tc["sigma_low"], rsd_high = tc["rsd_high"]),
 -      data = mod_mad,
 -      weights = 1/mod_mad$mad,
 -      lower = 0,
 -      algorithm = "port"),
 -    error = "Fitting the error model failed in iteration")
 -  return(tc_fit)
 -}
 +# .fit_error_model_mad_mod <- function(tmp_res, tc) {
 +#   mad_agg <- aggregate(tmp_res$res.unweighted,
 +#                        by = list(name = tmp_res$name, time = tmp_res$x),
 +#                        FUN = function(x) mad(x, center = 0))
 +#   names(mad_agg) <- c("name", "time", "mad")
 +#   mod_agg <- aggregate(tmp_res$mod,
 +#                        by = list(name = tmp_res$name, time = tmp_res$x),
 +#                        FUN = mean)
 +#   names(mod_agg) <- c("name", "time", "mod")
 +#   mod_mad <- merge(mod_agg, mad_agg)
 +# 
 +#   tc_fit <- tryCatch(
 +#     nls(mad ~ sigma_twocomp(mod, sigma_low, rsd_high),
 +#       start = list(sigma_low = tc["sigma_low"], rsd_high = tc["rsd_high"]),
 +#       data = mod_mad,
 +#       weights = 1/mod_mad$mad,
 +#       lower = 0,
 +#       algorithm = "port"),
 +#     error = "Fitting the error model failed in iteration")
 +#   return(tc_fit)
 +# }
  # vim: set ts=2 sw=2 expandtab:
 diff --git a/R/mkinmod.R b/R/mkinmod.R index 2805ef54..26148f18 100644 --- a/R/mkinmod.R +++ b/R/mkinmod.R @@ -164,12 +164,12 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL, quiet = FALSE, verb          # The problems were: Calculation of dissipation times did not work in this case
          # and the coefficient matrix is not generated correctly by the code present
          # in this file in this case
 -        f_free_bound <- paste("f", varname, "free", "bound", sep = "_")
 -        k_bound_free <- paste("k", varname, "bound", "free", sep = "_")
 -        parms <- c(parms, f_free_bound, k_bound_free)
 -        reversible_binding_term_1 <- paste("+", k_bound_free, "*", box_2)
 -        reversible_binding_term_2 <- paste("+", f_free_bound, "*", k_compound, "*", box_1, "-",
 -          k_bound_free, "*", box_2)
 +        #f_free_bound <- paste("f", varname, "free", "bound", sep = "_")
 +        #k_bound_free <- paste("k", varname, "bound", "free", sep = "_")
 +        #parms <- c(parms, f_free_bound, k_bound_free)
 +        #reversible_binding_term_1 <- paste("+", k_bound_free, "*", box_2)
 +        #reversible_binding_term_2 <- paste("+", f_free_bound, "*", k_compound, "*", box_1, "-",
 +        #  k_bound_free, "*", box_2)
        }
        diffs[[box_1]] <- paste(diffs[[box_1]], reversible_binding_term_1)
        diffs[[box_2]] <- paste(diffs[[box_2]], reversible_binding_term_2)
 | 
