aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--R/nlme.R6
-rw-r--r--R/nlme.mmkin.R2
-rw-r--r--R/plot.nlme.mmkin.R46
-rw-r--r--docs/dev/pkgdown.yml2
-rw-r--r--docs/dev/reference/Rplot001.pngbin48355 -> 27839 bytes
-rw-r--r--docs/dev/reference/Rplot002.pngbin62018 -> 57366 bytes
-rw-r--r--docs/dev/reference/Rplot003.pngbin62243 -> 55679 bytes
-rw-r--r--docs/dev/reference/Rplot004.pngbin63952 -> 57102 bytes
-rw-r--r--docs/dev/reference/nlme-1.pngbin71651 -> 68086 bytes
-rw-r--r--docs/dev/reference/nlme-2.pngbin0 -> 86504 bytes
-rw-r--r--docs/dev/reference/nlme.html112
-rw-r--r--docs/dev/reference/nlme.mmkin-1.pngbin135400 -> 119649 bytes
-rw-r--r--docs/dev/reference/nlme.mmkin-2.pngbin171122 -> 159253 bytes
-rw-r--r--docs/dev/reference/nlme.mmkin-3.pngbin171684 -> 158930 bytes
-rw-r--r--docs/dev/reference/nlme.mmkin-4.pngbin175495 -> 163000 bytes
-rw-r--r--docs/dev/reference/nlme.mmkin.html8
-rw-r--r--docs/dev/reference/plot.nlme.mmkin-2.pngbin179274 -> 164499 bytes
-rw-r--r--docs/dev/reference/plot.nlme.mmkin.html32
-rw-r--r--man/nlme.Rd6
-rw-r--r--man/nlme.mmkin.Rd2
-rw-r--r--man/plot.nlme.mmkin.Rd20
21 files changed, 121 insertions, 115 deletions
diff --git a/R/nlme.R b/R/nlme.R
index 20987064..e2184ae1 100644
--- a/R/nlme.R
+++ b/R/nlme.R
@@ -48,8 +48,12 @@
#' start = mean_dp)
#' summary(m_nlme)
#' plot(augPred(m_nlme, level = 0:1), layout = c(3, 1))
-#' # augPred does not seem to work on fits with more than one state
+#' # augPred does not work on fits with more than one state
#' # variable
+#' #
+#' # The procedure is greatly simplified by the nlme.mmkin function
+#' f_nlme <- nlme(f)
+#' plot(f_nlme)
#'
#' @return A function that can be used with nlme
#' @export
diff --git a/R/nlme.mmkin.R b/R/nlme.mmkin.R
index 22a70f18..d3369cf5 100644
--- a/R/nlme.mmkin.R
+++ b/R/nlme.mmkin.R
@@ -55,6 +55,7 @@ get_deg_func <- function() {
#' print(f_nlme_dfop)
#' plot(f_nlme_dfop)
#' endpoints(f_nlme_dfop)
+#'
#' \dontrun{
#' f_nlme_2 <- nlme(f["SFO", ], start = c(parent_0 = 100, log_k_parent = 0.1))
#' update(f_nlme_2, random = parent_0 ~ 1)
@@ -101,6 +102,7 @@ get_deg_func <- function() {
#' AIC(f_nlme_sfo, f_nlme_sfo_tc, f_nlme_dfop, f_nlme_dfop_tc)
#' print(f_nlme_dfop_tc)
#' }
+#'
#' f_2_obs <- mmkin(list("SFO-SFO" = m_sfo_sfo,
#' "DFOP-SFO" = m_dfop_sfo),
#' ds_2, quiet = TRUE, error_model = "obs")
diff --git a/R/plot.nlme.mmkin.R b/R/plot.nlme.mmkin.R
index a27f0caa..afb682a7 100644
--- a/R/plot.nlme.mmkin.R
+++ b/R/plot.nlme.mmkin.R
@@ -5,11 +5,10 @@ if(getRversion() >= '2.15.1') utils::globalVariables("ds")
#' @param x An object of class \code{\link{nlme.mmkin}}
#' @param i A numeric index to select datasets for which to plot the nlme fit,
#' in case plots get too large
-#' @param main The main title placed on the outer margin of the plot.
#' @inheritParams plot.mkinfit
-#' @param legends An index for the fits for which legends should be shown.
#' @param standardized Should the residuals be standardized? Only takes effect if
#' `resplot = "time"`.
+#' @param rel.height.legend The relative height of the legend shown on top
#' @param rel.height.bottom The relative height of the bottom plot row
#' @param ymax Vector of maximum y axis values
#' @param \dots Further arguments passed to \code{\link{plot.mkinfit}} and
@@ -31,6 +30,7 @@ if(getRversion() >= '2.15.1') utils::globalVariables("ds")
#' A1 = mkinsub("SFO"), quiet = TRUE)
#' f <- mmkin(list("DFOP-SFO" = dfop_sfo), ds, quiet = TRUE, cores = 1)
#' plot(f[, 3:4], standardized = TRUE)
+#'
#' library(nlme)
#' # For this fit we need to increase pnlsMaxiter, and we increase the
#' # tolerance in order to speed up the fit for this example evaluation
@@ -38,15 +38,15 @@ if(getRversion() >= '2.15.1') utils::globalVariables("ds")
#' plot(f_nlme)
#' @export
plot.nlme.mmkin <- function(x, i = 1:ncol(x$mmkin_orig),
- main = NULL,
obs_vars = names(x$mkinmod$map),
standardized = TRUE,
xlab = "Time",
xlim = range(x$data$time),
- legends = 1,
- lpos = "topright", inset = c(0.05, 0.05),
resplot = c("predicted", "time"),
ymax = "auto", maxabs = "auto",
+ ncol.legend = ifelse(length(i) <= 3, length(i) + 1, ifelse(length(i) <= 8, 3, 4)),
+ nrow.legend = ceiling((length(i) + 1) / ncol.legend),
+ rel.height.legend = 0.03 + 0.08 * nrow.legend,
rel.height.bottom = 1.1,
pch_ds = 1:length(i),
col_ds = pch_ds + 1,
@@ -65,7 +65,7 @@ plot.nlme.mmkin <- function(x, i = 1:ncol(x$mmkin_orig),
names(degparms_fixed) <- rownames(fit_1$fixed)
degparms_all <- cbind(as.matrix(degparms_optim),
matrix(rep(degparms_fixed, nrow(degparms_optim)),
- ncol = length(degparms_fixed),
+ ncol = length(degparms_fixed),
nrow = nrow(degparms_optim), byrow = TRUE))
degparms_all_names <- c(degparms_optim_names, names(degparms_fixed))
colnames(degparms_all) <- degparms_all_names
@@ -81,14 +81,27 @@ plot.nlme.mmkin <- function(x, i = 1:ncol(x$mmkin_orig),
n_plot_rows = length(obs_vars)
n_plots = n_plot_rows * 2
- # Set relative plot heights, so the first and the last plot are the norm
- # and the middle plots (if n_plot_rows >2) are smaller by rel.height.middle
- rel.heights <- if (n_plot_rows > 1) c(rep(1, n_plot_rows - 1), rel.height.bottom) else 1
+ # Set relative plot heights, so the first plot row is the norm
+ rel.heights <- if (n_plot_rows > 1) {
+ c(rel.height.legend, c(rep(1, n_plot_rows - 1), rel.height.bottom))
+ } else {
+ c(rel.height.legend, 1)
+ }
- layout_matrix = matrix(1:n_plots,
- n_plot_rows, 2, byrow = TRUE)
+ layout_matrix = matrix(c(1, 1, 2:(n_plots + 1)),
+ n_plot_rows + 1, 2, byrow = TRUE)
layout(layout_matrix, heights = rel.heights)
+ par(mar = c(0.1, 2.1, 0.6, 2.1))
+
+ plot(0, type = "n", axes = FALSE, ann = FALSE)
+ legend("center", bty = "n", ncol = ncol.legend,
+ legend = c("Population", ds_names[i]),
+ lty = c(1, lty_ds), lwd = c(2, rep(1, length(i))),
+ col = c(1, col_ds),
+ pch = c(NA, pch_ds))
+
+
solution_type = fit_1$solution_type
outtimes <- sort(unique(c(x$data$time,
@@ -96,6 +109,7 @@ plot.nlme.mmkin <- function(x, i = 1:ncol(x$mmkin_orig),
pred_ds <- purrr::map_dfr(i, function(ds_i) {
odeparms_trans <- degparms_all[ds_i, odeparms_names]
+ names(odeparms_trans) <- odeparms_names # needed if only one odeparm
odeparms <- backtransform_odeparms(odeparms_trans,
x$mkinmod,
transform_rates = fit_1$transform_rates,
@@ -162,14 +176,6 @@ plot.nlme.mmkin <- function(x, i = 1:ncol(x$mmkin_orig),
col = col_ds[ds_i], lty = lty_ds[ds_i])
}
- if (plot_row %in% legends) {
- legend(lpos, inset = inset,
- legend = c("Population", ds_names[i]),
- lty = c(1, lty_ds), lwd = c(2, rep(1, length(i))),
- col = c(1, col_ds),
- pch = c(NA, pch_ds))
- }
-
if (identical(maxabs, "auto")) {
maxabs = max(abs(observed_row$residual), na.rm = TRUE)
}
@@ -194,6 +200,8 @@ plot.nlme.mmkin <- function(x, i = 1:ncol(x$mmkin_orig),
ylim = c(-1.2 * maxabs, 1.2 * maxabs),
ylab = if (standardized) "Standardized residual" else "Residual")
+ abline(h = 0, lty = 2)
+
for (ds_i in seq_along(i)) {
observed_row_ds <- merge(
subset(observed_row, ds == ds_names[ds_i], c("time", "residual")),
diff --git a/docs/dev/pkgdown.yml b/docs/dev/pkgdown.yml
index d6c3d6c9..8f493a24 100644
--- a/docs/dev/pkgdown.yml
+++ b/docs/dev/pkgdown.yml
@@ -10,7 +10,7 @@ articles:
web_only/NAFTA_examples: NAFTA_examples.html
web_only/benchmarks: benchmarks.html
web_only/compiled_models: compiled_models.html
-last_built: 2020-10-24T00:14Z
+last_built: 2020-10-26T13:18Z
urls:
reference: https://pkgdown.jrwb.de/mkin/reference
article: https://pkgdown.jrwb.de/mkin/articles
diff --git a/docs/dev/reference/Rplot001.png b/docs/dev/reference/Rplot001.png
index bf7c274a..cfc5bc2b 100644
--- a/docs/dev/reference/Rplot001.png
+++ b/docs/dev/reference/Rplot001.png
Binary files differ
diff --git a/docs/dev/reference/Rplot002.png b/docs/dev/reference/Rplot002.png
index 965d4620..8e2eb70d 100644
--- a/docs/dev/reference/Rplot002.png
+++ b/docs/dev/reference/Rplot002.png
Binary files differ
diff --git a/docs/dev/reference/Rplot003.png b/docs/dev/reference/Rplot003.png
index 057b525f..0b173f9e 100644
--- a/docs/dev/reference/Rplot003.png
+++ b/docs/dev/reference/Rplot003.png
Binary files differ
diff --git a/docs/dev/reference/Rplot004.png b/docs/dev/reference/Rplot004.png
index 2b5ba960..4874cd19 100644
--- a/docs/dev/reference/Rplot004.png
+++ b/docs/dev/reference/Rplot004.png
Binary files differ
diff --git a/docs/dev/reference/nlme-1.png b/docs/dev/reference/nlme-1.png
index 8db1f999..0b34db8f 100644
--- a/docs/dev/reference/nlme-1.png
+++ b/docs/dev/reference/nlme-1.png
Binary files differ
diff --git a/docs/dev/reference/nlme-2.png b/docs/dev/reference/nlme-2.png
new file mode 100644
index 00000000..ce932c86
--- /dev/null
+++ b/docs/dev/reference/nlme-2.png
Binary files differ
diff --git a/docs/dev/reference/nlme.html b/docs/dev/reference/nlme.html
index af5a151a..e21074e7 100644
--- a/docs/dev/reference/nlme.html
+++ b/docs/dev/reference/nlme.html
@@ -75,7 +75,7 @@ datasets. They are used internally by the nlme.mmkin() method." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-info" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.9.50.3</span>
+ <span class="version label label-info" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.9.50.4</span>
</span>
</div>
@@ -123,7 +123,7 @@ datasets. They are used internally by the nlme.mmkin() method." />
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
- <a href="http://github.com/jranke/mkin/">
+ <a href="https://github.com/jranke/mkin/">
<span class="fab fa fab fa-github fa-lg"></span>
</a>
@@ -142,7 +142,7 @@ datasets. They are used internally by the nlme.mmkin() method." />
<div class="col-md-9 contents">
<div class="page-header">
<h1>Helper functions to create nlme models from mmkin row objects</h1>
- <small class="dont-index">Source: <a href='http://github.com/jranke/mkin/blob/master/R/nlme.R'><code>R/nlme.R</code></a></small>
+ <small class="dont-index">Source: <a href='https://github.com/jranke/mkin/blob/master/R/nlme.R'><code>R/nlme.R</code></a></small>
<div class="hidden name"><code>nlme.Rd</code></div>
</div>
@@ -153,11 +153,11 @@ objects that have been obtained by fitting the same model to a list of
datasets. They are used internally by the <code><a href='nlme.mmkin.html'>nlme.mmkin()</a></code> method.</p>
</div>
- <pre class="usage"><span class='fu'>nlme_function</span>(<span class='no'>object</span>)
+ <pre class="usage"><span class='fu'>nlme_function</span><span class='op'>(</span><span class='va'>object</span><span class='op'>)</span>
-<span class='fu'>mean_degparms</span>(<span class='no'>object</span>, <span class='kw'>random</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
+<span class='fu'>mean_degparms</span><span class='op'>(</span><span class='va'>object</span>, random <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span>
-<span class='fu'>nlme_data</span>(<span class='no'>object</span>)</pre>
+<span class='fu'>nlme_data</span><span class='op'>(</span><span class='va'>object</span><span class='op'>)</span></pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
@@ -185,71 +185,77 @@ nlme for the case of a single grouping variable ds.</p>
<div class='dont-index'><p><code><a href='nlme.mmkin.html'>nlme.mmkin</a></code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
- <pre class="examples"><div class='input'><span class='no'>sampling_times</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>3</span>, <span class='fl'>7</span>, <span class='fl'>14</span>, <span class='fl'>28</span>, <span class='fl'>60</span>, <span class='fl'>90</span>, <span class='fl'>120</span>)
-<span class='no'>m_SFO</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>))
-<span class='no'>d_SFO_1</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span>(<span class='no'>m_SFO</span>,
- <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>k_parent</span> <span class='kw'>=</span> <span class='fl'>0.1</span>),
- <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>98</span>), <span class='no'>sampling_times</span>)
-<span class='no'>d_SFO_1_long</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span>(<span class='no'>d_SFO_1</span>, <span class='kw'>time</span> <span class='kw'>=</span> <span class='st'>"time"</span>)
-<span class='no'>d_SFO_2</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span>(<span class='no'>m_SFO</span>,
- <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>k_parent</span> <span class='kw'>=</span> <span class='fl'>0.05</span>),
- <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>102</span>), <span class='no'>sampling_times</span>)
-<span class='no'>d_SFO_2_long</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span>(<span class='no'>d_SFO_2</span>, <span class='kw'>time</span> <span class='kw'>=</span> <span class='st'>"time"</span>)
-<span class='no'>d_SFO_3</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span>(<span class='no'>m_SFO</span>,
- <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>k_parent</span> <span class='kw'>=</span> <span class='fl'>0.02</span>),
- <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>103</span>), <span class='no'>sampling_times</span>)
-<span class='no'>d_SFO_3_long</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span>(<span class='no'>d_SFO_3</span>, <span class='kw'>time</span> <span class='kw'>=</span> <span class='st'>"time"</span>)
-
-<span class='no'>d1</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='add_err.html'>add_err</a></span>(<span class='no'>d_SFO_1</span>, <span class='kw'>function</span>(<span class='no'>value</span>) <span class='fl'>3</span>, <span class='kw'>n</span> <span class='kw'>=</span> <span class='fl'>1</span>)
-<span class='no'>d2</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='add_err.html'>add_err</a></span>(<span class='no'>d_SFO_2</span>, <span class='kw'>function</span>(<span class='no'>value</span>) <span class='fl'>2</span>, <span class='kw'>n</span> <span class='kw'>=</span> <span class='fl'>1</span>)
-<span class='no'>d3</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='add_err.html'>add_err</a></span>(<span class='no'>d_SFO_3</span>, <span class='kw'>function</span>(<span class='no'>value</span>) <span class='fl'>4</span>, <span class='kw'>n</span> <span class='kw'>=</span> <span class='fl'>1</span>)
-<span class='no'>ds</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>d1</span> <span class='kw'>=</span> <span class='no'>d1</span>, <span class='kw'>d2</span> <span class='kw'>=</span> <span class='no'>d2</span>, <span class='kw'>d3</span> <span class='kw'>=</span> <span class='no'>d3</span>)
-
-<span class='no'>f</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span>(<span class='st'>"SFO"</span>, <span class='no'>ds</span>, <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
-<span class='no'>mean_dp</span> <span class='kw'>&lt;-</span> <span class='fu'>mean_degparms</span>(<span class='no'>f</span>)
-<span class='no'>grouped_data</span> <span class='kw'>&lt;-</span> <span class='fu'>nlme_data</span>(<span class='no'>f</span>)
-<span class='no'>nlme_f</span> <span class='kw'>&lt;-</span> <span class='fu'>nlme_function</span>(<span class='no'>f</span>)
+ <pre class="examples"><div class='input'><span class='va'>sampling_times</span> <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>3</span>, <span class='fl'>7</span>, <span class='fl'>14</span>, <span class='fl'>28</span>, <span class='fl'>60</span>, <span class='fl'>90</span>, <span class='fl'>120</span><span class='op'>)</span>
+<span class='va'>m_SFO</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span><span class='op'>)</span><span class='op'>)</span>
+<span class='va'>d_SFO_1</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span><span class='op'>(</span><span class='va'>m_SFO</span>,
+ <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>k_parent <span class='op'>=</span> <span class='fl'>0.1</span><span class='op'>)</span>,
+ <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fl'>98</span><span class='op'>)</span>, <span class='va'>sampling_times</span><span class='op'>)</span>
+<span class='va'>d_SFO_1_long</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span><span class='op'>(</span><span class='va'>d_SFO_1</span>, time <span class='op'>=</span> <span class='st'>"time"</span><span class='op'>)</span>
+<span class='va'>d_SFO_2</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span><span class='op'>(</span><span class='va'>m_SFO</span>,
+ <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>k_parent <span class='op'>=</span> <span class='fl'>0.05</span><span class='op'>)</span>,
+ <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fl'>102</span><span class='op'>)</span>, <span class='va'>sampling_times</span><span class='op'>)</span>
+<span class='va'>d_SFO_2_long</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span><span class='op'>(</span><span class='va'>d_SFO_2</span>, time <span class='op'>=</span> <span class='st'>"time"</span><span class='op'>)</span>
+<span class='va'>d_SFO_3</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span><span class='op'>(</span><span class='va'>m_SFO</span>,
+ <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>k_parent <span class='op'>=</span> <span class='fl'>0.02</span><span class='op'>)</span>,
+ <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fl'>103</span><span class='op'>)</span>, <span class='va'>sampling_times</span><span class='op'>)</span>
+<span class='va'>d_SFO_3_long</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span><span class='op'>(</span><span class='va'>d_SFO_3</span>, time <span class='op'>=</span> <span class='st'>"time"</span><span class='op'>)</span>
+
+<span class='va'>d1</span> <span class='op'>&lt;-</span> <span class='fu'><a href='add_err.html'>add_err</a></span><span class='op'>(</span><span class='va'>d_SFO_1</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>value</span><span class='op'>)</span> <span class='fl'>3</span>, n <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span>
+<span class='va'>d2</span> <span class='op'>&lt;-</span> <span class='fu'><a href='add_err.html'>add_err</a></span><span class='op'>(</span><span class='va'>d_SFO_2</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>value</span><span class='op'>)</span> <span class='fl'>2</span>, n <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span>
+<span class='va'>d3</span> <span class='op'>&lt;-</span> <span class='fu'><a href='add_err.html'>add_err</a></span><span class='op'>(</span><span class='va'>d_SFO_3</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>value</span><span class='op'>)</span> <span class='fl'>4</span>, n <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span>
+<span class='va'>ds</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>d1 <span class='op'>=</span> <span class='va'>d1</span>, d2 <span class='op'>=</span> <span class='va'>d2</span>, d3 <span class='op'>=</span> <span class='va'>d3</span><span class='op'>)</span>
+
+<span class='va'>f</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span><span class='op'>(</span><span class='st'>"SFO"</span>, <span class='va'>ds</span>, cores <span class='op'>=</span> <span class='fl'>1</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
+<span class='va'>mean_dp</span> <span class='op'>&lt;-</span> <span class='fu'>mean_degparms</span><span class='op'>(</span><span class='va'>f</span><span class='op'>)</span>
+<span class='va'>grouped_data</span> <span class='op'>&lt;-</span> <span class='fu'>nlme_data</span><span class='op'>(</span><span class='va'>f</span><span class='op'>)</span>
+<span class='va'>nlme_f</span> <span class='op'>&lt;-</span> <span class='fu'>nlme_function</span><span class='op'>(</span><span class='va'>f</span><span class='op'>)</span>
<span class='co'># These assignments are necessary for these objects to be</span>
<span class='co'># visible to nlme and augPred when evaluation is done by</span>
<span class='co'># pkgdown to generated the html docs.</span>
-<span class='fu'><a href='https://rdrr.io/r/base/assign.html'>assign</a></span>(<span class='st'>"nlme_f"</span>, <span class='no'>nlme_f</span>, <span class='fu'><a href='https://rdrr.io/r/base/environment.html'>globalenv</a></span>())
-<span class='fu'><a href='https://rdrr.io/r/base/assign.html'>assign</a></span>(<span class='st'>"grouped_data"</span>, <span class='no'>grouped_data</span>, <span class='fu'><a href='https://rdrr.io/r/base/environment.html'>globalenv</a></span>())
-
-<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>nlme</span>)
-<span class='no'>m_nlme</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span>(<span class='no'>value</span> ~ <span class='fu'>nlme_f</span>(<span class='no'>name</span>, <span class='no'>time</span>, <span class='no'>parent_0</span>, <span class='no'>log_k_parent_sink</span>),
- <span class='kw'>data</span> <span class='kw'>=</span> <span class='no'>grouped_data</span>,
- <span class='kw'>fixed</span> <span class='kw'>=</span> <span class='no'>parent_0</span> + <span class='no'>log_k_parent_sink</span> ~ <span class='fl'>1</span>,
- <span class='kw'>random</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/pdDiag.html'>pdDiag</a></span>(<span class='no'>parent_0</span> + <span class='no'>log_k_parent_sink</span> ~ <span class='fl'>1</span>),
- <span class='kw'>start</span> <span class='kw'>=</span> <span class='no'>mean_dp</span>)
-<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>m_nlme</span>)</div><div class='output co'>#&gt; Nonlinear mixed-effects model fit by maximum likelihood
+<span class='fu'><a href='https://rdrr.io/r/base/assign.html'>assign</a></span><span class='op'>(</span><span class='st'>"nlme_f"</span>, <span class='va'>nlme_f</span>, <span class='fu'><a href='https://rdrr.io/r/base/environment.html'>globalenv</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span>
+<span class='fu'><a href='https://rdrr.io/r/base/assign.html'>assign</a></span><span class='op'>(</span><span class='st'>"grouped_data"</span>, <span class='va'>grouped_data</span>, <span class='fu'><a href='https://rdrr.io/r/base/environment.html'>globalenv</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span>
+
+<span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'><a href='https://svn.r-project.org/R-packages/trunk/nlme/'>nlme</a></span><span class='op'>)</span>
+<span class='va'>m_nlme</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>value</span> <span class='op'>~</span> <span class='fu'>nlme_f</span><span class='op'>(</span><span class='va'>name</span>, <span class='va'>time</span>, <span class='va'>parent_0</span>, <span class='va'>log_k_parent_sink</span><span class='op'>)</span>,
+ data <span class='op'>=</span> <span class='va'>grouped_data</span>,
+ fixed <span class='op'>=</span> <span class='va'>parent_0</span> <span class='op'>+</span> <span class='va'>log_k_parent_sink</span> <span class='op'>~</span> <span class='fl'>1</span>,
+ random <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/pdDiag.html'>pdDiag</a></span><span class='op'>(</span><span class='va'>parent_0</span> <span class='op'>+</span> <span class='va'>log_k_parent_sink</span> <span class='op'>~</span> <span class='fl'>1</span><span class='op'>)</span>,
+ start <span class='op'>=</span> <span class='va'>mean_dp</span><span class='op'>)</span>
+<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>m_nlme</span><span class='op'>)</span>
+</div><div class='output co'>#&gt; Nonlinear mixed-effects model fit by maximum likelihood
#&gt; Model: value ~ nlme_f(name, time, parent_0, log_k_parent_sink)
#&gt; Data: grouped_data
#&gt; AIC BIC logLik
-#&gt; 252.7798 262.1358 -121.3899
+#&gt; 298.2781 307.7372 -144.1391
#&gt;
#&gt; Random effects:
#&gt; Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1)
#&gt; Level: ds
#&gt; Structure: Diagonal
-#&gt; parent_0 log_k_parent_sink Residual
-#&gt; StdDev: 0.0006768135 0.6800777 2.489397
+#&gt; parent_0 log_k_parent_sink Residual
+#&gt; StdDev: 0.9374733 0.7098105 3.83543
#&gt;
#&gt; Fixed effects: parent_0 + log_k_parent_sink ~ 1
-#&gt; Value Std.Error DF t-value p-value
-#&gt; parent_0 101.74884 0.6456014 44 157.60321 0
-#&gt; log_k_parent_sink -3.05575 0.4015811 44 -7.60929 0
+#&gt; Value Std.Error DF t-value p-value
+#&gt; parent_0 101.76838 1.1445444 45 88.91606 0
+#&gt; log_k_parent_sink -3.05444 0.4195622 45 -7.28008 0
#&gt; Correlation:
#&gt; prnt_0
-#&gt; log_k_parent_sink 0.026
+#&gt; log_k_parent_sink 0.034
#&gt;
#&gt; Standardized Within-Group Residuals:
#&gt; Min Q1 Med Q3 Max
-#&gt; -2.1317488 -0.6878121 0.0828385 0.8592270 2.9529864
+#&gt; -2.6169360 -0.2185329 0.0574070 0.5720937 3.0459868
#&gt;
-#&gt; Number of Observations: 48
-#&gt; Number of Groups: 3 </div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/plot.html'>plot</a></span>(<span class='fu'><a href='https://rdrr.io/pkg/nlme/man/augPred.html'>augPred</a></span>(<span class='no'>m_nlme</span>, <span class='kw'>level</span> <span class='kw'>=</span> <span class='fl'>0</span>:<span class='fl'>1</span>), <span class='kw'>layout</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>3</span>, <span class='fl'>1</span>))</div><div class='img'><img src='nlme-1.png' alt='' width='700' height='433' /></div><div class='input'># augPred does not seem to work on fits with more than one state
-# variable
-
+#&gt; Number of Observations: 49
+#&gt; Number of Groups: 3 </div><div class='input'><span class='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/pkg/nlme/man/augPred.html'>augPred</a></span><span class='op'>(</span><span class='va'>m_nlme</span>, level <span class='op'>=</span> <span class='fl'>0</span><span class='op'>:</span><span class='fl'>1</span><span class='op'>)</span>, layout <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='fl'>3</span>, <span class='fl'>1</span><span class='op'>)</span><span class='op'>)</span>
+</div><div class='img'><img src='nlme-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='co'># augPred does not work on fits with more than one state</span>
+<span class='co'># variable</span>
+<span class='co'>#</span>
+<span class='co'># The procedure is greatly simplified by the nlme.mmkin function</span>
+<span class='va'>f_nlme</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f</span><span class='op'>)</span>
+<span class='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span><span class='va'>f_nlme</span><span class='op'>)</span>
+</div><div class='img'><img src='nlme-2.png' alt='' width='700' height='433' /></div><div class='input'>
</div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
@@ -266,7 +272,7 @@ nlme for the case of a single grouping variable ds.</p>
</div>
<div class="pkgdown">
- <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
+ <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p>
</div>
</footer>
diff --git a/docs/dev/reference/nlme.mmkin-1.png b/docs/dev/reference/nlme.mmkin-1.png
index d0a1d7d4..04d8b234 100644
--- a/docs/dev/reference/nlme.mmkin-1.png
+++ b/docs/dev/reference/nlme.mmkin-1.png
Binary files differ
diff --git a/docs/dev/reference/nlme.mmkin-2.png b/docs/dev/reference/nlme.mmkin-2.png
index b68dc3e0..c314c149 100644
--- a/docs/dev/reference/nlme.mmkin-2.png
+++ b/docs/dev/reference/nlme.mmkin-2.png
Binary files differ
diff --git a/docs/dev/reference/nlme.mmkin-3.png b/docs/dev/reference/nlme.mmkin-3.png
index 77804b2c..281d6024 100644
--- a/docs/dev/reference/nlme.mmkin-3.png
+++ b/docs/dev/reference/nlme.mmkin-3.png
Binary files differ
diff --git a/docs/dev/reference/nlme.mmkin-4.png b/docs/dev/reference/nlme.mmkin-4.png
index 96717087..d504e8f0 100644
--- a/docs/dev/reference/nlme.mmkin-4.png
+++ b/docs/dev/reference/nlme.mmkin-4.png
Binary files differ
diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html
index 3c84abe2..90aec9be 100644
--- a/docs/dev/reference/nlme.mmkin.html
+++ b/docs/dev/reference/nlme.mmkin.html
@@ -152,7 +152,7 @@ have been obtained by fitting the same model to a list of datasets.</p>
</div>
<pre class="usage"><span class='co'># S3 method for mmkin</span>
-<span class='fu'>nlme</span><span class='op'>(</span>
+<span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span>
<span class='va'>model</span>,
data <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/sys.parent.html'>sys.frame</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/sys.parent.html'>sys.parent</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span>,
<span class='va'>fixed</span>,
@@ -291,7 +291,8 @@ with additional elements</p>
</div><div class='output co'>#&gt; $distimes
#&gt; DT50 DT90 DT50back DT50_k1 DT50_k2
#&gt; parent 10.79857 100.7937 30.34193 4.193938 43.85443
-#&gt; </div><div class='input'><span class='co'># \dontrun{</span>
+#&gt; </div><div class='input'>
+<span class='co'># \dontrun{</span>
<span class='va'>f_nlme_2</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f</span><span class='op'>[</span><span class='st'>"SFO"</span>, <span class='op'>]</span>, start <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>parent_0 <span class='op'>=</span> <span class='fl'>100</span>, log_k_parent <span class='op'>=</span> <span class='fl'>0.1</span><span class='op'>)</span><span class='op'>)</span>
<span class='fu'><a href='https://rdrr.io/r/stats/update.html'>update</a></span><span class='op'>(</span><span class='va'>f_nlme_2</span>, random <span class='op'>=</span> <span class='va'>parent_0</span> <span class='op'>~</span> <span class='fl'>1</span><span class='op'>)</span>
</div><div class='output co'>#&gt; Nonlinear mixed-effects model fit by maximum likelihood
@@ -416,7 +417,8 @@ with additional elements</p>
#&gt; const prop
#&gt; 2.23222625 0.01262414
#&gt; Number of Observations: 90
-#&gt; Number of Groups: 5 </div><div class='input'> <span class='va'>f_2_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='st'>"SFO-SFO"</span> <span class='op'>=</span> <span class='va'>m_sfo_sfo</span>,
+#&gt; Number of Groups: 5 </div><div class='input'>
+ <span class='va'>f_2_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='st'>"SFO-SFO"</span> <span class='op'>=</span> <span class='va'>m_sfo_sfo</span>,
<span class='st'>"DFOP-SFO"</span> <span class='op'>=</span> <span class='va'>m_dfop_sfo</span><span class='op'>)</span>,
<span class='va'>ds_2</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"obs"</span><span class='op'>)</span>
<span class='va'>f_nlme_sfo_sfo_obs</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f_2_obs</span><span class='op'>[</span><span class='st'>"SFO-SFO"</span>, <span class='op'>]</span><span class='op'>)</span>
diff --git a/docs/dev/reference/plot.nlme.mmkin-2.png b/docs/dev/reference/plot.nlme.mmkin-2.png
index 4ec26146..7b59b947 100644
--- a/docs/dev/reference/plot.nlme.mmkin-2.png
+++ b/docs/dev/reference/plot.nlme.mmkin-2.png
Binary files differ
diff --git a/docs/dev/reference/plot.nlme.mmkin.html b/docs/dev/reference/plot.nlme.mmkin.html
index c633e15a..afd9d8d0 100644
--- a/docs/dev/reference/plot.nlme.mmkin.html
+++ b/docs/dev/reference/plot.nlme.mmkin.html
@@ -151,17 +151,16 @@
<span class='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span>
<span class='va'>x</span>,
i <span class='op'>=</span> <span class='fl'>1</span><span class='op'>:</span><span class='fu'><a href='https://rdrr.io/r/base/nrow.html'>ncol</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>$</span><span class='va'>mmkin_orig</span><span class='op'>)</span>,
- main <span class='op'>=</span> <span class='cn'>NULL</span>,
obs_vars <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/names.html'>names</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>$</span><span class='va'>mkinmod</span><span class='op'>$</span><span class='va'>map</span><span class='op'>)</span>,
standardized <span class='op'>=</span> <span class='cn'>TRUE</span>,
xlab <span class='op'>=</span> <span class='st'>"Time"</span>,
xlim <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/range.html'>range</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>$</span><span class='va'>data</span><span class='op'>$</span><span class='va'>time</span><span class='op'>)</span>,
- legends <span class='op'>=</span> <span class='fl'>1</span>,
- lpos <span class='op'>=</span> <span class='st'>"topright"</span>,
- inset <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='fl'>0.05</span>, <span class='fl'>0.05</span><span class='op'>)</span>,
resplot <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"predicted"</span>, <span class='st'>"time"</span><span class='op'>)</span>,
ymax <span class='op'>=</span> <span class='st'>"auto"</span>,
maxabs <span class='op'>=</span> <span class='st'>"auto"</span>,
+ ncol.legend <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/ifelse.html'>ifelse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/length.html'>length</a></span><span class='op'>(</span><span class='va'>i</span><span class='op'>)</span> <span class='op'>&lt;=</span> <span class='fl'>3</span>, <span class='fu'><a href='https://rdrr.io/r/base/length.html'>length</a></span><span class='op'>(</span><span class='va'>i</span><span class='op'>)</span> <span class='op'>+</span> <span class='fl'>1</span>, <span class='fu'><a href='https://rdrr.io/r/base/ifelse.html'>ifelse</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/length.html'>length</a></span><span class='op'>(</span><span class='va'>i</span><span class='op'>)</span> <span class='op'>&lt;=</span> <span class='fl'>8</span>, <span class='fl'>3</span>, <span class='fl'>4</span><span class='op'>)</span><span class='op'>)</span>,
+ nrow.legend <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/Round.html'>ceiling</a></span><span class='op'>(</span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/length.html'>length</a></span><span class='op'>(</span><span class='va'>i</span><span class='op'>)</span> <span class='op'>+</span> <span class='fl'>1</span><span class='op'>)</span><span class='op'>/</span><span class='va'>ncol.legend</span><span class='op'>)</span>,
+ rel.height.legend <span class='op'>=</span> <span class='fl'>0.03</span> <span class='op'>+</span> <span class='fl'>0.08</span> <span class='op'>*</span> <span class='va'>nrow.legend</span>,
rel.height.bottom <span class='op'>=</span> <span class='fl'>1.1</span>,
pch_ds <span class='op'>=</span> <span class='fl'>1</span><span class='op'>:</span><span class='fu'><a href='https://rdrr.io/r/base/length.html'>length</a></span><span class='op'>(</span><span class='va'>i</span><span class='op'>)</span>,
col_ds <span class='op'>=</span> <span class='va'>pch_ds</span> <span class='op'>+</span> <span class='fl'>1</span>,
@@ -183,10 +182,6 @@
in case plots get too large</p></td>
</tr>
<tr>
- <th>main</th>
- <td><p>The main title placed on the outer margin of the plot.</p></td>
- </tr>
- <tr>
<th>obs_vars</th>
<td><p>A character vector of names of the observed variables for
which the data and the model should be plotted. Defauls to all observed
@@ -206,20 +201,6 @@ variables in the model.</p></td>
<td><p>Plot range in x direction.</p></td>
</tr>
<tr>
- <th>legends</th>
- <td><p>An index for the fits for which legends should be shown.</p></td>
- </tr>
- <tr>
- <th>lpos</th>
- <td><p>Position(s) of the legend(s). Passed to <code><a href='https://rdrr.io/r/graphics/legend.html'>legend</a></code> as
-the first argument. If not length one, this should be of the same length
-as the obs_var argument.</p></td>
- </tr>
- <tr>
- <th>inset</th>
- <td><p>Passed to <code><a href='https://rdrr.io/r/graphics/legend.html'>legend</a></code> if applicable.</p></td>
- </tr>
- <tr>
<th>resplot</th>
<td><p>Should the residuals plotted against time or against
predicted values?</p></td>
@@ -234,6 +215,10 @@ predicted values?</p></td>
scaling of the y axis and defaults to "auto".</p></td>
</tr>
<tr>
+ <th>rel.height.legend</th>
+ <td><p>The relative height of the legend shown on top</p></td>
+ </tr>
+ <tr>
<th>rel.height.bottom</th>
<td><p>The relative height of the bottom plot row</p></td>
</tr>
@@ -276,7 +261,8 @@ corresponding model prediction lines for the different datasets.</p></td>
A1 <span class='op'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span><span class='op'>)</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='va'>f</span> <span class='op'>&lt;-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='st'>"DFOP-SFO"</span> <span class='op'>=</span> <span class='va'>dfop_sfo</span><span class='op'>)</span>, <span class='va'>ds</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, cores <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span>
<span class='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span><span class='va'>f</span><span class='op'>[</span>, <span class='fl'>3</span><span class='op'>:</span><span class='fl'>4</span><span class='op'>]</span>, standardized <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
-</div><div class='img'><img src='plot.nlme.mmkin-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'><a href='https://svn.r-project.org/R-packages/trunk/nlme/'>nlme</a></span><span class='op'>)</span>
+</div><div class='img'><img src='plot.nlme.mmkin-1.png' alt='' width='700' height='433' /></div><div class='input'>
+<span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'><a href='https://svn.r-project.org/R-packages/trunk/nlme/'>nlme</a></span><span class='op'>)</span>
<span class='co'># For this fit we need to increase pnlsMaxiter, and we increase the</span>
<span class='co'># tolerance in order to speed up the fit for this example evaluation</span>
<span class='va'>f_nlme</span> <span class='op'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f</span>, control <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span>pnlsMaxIter <span class='op'>=</span> <span class='fl'>120</span>, tolerance <span class='op'>=</span> <span class='fl'>1e-3</span><span class='op'>)</span><span class='op'>)</span>
diff --git a/man/nlme.Rd b/man/nlme.Rd
index 2ee2a20c..df721a0f 100644
--- a/man/nlme.Rd
+++ b/man/nlme.Rd
@@ -72,8 +72,12 @@ m_nlme <- nlme(value ~ nlme_f(name, time, parent_0, log_k_parent_sink),
start = mean_dp)
summary(m_nlme)
plot(augPred(m_nlme, level = 0:1), layout = c(3, 1))
-# augPred does not seem to work on fits with more than one state
+# augPred does not work on fits with more than one state
# variable
+#
+# The procedure is greatly simplified by the nlme.mmkin function
+f_nlme <- nlme(f)
+plot(f_nlme)
}
\seealso{
diff --git a/man/nlme.mmkin.Rd b/man/nlme.mmkin.Rd
index 87d84c74..041b939a 100644
--- a/man/nlme.mmkin.Rd
+++ b/man/nlme.mmkin.Rd
@@ -85,6 +85,7 @@ AIC(f_nlme_sfo, f_nlme_dfop)
print(f_nlme_dfop)
plot(f_nlme_dfop)
endpoints(f_nlme_dfop)
+
\dontrun{
f_nlme_2 <- nlme(f["SFO", ], start = c(parent_0 = 100, log_k_parent = 0.1))
update(f_nlme_2, random = parent_0 ~ 1)
@@ -131,6 +132,7 @@ endpoints(f_nlme_dfop)
AIC(f_nlme_sfo, f_nlme_sfo_tc, f_nlme_dfop, f_nlme_dfop_tc)
print(f_nlme_dfop_tc)
}
+
f_2_obs <- mmkin(list("SFO-SFO" = m_sfo_sfo,
"DFOP-SFO" = m_dfop_sfo),
ds_2, quiet = TRUE, error_model = "obs")
diff --git a/man/plot.nlme.mmkin.Rd b/man/plot.nlme.mmkin.Rd
index 5f6e4ed3..6944d4b1 100644
--- a/man/plot.nlme.mmkin.Rd
+++ b/man/plot.nlme.mmkin.Rd
@@ -7,17 +7,16 @@
\method{plot}{nlme.mmkin}(
x,
i = 1:ncol(x$mmkin_orig),
- main = NULL,
obs_vars = names(x$mkinmod$map),
standardized = TRUE,
xlab = "Time",
xlim = range(x$data$time),
- legends = 1,
- lpos = "topright",
- inset = c(0.05, 0.05),
resplot = c("predicted", "time"),
ymax = "auto",
maxabs = "auto",
+ ncol.legend = ifelse(length(i) <= 3, length(i) + 1, ifelse(length(i) <= 8, 3, 4)),
+ nrow.legend = ceiling((length(i) + 1)/ncol.legend),
+ rel.height.legend = 0.03 + 0.08 * nrow.legend,
rel.height.bottom = 1.1,
pch_ds = 1:length(i),
col_ds = pch_ds + 1,
@@ -32,8 +31,6 @@
\item{i}{A numeric index to select datasets for which to plot the nlme fit,
in case plots get too large}
-\item{main}{The main title placed on the outer margin of the plot.}
-
\item{obs_vars}{A character vector of names of the observed variables for
which the data and the model should be plotted. Defauls to all observed
variables in the model.}
@@ -45,14 +42,6 @@ variables in the model.}
\item{xlim}{Plot range in x direction.}
-\item{legends}{An index for the fits for which legends should be shown.}
-
-\item{lpos}{Position(s) of the legend(s). Passed to \code{\link{legend}} as
-the first argument. If not length one, this should be of the same length
-as the obs_var argument.}
-
-\item{inset}{Passed to \code{\link{legend}} if applicable.}
-
\item{resplot}{Should the residuals plotted against time or against
predicted values?}
@@ -61,6 +50,8 @@ predicted values?}
\item{maxabs}{Maximum absolute value of the residuals. This is used for the
scaling of the y axis and defaults to "auto".}
+\item{rel.height.legend}{The relative height of the legend shown on top}
+
\item{rel.height.bottom}{The relative height of the bottom plot row}
\item{pch_ds}{Symbols to be used for plotting the data.}
@@ -89,6 +80,7 @@ dfop_sfo <- mkinmod(parent = mkinsub("DFOP", "A1"),
A1 = mkinsub("SFO"), quiet = TRUE)
f <- mmkin(list("DFOP-SFO" = dfop_sfo), ds, quiet = TRUE, cores = 1)
plot(f[, 3:4], standardized = TRUE)
+
library(nlme)
# For this fit we need to increase pnlsMaxiter, and we increase the
# tolerance in order to speed up the fit for this example evaluation

Contact - Imprint