aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--R/nlme.R67
-rw-r--r--docs/404.html2
-rw-r--r--docs/articles/index.html2
-rw-r--r--docs/authors.html2
-rw-r--r--docs/index.html2
-rw-r--r--docs/news/index.html2
-rw-r--r--docs/reference/endpoints.html2
-rw-r--r--docs/reference/index.html4
-rw-r--r--docs/reference/mkinds.html2
-rw-r--r--docs/reference/mmkin.html14
-rw-r--r--docs/reference/nlme.html114
-rw-r--r--docs/reference/plot.mmkin.html2
-rw-r--r--docs/reference/print.mkinds.html2
-rw-r--r--man/nlme.Rd18
15 files changed, 162 insertions, 75 deletions
diff --git a/.travis.yml b/.travis.yml
index 172d0236..0d180f7e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ addons:
apt:
packages:
- gcc
-github_packages:
+r_github_packages:
- r-lib/covr
script:
- |
diff --git a/R/nlme.R b/R/nlme.R
index b17fe15a..79e4e9c1 100644
--- a/R/nlme.R
+++ b/R/nlme.R
@@ -1,14 +1,12 @@
#' Estimation of parameter distributions from mmkin row objects
#'
-#' This function sets up and attempts to fit a mixed effects model to
+#' These functions facilitate setting up a nonlinear mixed effects model for
#' an mmkin row object. An mmkin row object is essentially a list of mkinfit
#' objects that have been obtained by fitting the same model to a list of
#' datasets.
#'
#' @param object An mmkin row object containing several fits of the same model to different datasets
#' @import nlme
-#' @importFrom purrr map_dfr
-#' @return A named vector containing mean values of the fitted degradation model parameters
#' @rdname nlme
#' @examples
#' sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
@@ -45,7 +43,7 @@
#' summary(m_nlme)
#'
#' \dontrun{
-#' Test on some real data
+#' # Test on some real data
#' ds_2 <- lapply(experimental_data_for_UBA_2019[6:10],
#' function(x) x$data[c("name", "time", "value")])
#' m_sfo_sfo <- mkinmod(parent = mkinsub("SFO", "A1"),
@@ -113,36 +111,7 @@
#'
#' anova(f_nlme_fomc_sfo, f_nlme_sfo_sfo)
#' }
-#' @export
-mean_degparms <- function(object) {
- if (nrow(object) > 1) stop("Only row objects allowed")
- p_mat_start_trans <- sapply(object, parms, transformed = TRUE)
- mean_degparm_names <- setdiff(rownames(p_mat_start_trans), names(object[[1]]$errparms))
- res <- apply(p_mat_start_trans[mean_degparm_names, ], 1, mean)
- return(res)
-}
-
-#' @rdname nlme
-#' @importFrom purrr map_dfr
-#' @return A groupedData data object
-#' @export
-nlme_data <- function(object) {
- if (nrow(object) > 1) stop("Only row objects allowed")
- ds_names <- colnames(object)
-
- ds_list <- lapply(object, function(x) x$data[c("time", "variable", "observed")])
- names(ds_list) <- ds_names
- ds_nlme <- purrr::map_dfr(ds_list, function(x) x, .id = "ds")
- ds_nlme$variable <- as.character(ds_nlme$variable)
- ds_nlme_renamed <- data.frame(ds = ds_nlme$ds, name = ds_nlme$variable,
- time = ds_nlme$time, value = ds_nlme$observed,
- stringsAsFactors = FALSE)
- ds_nlme_grouped <- groupedData(value ~ time | ds, ds_nlme_renamed)
- return(ds_nlme_grouped)
-}
-
-#' @rdname nlme
-#' @return A function that can be used with nlme
+#' @return A function that can be used with \code{link{nlme}}
#' @export
nlme_function <- function(object) {
if (nrow(object) > 1) stop("Only row objects allowed")
@@ -211,3 +180,33 @@ nlme_function <- function(object) {
model_function <- as.function(c(model_function_alist, model_function_body))
return(model_function)
}
+
+#' @rdname nlme
+#' @return A named vector containing mean values of the fitted degradation model parameters
+#' @export
+mean_degparms <- function(object) {
+ if (nrow(object) > 1) stop("Only row objects allowed")
+ degparm_mat_trans <- sapply(object, parms, transformed = TRUE)
+ mean_degparm_names <- setdiff(rownames(degparm_mat_trans), names(object[[1]]$errparms))
+ res <- apply(degparm_mat_trans[mean_degparm_names, ], 1, mean)
+ return(res)
+}
+
+#' @rdname nlme
+#' @importFrom purrr map_dfr
+#' @return A \code{\link{groupedData}} object
+#' @export
+nlme_data <- function(object) {
+ if (nrow(object) > 1) stop("Only row objects allowed")
+ ds_names <- colnames(object)
+
+ ds_list <- lapply(object, function(x) x$data[c("time", "variable", "observed")])
+ names(ds_list) <- ds_names
+ ds_nlme <- purrr::map_dfr(ds_list, function(x) x, .id = "ds")
+ ds_nlme$variable <- as.character(ds_nlme$variable)
+ ds_nlme_renamed <- data.frame(ds = ds_nlme$ds, name = ds_nlme$variable,
+ time = ds_nlme$time, value = ds_nlme$observed,
+ stringsAsFactors = FALSE)
+ ds_nlme_grouped <- groupedData(value ~ time | ds, ds_nlme_renamed)
+ return(ds_nlme_grouped)
+}
diff --git a/docs/404.html b/docs/404.html
index 3658a137..dc3c3c18 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -67,7 +67,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://pkgdown.jrwb.de/mkin/index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
diff --git a/docs/articles/index.html b/docs/articles/index.html
index 3e181a2c..4a5087df 100644
--- a/docs/articles/index.html
+++ b/docs/articles/index.html
@@ -67,7 +67,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
diff --git a/docs/authors.html b/docs/authors.html
index 2bb2557a..20c040f9 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -67,7 +67,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
diff --git a/docs/index.html b/docs/index.html
index fe334eb8..7cf11e5c 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -37,7 +37,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
diff --git a/docs/news/index.html b/docs/news/index.html
index cb5e6df3..c8d7ce3d 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -67,7 +67,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
diff --git a/docs/reference/endpoints.html b/docs/reference/endpoints.html
index f201294d..68af5fcf 100644
--- a/docs/reference/endpoints.html
+++ b/docs/reference/endpoints.html
@@ -75,7 +75,7 @@ advantage that the SFORB model can also be used for metabolites." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
diff --git a/docs/reference/index.html b/docs/reference/index.html
index a3547e29..31f7678c 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -67,7 +67,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
@@ -273,7 +273,7 @@ of an mmkin object</p></td>
</tr><tr>
<td>
- <p><code><a href="nlme.html">mean_degparms()</a></code> <code><a href="nlme.html">nlme_data()</a></code> <code><a href="nlme.html">nlme_function()</a></code> </p>
+ <p><code><a href="nlme.html">nlme_function()</a></code> <code><a href="nlme.html">mean_degparms()</a></code> <code><a href="nlme.html">nlme_data()</a></code> </p>
</td>
<td><p>Estimation of parameter distributions from mmkin row objects</p></td>
</tr>
diff --git a/docs/reference/mkinds.html b/docs/reference/mkinds.html
index ef6fb35c..946d40a6 100644
--- a/docs/reference/mkinds.html
+++ b/docs/reference/mkinds.html
@@ -72,7 +72,7 @@ provided by this package come as mkinds objects nevertheless." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
diff --git a/docs/reference/mmkin.html b/docs/reference/mmkin.html
index 8e1ea54f..c1f62be7 100644
--- a/docs/reference/mmkin.html
+++ b/docs/reference/mmkin.html
@@ -72,7 +72,7 @@ datasets specified in its first two arguments." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
@@ -183,8 +183,9 @@ for parallel execution.</p></td>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
- <p>A matrix of <code><a href='mkinfit.html'>mkinfit</a></code> objects that can be indexed using
- the model and dataset names as row and column indices.</p>
+ <p>A two-dimensional <code><a href='https://rdrr.io/r/base/array.html'>array</a></code> of <code><a href='mkinfit.html'>mkinfit</a></code>
+ objects that can be indexed using the model names for the first index (row index)
+ and the dataset names for the second index (column index).</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='Extract.mmkin.html'>[.mmkin</a></code> for subsetting, <code><a href='plot.mmkin.html'>plot.mmkin</a></code> for
@@ -207,15 +208,12 @@ for parallel execution.</p></td>
<span class='no'>time_1</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/system.time.html'>system.time</a></span>(<span class='no'>fits.4</span> <span class='kw'>&lt;-</span> <span class='fu'>mmkin</span>(<span class='no'>models</span>, <span class='no'>datasets</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'>time_default</span></div><div class='output co'>#&gt; User System verstrichen
-#&gt; 18.739 0.379 6.198 </div><div class='input'><span class='no'>time_1</span></div><div class='output co'>#&gt; User System verstrichen
-#&gt; 19.910 0.000 19.925 </div><div class='input'>
+#&gt; 16.471 0.352 5.654 </div><div class='input'><span class='no'>time_1</span></div><div class='output co'>#&gt; User System verstrichen
+#&gt; 19.578 0.000 19.590 </div><div class='input'>
<span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fits.0</span><span class='kw'>[[</span><span class='st'>"SFO_lin"</span>, <span class='fl'>2</span>]])</div><div class='output co'>#&gt; $ff
#&gt; parent_M1 parent_sink M1_M2 M1_sink
#&gt; 0.7340480 0.2659520 0.7505686 0.2494314
#&gt;
-#&gt; $SFORB
-#&gt; logical(0)
-#&gt;
#&gt; $distimes
#&gt; DT50 DT90
#&gt; parent 0.8777689 2.915885
diff --git a/docs/reference/nlme.html b/docs/reference/nlme.html
index b939d1c3..696916a0 100644
--- a/docs/reference/nlme.html
+++ b/docs/reference/nlme.html
@@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<title>Estimation of parameter distributions from mmkin row objects — mean_degparms • mkin</title>
+<title>Estimation of parameter distributions from mmkin row objects — nlme_function • mkin</title>
<!-- jquery -->
@@ -35,8 +35,8 @@
-<meta property="og:title" content="Estimation of parameter distributions from mmkin row objects — mean_degparms" />
-<meta property="og:description" content="This function sets up and attempts to fit a mixed effects model to
+<meta property="og:title" content="Estimation of parameter distributions from mmkin row objects — nlme_function" />
+<meta property="og:description" content="These functions facilitate setting up a nonlinear mixed effects model for
an mmkin row object. An mmkin row object is essentially a list of mkinfit
objects that have been obtained by fitting the same model to a list of
datasets." />
@@ -72,7 +72,7 @@ datasets." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
@@ -136,17 +136,17 @@ datasets." />
</div>
<div class="ref-description">
- <p>This function sets up and attempts to fit a mixed effects model to
+ <p>These functions facilitate setting up a nonlinear mixed effects model for
an mmkin row object. An mmkin row object is essentially a list of mkinfit
objects that have been obtained by fitting the same model to a list of
datasets.</p>
</div>
- <pre class="usage"><span class='fu'>mean_degparms</span>(<span class='no'>object</span>)
+ <pre class="usage"><span class='fu'>nlme_function</span>(<span class='no'>object</span>)
-<span class='fu'>nlme_data</span>(<span class='no'>object</span>)
+<span class='fu'>mean_degparms</span>(<span class='no'>object</span>)
-<span class='fu'>nlme_function</span>(<span class='no'>object</span>)</pre>
+<span class='fu'>nlme_data</span>(<span class='no'>object</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
@@ -159,12 +159,102 @@ datasets.</p>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
- <p>A named vector containing mean values of the fitted degradation model parameters</p>
-<p>A groupedData data object</p>
-<p>A function that can be used with nlme</p>
+ <p>A function that can be used with <code>link{nlme}</code></p>
+<p>A named vector containing mean values of the fitted degradation model parameters</p>
+<p>A <code><a href='https://rdrr.io/pkg/nlme/man/groupedData.html'>groupedData</a></code> object</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
- <pre class="examples"></pre>
+ <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_sink</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_sink</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_sink</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>)
+
+<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>)</div><div class='output co'>#&gt; <span class='error'>Error in nlme_f(name, time, parent_0, log_k_parent_sink): konnte Funktion "nlme_f" nicht finden</span></div><div class='input'><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; <span class='error'>Error in summary(m_nlme): Objekt 'm_nlme' nicht gefunden</span></div><div class='input'>
+<span class='co'># \dontrun{</span>
+ <span class='co'># Test on some real data</span>
+ <span class='no'>ds_2</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>lapply</a></span>(<span class='no'>experimental_data_for_UBA_2019</span>[<span class='fl'>6</span>:<span class='fl'>10</span>],
+ <span class='kw'>function</span>(<span class='no'>x</span>) <span class='no'>x</span>$<span class='no'>data</span>[<span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"name"</span>, <span class='st'>"time"</span>, <span class='st'>"value"</span>)])
+ <span class='no'>m_sfo_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='st'>"A1"</span>),
+ <span class='kw'>A1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>), <span class='kw'>use_of_ff</span> <span class='kw'>=</span> <span class='st'>"min"</span>)</div><div class='output co'>#&gt; <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'> <span class='no'>m_sfo_sfo_ff</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='st'>"A1"</span>),
+ <span class='kw'>A1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>), <span class='kw'>use_of_ff</span> <span class='kw'>=</span> <span class='st'>"max"</span>)</div><div class='output co'>#&gt; <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'> <span class='no'>m_fomc_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'>"FOMC"</span>, <span class='st'>"A1"</span>),
+ <span class='kw'>A1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>))</div><div class='output co'>#&gt; <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'> <span class='no'>m_dfop_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'>"DFOP"</span>, <span class='st'>"A1"</span>),
+ <span class='kw'>A1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>))</div><div class='output co'>#&gt; <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'> <span class='no'>m_sforb_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'>"SFORB"</span>, <span class='st'>"A1"</span>),
+ <span class='kw'>A1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>))</div><div class='output co'>#&gt; <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'>
+ <span class='no'>f_2</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='st'>"SFO-SFO"</span> <span class='kw'>=</span> <span class='no'>m_sfo_sfo</span>,
+ <span class='st'>"SFO-SFO-ff"</span> <span class='kw'>=</span> <span class='no'>m_sfo_sfo_ff</span>,
+ <span class='st'>"FOMC-SFO"</span> <span class='kw'>=</span> <span class='no'>m_fomc_sfo</span>,
+ <span class='st'>"DFOP-SFO"</span> <span class='kw'>=</span> <span class='no'>m_dfop_sfo</span>,
+ <span class='st'>"SFORB-SFO"</span> <span class='kw'>=</span> <span class='no'>m_sforb_sfo</span>),
+ <span class='no'>ds_2</span>)
+
+ <span class='no'>grouped_data_2</span> <span class='kw'>&lt;-</span> <span class='fu'>nlme_data</span>(<span class='no'>f_2</span>[<span class='st'>"SFO-SFO"</span>, ])
+
+ <span class='no'>mean_dp_sfo_sfo</span> <span class='kw'>&lt;-</span> <span class='fu'>mean_degparms</span>(<span class='no'>f_2</span>[<span class='st'>"SFO-SFO"</span>, ])
+ <span class='no'>mean_dp_sfo_sfo_ff</span> <span class='kw'>&lt;-</span> <span class='fu'>mean_degparms</span>(<span class='no'>f_2</span>[<span class='st'>"SFO-SFO-ff"</span>, ])
+ <span class='no'>mean_dp_fomc_sfo</span> <span class='kw'>&lt;-</span> <span class='fu'>mean_degparms</span>(<span class='no'>f_2</span>[<span class='st'>"FOMC-SFO"</span>, ])
+ <span class='no'>mean_dp_dfop_sfo</span> <span class='kw'>&lt;-</span> <span class='fu'>mean_degparms</span>(<span class='no'>f_2</span>[<span class='st'>"DFOP-SFO"</span>, ])
+ <span class='no'>mean_dp_sforb_sfo</span> <span class='kw'>&lt;-</span> <span class='fu'>mean_degparms</span>(<span class='no'>f_2</span>[<span class='st'>"SFORB-SFO"</span>, ])
+
+ <span class='no'>nlme_f_sfo_sfo</span> <span class='kw'>&lt;-</span> <span class='fu'>nlme_function</span>(<span class='no'>f_2</span>[<span class='st'>"SFO-SFO"</span>, ])
+ <span class='no'>nlme_f_sfo_sfo_ff</span> <span class='kw'>&lt;-</span> <span class='fu'>nlme_function</span>(<span class='no'>f_2</span>[<span class='st'>"SFO-SFO-ff"</span>, ])
+ <span class='no'>nlme_f_fomc_sfo</span> <span class='kw'>&lt;-</span> <span class='fu'>nlme_function</span>(<span class='no'>f_2</span>[<span class='st'>"FOMC-SFO"</span>, ])
+
+ <span class='co'># Allowing for correlations between random effects leads to non-convergence</span>
+ <span class='no'>f_nlme_sfo_sfo</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_sfo_sfo</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='no'>log_k_parent_A1</span>, <span class='no'>log_k_A1_sink</span>),
+ <span class='kw'>data</span> <span class='kw'>=</span> <span class='no'>grouped_data_2</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='no'>log_k_parent_A1</span> + <span class='no'>log_k_A1_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='no'>log_k_parent_A1</span> + <span class='no'>log_k_A1_sink</span> ~ <span class='fl'>1</span>),
+ <span class='kw'>start</span> <span class='kw'>=</span> <span class='no'>mean_dp_sfo_sfo</span>)</div><div class='output co'>#&gt; <span class='error'>Error in nlme_f_sfo_sfo(name, time, parent_0, log_k_parent_sink, log_k_parent_A1, log_k_A1_sink): konnte Funktion "nlme_f_sfo_sfo" nicht finden</span></div><div class='input'>
+ <span class='co'># The same model fitted with transformed formation fractions does not converge</span>
+ <span class='no'>f_nlme_sfo_sfo_ff</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_sfo_sfo_ff</span>(<span class='no'>name</span>, <span class='no'>time</span>,
+ <span class='no'>parent_0</span>, <span class='no'>log_k_parent</span>, <span class='no'>log_k_A1</span>, <span class='no'>f_parent_ilr_1</span>),
+ <span class='kw'>data</span> <span class='kw'>=</span> <span class='no'>grouped_data_2</span>,
+ <span class='kw'>fixed</span> <span class='kw'>=</span> <span class='no'>parent_0</span> + <span class='no'>log_k_parent</span> + <span class='no'>log_k_A1</span> + <span class='no'>f_parent_ilr_1</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</span> + <span class='no'>log_k_A1</span> + <span class='no'>f_parent_ilr_1</span> ~ <span class='fl'>1</span>),
+ <span class='kw'>start</span> <span class='kw'>=</span> <span class='no'>mean_dp_sfo_sfo_ff</span>)</div><div class='output co'>#&gt; <span class='error'>Error in nlme_f_sfo_sfo_ff(name, time, parent_0, log_k_parent, log_k_A1, f_parent_ilr_1): konnte Funktion "nlme_f_sfo_sfo_ff" nicht finden</span></div><div class='input'>
+ <span class='co'># It does converge with this version of reduced random effects</span>
+ <span class='no'>f_nlme_sfo_sfo_ff</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_sfo_sfo_ff</span>(<span class='no'>name</span>, <span class='no'>time</span>,
+ <span class='no'>parent_0</span>, <span class='no'>log_k_parent</span>, <span class='no'>log_k_A1</span>, <span class='no'>f_parent_ilr_1</span>),
+ <span class='kw'>data</span> <span class='kw'>=</span> <span class='no'>grouped_data_2</span>,
+ <span class='kw'>fixed</span> <span class='kw'>=</span> <span class='no'>parent_0</span> + <span class='no'>log_k_parent</span> + <span class='no'>log_k_A1</span> + <span class='no'>f_parent_ilr_1</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</span> ~ <span class='fl'>1</span>),
+ <span class='kw'>start</span> <span class='kw'>=</span> <span class='no'>mean_dp_sfo_sfo_ff</span>)</div><div class='output co'>#&gt; <span class='error'>Error in nlme_f_sfo_sfo_ff(name, time, parent_0, log_k_parent, log_k_A1, f_parent_ilr_1): konnte Funktion "nlme_f_sfo_sfo_ff" nicht finden</span></div><div class='input'>
+ <span class='no'>f_nlme_fomc_sfo</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_fomc_sfo</span>(<span class='no'>name</span>, <span class='no'>time</span>,
+ <span class='no'>parent_0</span>, <span class='no'>log_alpha</span>, <span class='no'>log_beta</span>, <span class='no'>log_k_A1</span>, <span class='no'>f_parent_ilr_1</span>),
+ <span class='kw'>data</span> <span class='kw'>=</span> <span class='no'>grouped_data_2</span>,
+ <span class='kw'>fixed</span> <span class='kw'>=</span> <span class='no'>parent_0</span> + <span class='no'>log_alpha</span> + <span class='no'>log_beta</span> + <span class='no'>log_k_A1</span> + <span class='no'>f_parent_ilr_1</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_alpha</span> + <span class='no'>log_beta</span> + <span class='no'>log_k_A1</span> + <span class='no'>f_parent_ilr_1</span> ~ <span class='fl'>1</span>),
+ <span class='kw'>start</span> <span class='kw'>=</span> <span class='no'>mean_dp_fomc_sfo</span>)</div><div class='output co'>#&gt; <span class='error'>Error in nlme_f_fomc_sfo(name, time, parent_0, log_alpha, log_beta, log_k_A1, f_parent_ilr_1): konnte Funktion "nlme_f_fomc_sfo" nicht finden</span></div><div class='input'>
+ <span class='co'># DFOP-SFO and SFORB-SFO did not converge with full random effects</span>
+
+ <span class='fu'><a href='https://rdrr.io/r/stats/anova.html'>anova</a></span>(<span class='no'>f_nlme_fomc_sfo</span>, <span class='no'>f_nlme_sfo_sfo</span>)</div><div class='output co'>#&gt; <span class='error'>Error in anova(f_nlme_fomc_sfo, f_nlme_sfo_sfo): Objekt 'f_nlme_fomc_sfo' nicht gefunden</span></div><div class='input'># }
+</div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
diff --git a/docs/reference/plot.mmkin.html b/docs/reference/plot.mmkin.html
index be60f228..a513756b 100644
--- a/docs/reference/plot.mmkin.html
+++ b/docs/reference/plot.mmkin.html
@@ -73,7 +73,7 @@ the fit of at least one model to the same dataset is shown." />
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
diff --git a/docs/reference/print.mkinds.html b/docs/reference/print.mkinds.html
index de1a2410..824d961b 100644
--- a/docs/reference/print.mkinds.html
+++ b/docs/reference/print.mkinds.html
@@ -69,7 +69,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">mkin</a>
- <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.9</span>
+ <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.49.10</span>
</span>
</div>
diff --git a/man/nlme.Rd b/man/nlme.Rd
index e74ba16d..7527f09d 100644
--- a/man/nlme.Rd
+++ b/man/nlme.Rd
@@ -1,29 +1,29 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nlme.R
-\name{mean_degparms}
+\name{nlme_function}
+\alias{nlme_function}
\alias{mean_degparms}
\alias{nlme_data}
-\alias{nlme_function}
\title{Estimation of parameter distributions from mmkin row objects}
\usage{
+nlme_function(object)
+
mean_degparms(object)
nlme_data(object)
-
-nlme_function(object)
}
\arguments{
\item{object}{An mmkin row object containing several fits of the same model to different datasets}
}
\value{
-A named vector containing mean values of the fitted degradation model parameters
+A function that can be used with \code{link{nlme}}
-A groupedData data object
+A named vector containing mean values of the fitted degradation model parameters
-A function that can be used with nlme
+A \code{\link{groupedData}} object
}
\description{
-This function sets up and attempts to fit a mixed effects model to
+These functions facilitate setting up a nonlinear mixed effects model for
an mmkin row object. An mmkin row object is essentially a list of mkinfit
objects that have been obtained by fitting the same model to a list of
datasets.
@@ -63,7 +63,7 @@ m_nlme <- nlme(value ~ nlme_f(name, time, parent_0, log_k_parent_sink),
summary(m_nlme)
\dontrun{
- Test on some real data
+ # Test on some real data
ds_2 <- lapply(experimental_data_for_UBA_2019[6:10],
function(x) x$data[c("name", "time", "value")])
m_sfo_sfo <- mkinmod(parent = mkinsub("SFO", "A1"),

Contact - Imprint