@@ -53,6 +53,7 @@
Loading
53 53
#' f_nlme_dfop <- nlme(f["DFOP", ])
54 54
#' AIC(f_nlme_sfo, f_nlme_dfop)
55 55
#' print(f_nlme_dfop)
56 +
#' plot(f_nlme_dfop)
56 57
#' endpoints(f_nlme_dfop)
57 58
#' \dontrun{
58 59
#'   f_nlme_2 <- nlme(f["SFO", ], start = c(parent_0 = 100, log_k_parent = 0.1))
@@ -63,58 +64,36 @@
Loading
63 64
#'     A1 = mkinsub("SFO"), use_of_ff = "min", quiet = TRUE)
64 65
#'   m_sfo_sfo_ff <- mkinmod(parent = mkinsub("SFO", "A1"),
65 66
#'     A1 = mkinsub("SFO"), use_of_ff = "max", quiet = TRUE)
66 -
#'   m_fomc_sfo <- mkinmod(parent = mkinsub("FOMC", "A1"),
67 -
#'     A1 = mkinsub("SFO"), quiet = TRUE)
68 67
#'   m_dfop_sfo <- mkinmod(parent = mkinsub("DFOP", "A1"),
69 68
#'     A1 = mkinsub("SFO"), quiet = TRUE)
70 69
#'
71 70
#'   f_2 <- mmkin(list("SFO-SFO" = m_sfo_sfo,
72 71
#'    "SFO-SFO-ff" = m_sfo_sfo_ff,
73 -
#'    "FOMC-SFO" = m_fomc_sfo,
74 72
#'    "DFOP-SFO" = m_dfop_sfo),
75 73
#'     ds_2, quiet = TRUE)
76 -
#'   plot(f_2["SFO-SFO", 3:4]) # Separate fits for datasets 3 and 4
77 74
#'
78 75
#'   f_nlme_sfo_sfo <- nlme(f_2["SFO-SFO", ])
79 -
#'   # plot(f_nlme_sfo_sfo) # not feasible with pkgdown figures
80 -
#'   plot(f_nlme_sfo_sfo, 3:4) # Global mixed model: Fits for datasets 3 and 4
76 +
#'   plot(f_nlme_sfo_sfo)
81 77
#'
82 78
#'   # With formation fractions
83 79
#'   f_nlme_sfo_sfo_ff <- nlme(f_2["SFO-SFO-ff", ])
84 -
#'   plot(f_nlme_sfo_sfo_ff, 3:4) # chi2 different due to different df attribution
80 +
#'   plot(f_nlme_sfo_sfo_ff)
85 81
#'
86 -
#'   # For more parameters, we need to increase pnlsMaxIter and the tolerance
82 +
#'   # For the following fit we need to increase pnlsMaxIter and the tolerance
87 83
#'   # to get convergence
88 -
#'   f_nlme_fomc_sfo <- nlme(f_2["FOMC-SFO", ],
89 -
#'     control = list(pnlsMaxIter = 100, tolerance = 1e-4), verbose = TRUE)
90 84
#'   f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ],
91 85
#'     control = list(pnlsMaxIter = 120, tolerance = 5e-4), verbose = TRUE)
92 -
#'   plot(f_2["FOMC-SFO", 3:4])
93 -
#'   plot(f_nlme_fomc_sfo, 3:4)
94 86
#'
95 -
#'   plot(f_2["DFOP-SFO", 3:4])
96 -
#'   plot(f_nlme_dfop_sfo, 3:4)
87 +
#'   plot(f_nlme_dfop_sfo)
97 88
#'
98 -
#'   anova(f_nlme_dfop_sfo, f_nlme_fomc_sfo, f_nlme_sfo_sfo)
99 -
#'   anova(f_nlme_dfop_sfo, f_nlme_sfo_sfo) # if we ignore FOMC
89 +
#'   anova(f_nlme_dfop_sfo, f_nlme_sfo_sfo)
100 90
#'
101 91
#'   endpoints(f_nlme_sfo_sfo)
102 92
#'   endpoints(f_nlme_dfop_sfo)
103 93
#'
104 94
#'   if (length(findFunction("varConstProp")) > 0) { # tc error model for nlme available
105 -
#'     # Attempts to fit metabolite kinetics with the tc error model
106 -
#'     #f_2_tc <- mmkin(list("SFO-SFO" = m_sfo_sfo,
107 -
#'     #  "SFO-SFO-ff" = m_sfo_sfo_ff,
108 -
#'     #  "FOMC-SFO" = m_fomc_sfo,
109 -
#'     #  "DFOP-SFO" = m_dfop_sfo),
110 -
#'     #   ds_2, quiet = TRUE,
111 -
#'     #   error_model = "tc")
112 -
#'     #f_nlme_sfo_sfo_tc <- nlme(f_2_tc["SFO-SFO", ], control = list(maxIter = 100))
113 -
#'     #f_nlme_dfop_sfo_tc <- nlme(f_2_tc["DFOP-SFO", ])
114 -
#'     #f_nlme_dfop_sfo_tc <- update(f_nlme_dfop_sfo, weights = varConstProp(),
115 -
#'     #  control = list(sigma = 1, msMaxIter = 100, pnlsMaxIter = 15))
116 -
#'     # Fitting metabolite kinetics with nlme.mmkin and the two-component
117 -
#'     # error model currently does not work, at least not with these data.
95 +
#'     # Attempts to fit metabolite kinetics with the tc error model are possible,
96 +
#'     # but need tweeking of control values and sometimes do not converge
118 97
#'
119 98
#'     f_tc <- mmkin(c("SFO", "DFOP"), ds, quiet = TRUE, error_model = "tc")
120 99
#'     f_nlme_sfo_tc <- nlme(f_tc["SFO", ])

@@ -99,7 +99,7 @@
Loading
99 99
      transform_fractions = fit_1$transform_fractions)
100 100
101 101
    odeini <- degparms_all[ds_i, odeini_names]
102 -
    names(odeini) <- gsub("_0", "", names(odeini))
102 +
    names(odeini) <- gsub("_0", "", odeini_names)
103 103
104 104
    out <- mkinpredict(x$mkinmod, odeparms, odeini,
105 105
      outtimes, solution_type = solution_type,
@@ -116,7 +116,7 @@
Loading
116 116
    transform_fractions = fit_1$transform_fractions)
117 117
118 118
  odeini_pop <- degparms_all_pop[odeini_names]
119 -
  names(odeini_pop) <- gsub("_0", "", names(odeini_pop))
119 +
  names(odeini_pop) <- gsub("_0", "", odeini_names)
120 120
121 121
  pred_pop <- as.data.frame(
122 122
    mkinpredict(x$mkinmod, odeparms_pop, odeini_pop,
@@ -171,7 +171,6 @@
Loading
171 171
      maxabs = max(abs(observed_row$residual), na.rm = TRUE)
172 172
    }
173 173
174 -
175 174
    if (identical(resplot, "time")) {
176 175
      plot(0, type = "n", xlim = xlim, xlab = "Time",
177 176
        ylim = c(-1.2 * maxabs, 1.2 * maxabs),
Files Coverage
R 84.09%
Project Totals (39 files) 84.09%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading