From 26085403289e29259e500282e8e88a5ab00c07a0 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 14 Apr 2020 17:22:00 +0200 Subject: Add a nlme method for mmkin row objects --- man/nlme.Rd | 15 +++++------- man/nlme.mmkin.Rd | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 man/nlme.mmkin.Rd (limited to 'man') diff --git a/man/nlme.Rd b/man/nlme.Rd index 8e5c2aa0..971ba3f5 100644 --- a/man/nlme.Rd +++ b/man/nlme.Rd @@ -101,14 +101,19 @@ plot(augPred(m_nlme, level = 0:1), layout = c(3, 1)) nlme_f_sfo_sfo <- nlme_function(f_2["SFO-SFO", ]) nlme_f_sfo_sfo_ff <- nlme_function(f_2["SFO-SFO-ff", ]) nlme_f_fomc_sfo <- nlme_function(f_2["FOMC-SFO", ]) + assign("nlme_f_sfo_sfo", nlme_f_sfo_sfo, globalenv()) + assign("nlme_f_sfo_sfo_ff", nlme_f_sfo_sfo_ff, globalenv()) + assign("nlme_f_fomc_sfo", nlme_f_fomc_sfo, globalenv()) - # Allowing for correlations between random effects leads to non-convergence + # Allowing for correlations between random effects (not shown) + # leads to non-convergence f_nlme_sfo_sfo <- nlme(value ~ nlme_f_sfo_sfo(name, time, parent_0, log_k_parent_sink, log_k_parent_A1, log_k_A1_sink), data = grouped_data_2, fixed = parent_0 + log_k_parent_sink + log_k_parent_A1 + log_k_A1_sink ~ 1, random = pdDiag(parent_0 + log_k_parent_sink + log_k_parent_A1 + log_k_A1_sink ~ 1), start = mean_dp_sfo_sfo) + # augPred does not see to work on this object, so no plot is shown # The same model fitted with transformed formation fractions does not converge f_nlme_sfo_sfo_ff <- nlme(value ~ nlme_f_sfo_sfo_ff(name, time, @@ -118,14 +123,6 @@ plot(augPred(m_nlme, level = 0:1), layout = c(3, 1)) random = pdDiag(parent_0 + log_k_parent + log_k_A1 + f_parent_ilr_1 ~ 1), start = mean_dp_sfo_sfo_ff) - # It does converge with this version of reduced random effects - f_nlme_sfo_sfo_ff <- nlme(value ~ nlme_f_sfo_sfo_ff(name, time, - parent_0, log_k_parent, log_k_A1, f_parent_ilr_1), - data = grouped_data_2, - fixed = parent_0 + log_k_parent + log_k_A1 + f_parent_ilr_1 ~ 1, - random = pdDiag(parent_0 + log_k_parent ~ 1), - start = mean_dp_sfo_sfo_ff) - f_nlme_fomc_sfo <- nlme(value ~ nlme_f_fomc_sfo(name, time, parent_0, log_alpha, log_beta, log_k_A1, f_parent_ilr_1), data = grouped_data_2, diff --git a/man/nlme.mmkin.Rd b/man/nlme.mmkin.Rd new file mode 100644 index 00000000..5f937488 --- /dev/null +++ b/man/nlme.mmkin.Rd @@ -0,0 +1,72 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/nlme.mmkin.R +\name{nlme.mmkin} +\alias{nlme.mmkin} +\title{Create an nlme model for an mmkin row object} +\usage{ +\method{nlme}{mmkin}( + model, + data = sys.frame(sys.parent()), + fixed, + random = fixed, + groups, + start, + correlation = NULL, + weights = NULL, + subset, + method = c("ML", "REML"), + na.action = na.fail, + naPattern, + control = list(), + verbose = FALSE +) +} +\arguments{ +\item{model}{An \code{\link{mmkin}} row object.} + +\item{data}{Ignored, data are taken from the mmkin model} + +\item{fixed}{Ignored, all degradation parameters fitted in the +mmkin model are used as fixed parameters} + +\item{random}{If not specified, all fixed effects are complemented +with uncorrelated random effects} + +\item{groups}{See the documentation of nlme} + +\item{start}{If not specified, mean values of the fitted degradation +parameters taken from the mmkin object are used} + +\item{correlation}{See the documentation of nlme} + +\item{weights}{passed to nlme} + +\item{subset}{passed to nlme} + +\item{method}{passed to nlme} + +\item{na.action}{passed to nlme} + +\item{naPattern}{passed to nlme} + +\item{control}{passed to nlme} + +\item{verbose}{passed to nlme} +} +\value{ +Upon success, a fitted nlme.mmkin object, which is + an nlme object with additional elements +} +\description{ +Create an nlme model for an mmkin row object +} +\examples{ +ds <- lapply(experimental_data_for_UBA_2019[6:10], + function(x) subset(x$data[c("name", "time", "value")], name == "parent")) +f <- mmkin("SFO", ds, quiet = TRUE, cores = 1) +library(nlme) +f_nlme <- nlme(f) +nlme(f, random = parent_0 ~ 1) +f_nlme <- nlme(f, start = c(parent_0 = 100, log_k_parent_sink = 0.1)) +update(f_nlme, random = parent_0 ~ 1) +} -- cgit v1.2.1