diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-11-10 05:14:57 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-11-10 05:14:57 +0100 |
commit | 606ef9ad6cae0ddfae6db6b90deb03f81140e46f (patch) | |
tree | 5a0a581a2251621efdcbd5a5c425cb04eca306f5 | |
parent | 96500fa127b59bddb2fcfe77b7b97415bd105f4a (diff) |
Digits for summary methods, print.saem.mmkin
-rw-r--r-- | NAMESPACE | 1 | ||||
-rw-r--r-- | R/nlme.mmkin.R | 7 | ||||
-rw-r--r-- | R/saemix.R | 30 | ||||
-rw-r--r-- | R/summary.nlme.mmkin.R | 14 | ||||
-rw-r--r-- | R/summary.saem.mmkin.R | 16 | ||||
-rw-r--r-- | docs/dev/news/index.html | 3 | ||||
-rw-r--r-- | docs/dev/pkgdown.yml | 2 | ||||
-rw-r--r-- | docs/dev/reference/index.html | 2 | ||||
-rw-r--r-- | docs/dev/reference/nlme.mmkin.html | 35 | ||||
-rw-r--r-- | docs/dev/reference/saem.html | 95 | ||||
-rw-r--r-- | man/nlme.mmkin.Rd | 7 | ||||
-rw-r--r-- | man/saem.Rd | 7 |
12 files changed, 137 insertions, 82 deletions
@@ -25,6 +25,7 @@ S3method(print,mkinmod) S3method(print,mmkin) S3method(print,nafta) S3method(print,nlme.mmkin) +S3method(print,saem.mmkin) S3method(print,summary.mkinfit) S3method(print,summary.nlme.mmkin) S3method(print,summary.saem.mmkin) diff --git a/R/nlme.mmkin.R b/R/nlme.mmkin.R index d26b86ac..a9e1694f 100644 --- a/R/nlme.mmkin.R +++ b/R/nlme.mmkin.R @@ -210,7 +210,8 @@ nlme.mmkin <- function(model, data = sys.frame(sys.parent()), #' @export #' @rdname nlme.mmkin #' @param x An nlme.mmkin object to print -print.nlme.mmkin <- function(x, ...) { +#' @param digits Number of digits to use for printing +print.nlme.mmkin <- function(x, digits = max(3, getOption("digits") - 3), ...) { cat( "Kinetic nonlinear mixed-effects model fit by " ) cat( if(x$method == "REML") "REML\n" else "maximum likelihood\n") cat("\nStructural model:\n") @@ -230,9 +231,9 @@ print.nlme.mmkin <- function(x, ...) { x$call$fixed else lapply(fixF, function(el) as.name(deparse(el)))), "\n") - print(fixef(x), ...) + print(fixef(x), digits = digits, ...) cat("\n") - print(summary(x$modelStruct), sigma = x$sigma, ...) + print(summary(x$modelStruct), sigma = x$sigma, digits = digits, ...) invisible(x) } @@ -139,6 +139,36 @@ saem.mmkin <- function(object, return(result) } +#' @export +#' @rdname saem +#' @param x An saem.mmkin object to print +#' @param digits Number of digits to use for printing +print.saem.mmkin <- function(x, digits = max(3, getOption("digits") - 3), ...) { + cat( "Kinetic nonlinear mixed-effects model fit by SAEM" ) + cat("\nStructural model:\n") + diffs <- x$mmkin[[1]]$mkinmod$diffs + nice_diffs <- gsub("^(d.*) =", "\\1/dt =", diffs) + writeLines(strwrap(nice_diffs, exdent = 11)) + cat("\nData:\n") + cat(nrow(x$data), "observations of", + length(unique(x$data$name)), "variable(s) grouped in", + length(unique(x$data$ds)), "datasets\n") + + cat("\nLikelihood computed by importance sampling\n") + print(data.frame( + AIC = AIC(x$so, type = "is"), + BIC = BIC(x$so, type = "is"), + logLik = logLik(x$so, type = "is"), + row.names = " "), digits = digits) + + cat("\nFitted parameters:\n") + conf.int <- x$so@results@conf.int[c("estimate", "lower", "upper")] + rownames(conf.int) <- x$so@results@conf.int[["name"]] + print(conf.int, digits = digits) + + invisible(x) +} + #' @rdname saem #' @return An [saemix::SaemixModel] object. #' @export diff --git a/R/summary.nlme.mmkin.R b/R/summary.nlme.mmkin.R index ad730f9a..42326b39 100644 --- a/R/summary.nlme.mmkin.R +++ b/R/summary.nlme.mmkin.R @@ -191,10 +191,10 @@ print.summary.nlme.mmkin <- function(x, digits = max(3, getOption("digits") - 3) cat("\nResults:\n\n") print(data.frame(AIC = x$AIC, BIC = x$BIC, logLik = x$logLik, - row.names = " ")) + row.names = " "), ...) cat("\nOptimised, transformed parameters with symmetric confidence intervals:\n") - print(x$confint_trans) + print(x$confint_trans, digits = digits, ...) if (nrow(x$confint_trans) > 1) { corr <- x$corFixed @@ -204,28 +204,28 @@ print.summary.nlme.mmkin <- function(x, digits = max(3, getOption("digits") - 3) cat("\n") # Random effects print(summary(x$modelStruct), sigma = x$sigma, - reEstimates = x$coef$random, verbose = verbose, ...) + reEstimates = x$coef$random, digits = digits, verbose = verbose, ...) cat("\nBacktransformed parameters with asymmetric confidence intervals:\n") - print(x$confint_back) + print(x$confint_back, digits = digits, ...) printSFORB <- !is.null(x$SFORB) if(printSFORB){ cat("\nEstimated Eigenvalues of SFORB model(s):\n") - print(x$SFORB, digits=digits,...) + print(x$SFORB, digits = digits,...) } printff <- !is.null(x$ff) if(printff){ cat("\nResulting formation fractions:\n") - print(data.frame(ff = x$ff), digits=digits,...) + print(data.frame(ff = x$ff), ...) } printdistimes <- !is.null(x$distimes) if(printdistimes){ cat("\nEstimated disappearance times:\n") - print(x$distimes, digits=digits,...) + print(x$distimes, digits = digits, ...) } if (x$print_data){ diff --git a/R/summary.saem.mmkin.R b/R/summary.saem.mmkin.R index 75fdb045..337120b2 100644 --- a/R/summary.saem.mmkin.R +++ b/R/summary.saem.mmkin.R @@ -213,10 +213,10 @@ print.summary.saem.mmkin <- function(x, digits = max(3, getOption("digits") - 3) cat("\nResults:\n\n") cat("Likelihood computed by importance sampling\n") print(data.frame(AIC = x$AIC, BIC = x$BIC, logLik = x$logLik, - row.names = " ")) + row.names = " "), digits = digits) cat("\nOptimised, transformed parameters with symmetric confidence intervals:\n") - print(x$confint_trans) + print(x$confint_trans, digits = digits) if (nrow(x$confint_trans) > 1) { corr <- x$corFixed @@ -225,30 +225,30 @@ print.summary.saem.mmkin <- function(x, digits = max(3, getOption("digits") - 3) } cat("\nRandom effects:\n") - print(x$confint_ranef) + print(x$confint_ranef, digits = digits) cat("\nVariance model:\n") - print(x$confint_errmod) + print(x$confint_errmod, digits = digits) cat("\nBacktransformed parameters with asymmetric confidence intervals:\n") - print(x$confint_back) + print(x$confint_back, digits = digits) printSFORB <- !is.null(x$SFORB) if(printSFORB){ cat("\nEstimated Eigenvalues of SFORB model(s):\n") - print(x$SFORB, digits=digits,...) + print(x$SFORB, digits = digits,...) } printff <- !is.null(x$ff) if(printff){ cat("\nResulting formation fractions:\n") - print(data.frame(ff = x$ff), digits=digits,...) + print(data.frame(ff = x$ff), digits = digits,...) } printdistimes <- !is.null(x$distimes) if(printdistimes){ cat("\nEstimated disappearance times:\n") - print(x$distimes, digits=digits,...) + print(x$distimes, digits = digits,...) } if (x$print_data){ diff --git a/docs/dev/news/index.html b/docs/dev/news/index.html index c068b8a4..3a868426 100644 --- a/docs/dev/news/index.html +++ b/docs/dev/news/index.html @@ -146,7 +146,8 @@ <a href="#mkin-0-9-50-4-unreleased" class="anchor"></a>mkin 0.9.50.4 (unreleased)<small> Unreleased </small> </h1> <ul> -<li><p>‘saem’ generic function to fit saemix models, with a generator ‘saem.mmkin’ and further methods ‘summary.saem.mmkin’, ‘plot.saem.mmkin’</p></li> +<li><p>‘plot.mixed.mmkin’ method used for ‘nlme.mmkin’ and ‘saem.mmkin’, both inheriting from ‘mixed.mmkin’ (currently virtual)</p></li> +<li><p>‘saem’ generic function to fit saemix models, with a generator ‘saem.mmkin’, summary and plot methods</p></li> <li><p>‘transform_odeparms’, ‘backtransform_odeparms’: Use logit transformation for solitary fractions like the g parameter of the DFOP model, or formation fractions for a pathway to only one target variable</p></li> <li><p>‘update’ method for ‘mmkin’ objects</p></li> <li><p>‘plot’, ‘summary’ and ‘print’ methods for ‘nlme.mmkin’ objects</p></li> diff --git a/docs/dev/pkgdown.yml b/docs/dev/pkgdown.yml index ef9bb681..17d7c266 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-11-09T16:21Z +last_built: 2020-11-10T04:11Z urls: reference: https://pkgdown.jrwb.de/mkin/reference article: https://pkgdown.jrwb.de/mkin/articles diff --git a/docs/dev/reference/index.html b/docs/dev/reference/index.html index ada9fb24..36c10225 100644 --- a/docs/dev/reference/index.html +++ b/docs/dev/reference/index.html @@ -325,7 +325,7 @@ of an mmkin object</p></td> </tr><tr> <td> - <p><code><a href="saem.html">saem()</a></code> <code><a href="saem.html">saemix_model()</a></code> <code><a href="saem.html">saemix_data()</a></code> </p> + <p><code><a href="saem.html">saem()</a></code> <code><a href="saem.html">print(<i><saem.mmkin></i>)</a></code> <code><a href="saem.html">saemix_model()</a></code> <code><a href="saem.html">saemix_data()</a></code> </p> </td> <td><p>Fit nonlinear mixed models with SAEM</p></td> </tr><tr> diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html index defef75d..05edbde5 100644 --- a/docs/dev/reference/nlme.mmkin.html +++ b/docs/dev/reference/nlme.mmkin.html @@ -170,7 +170,7 @@ have been obtained by fitting the same model to a list of datasets.</p> <span class='op'>)</span> <span class='co'># S3 method for nlme.mmkin</span> -<span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>x</span>, <span class='va'>...</span><span class='op'>)</span> +<span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>x</span>, digits <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/Extremes.html'>max</a></span><span class='op'>(</span><span class='fl'>3</span>, <span class='fu'><a href='https://rdrr.io/r/base/options.html'>getOption</a></span><span class='op'>(</span><span class='st'>"digits"</span><span class='op'>)</span> <span class='op'>-</span> <span class='fl'>3</span><span class='op'>)</span>, <span class='va'>...</span><span class='op'>)</span> <span class='co'># S3 method for nlme.mmkin</span> <span class='fu'><a href='https://rdrr.io/r/stats/update.html'>update</a></span><span class='op'>(</span><span class='va'>object</span>, <span class='va'>...</span><span class='op'>)</span></pre> @@ -242,6 +242,10 @@ parameters taken from the mmkin object are used</p></td> <td><p>An nlme.mmkin object to print</p></td> </tr> <tr> + <th>digits</th> + <td><p>Number of digits to use for printing</p></td> + </tr> + <tr> <th>...</th> <td><p>Update specifications passed to update.nlme</p></td> </tr> @@ -262,8 +266,7 @@ methods that will automatically work on 'nlme.mmkin' objects, such as <code><a href='https://rdrr.io/pkg/nlme/man/intervals.html'>nlme::intervals()</a></code>, <code><a href='https://rdrr.io/pkg/nlme/man/anova.lme.html'>nlme::anova.lme()</a></code> and <code><a href='https://rdrr.io/pkg/nlme/man/coef.lme.html'>nlme::coef.lme()</a></code>.</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='nlme_function.html'>nlme_function()</a></code>, <a href='plot.mixed.mmkin.html'>plot.mixed.mmkin</a>, <a href='summary.nlme.mmkin.html'>summary.nlme.mmkin</a>, -parms.nlme.mmkin</p></div> + <div class='dont-index'><p><code><a href='nlme_function.html'>nlme_function()</a></code>, <a href='plot.mixed.mmkin.html'>plot.mixed.mmkin</a>, <a href='summary.nlme.mmkin.html'>summary.nlme.mmkin</a></p></div> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <pre class="examples"><div class='input'><span class='va'>ds</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>lapply</a></span><span class='op'>(</span><span class='va'>experimental_data_for_UBA_2019</span><span class='op'>[</span><span class='fl'>6</span><span class='op'>:</span><span class='fl'>10</span><span class='op'>]</span>, @@ -290,15 +293,15 @@ parms.nlme.mmkin</p></div> #> #> Fixed effects: #> list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1) -#> parent_0 log_k1 log_k2 g_qlogis -#> 94.17015185 -1.80015278 -4.14738834 0.03239833 +#> parent_0 log_k1 log_k2 g_qlogis +#> 94.1702 -1.8002 -4.1474 0.0324 #> #> Random effects: #> Formula: list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1) #> Level: ds #> Structure: Diagonal -#> parent_0 log_k1 log_k2 g_qlogis Residual -#> StdDev: 2.488249 0.8447275 1.32965 0.4651789 2.321364 +#> parent_0 log_k1 log_k2 g_qlogis Residual +#> StdDev: 2.488 0.8447 1.33 0.4652 2.321 #> </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='va'>f_nlme_dfop</span><span class='op'>)</span> </div><div class='img'><img src='nlme.mmkin-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='fu'><a href='endpoints.html'>endpoints</a></span><span class='op'>(</span><span class='va'>f_nlme_dfop</span><span class='op'>)</span> </div><div class='output co'>#> $distimes @@ -321,12 +324,12 @@ parms.nlme.mmkin</p></div> #> Fixed effects: #> list(parent_0 ~ 1, log_k_parent ~ 1) #> parent_0 log_k_parent -#> 75.933480 -3.555983 +#> 75.933 -3.556 #> #> Random effects: #> Formula: parent_0 ~ 1 | ds -#> parent_0 Residual -#> StdDev: 0.002416792 21.63027 +#> parent_0 Residual +#> StdDev: 0.002417 21.63 #> </div><div class='input'> <span class='va'>ds_2</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>lapply</a></span><span class='op'>(</span><span class='va'>experimental_data_for_UBA_2019</span><span class='op'>[</span><span class='fl'>6</span><span class='op'>:</span><span class='fl'>10</span><span class='op'>]</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>x</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='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"name"</span>, <span class='st'>"time"</span>, <span class='st'>"value"</span><span class='op'>)</span><span class='op'>]</span><span class='op'>)</span> <span class='va'>m_sfo_sfo</span> <span class='op'><-</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='st'>"A1"</span><span class='op'>)</span>, @@ -427,15 +430,15 @@ parms.nlme.mmkin</p></div> #> #> Fixed effects: #> list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1) -#> parent_0 log_k1 log_k2 g_qlogis -#> 94.04774566 -1.82339808 -4.16715311 0.05685186 +#> parent_0 log_k1 log_k2 g_qlogis +#> 94.04775 -1.82340 -4.16715 0.05685 #> #> Random effects: #> Formula: list(parent_0 ~ 1, log_k1 ~ 1, log_k2 ~ 1, g_qlogis ~ 1) #> Level: ds #> Structure: Diagonal -#> parent_0 log_k1 log_k2 g_qlogis Residual -#> StdDev: 2.473881 0.8499884 1.337185 0.4659005 1 +#> parent_0 log_k1 log_k2 g_qlogis Residual +#> StdDev: 2.474 0.85 1.337 0.4659 1 #> #> Variance function: #> Structure: Constant plus proportion of variance covariate @@ -462,14 +465,14 @@ parms.nlme.mmkin</p></div> #> Fixed effects: #> list(parent_0 ~ 1, log_k_parent_sink ~ 1, log_k_parent_A1 ~ 1, log_k_A1_sink ~ 1) #> parent_0 log_k_parent_sink log_k_parent_A1 log_k_A1_sink -#> 87.975536 -3.669816 -4.164127 -4.645073 +#> 87.976 -3.670 -4.164 -4.645 #> #> Random effects: #> Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1, log_k_parent_A1 ~ 1, log_k_A1_sink ~ 1) #> Level: ds #> Structure: Diagonal #> parent_0 log_k_parent_sink log_k_parent_A1 log_k_A1_sink Residual -#> StdDev: 3.992214 1.77702 1.054733 0.4821383 6.482585 +#> StdDev: 3.992 1.777 1.055 0.4821 6.483 #> #> Variance function: #> Structure: Different standard deviations per stratum diff --git a/docs/dev/reference/saem.html b/docs/dev/reference/saem.html index f1b4c421..f9cdf1c8 100644 --- a/docs/dev/reference/saem.html +++ b/docs/dev/reference/saem.html @@ -164,6 +164,9 @@ Expectation Maximisation algorithm (SAEM).</p> <span class='va'>...</span> <span class='op'>)</span> +<span class='co'># S3 method for saem.mmkin</span> +<span class='fu'><a href='https://rdrr.io/r/base/print.html'>print</a></span><span class='op'>(</span><span class='va'>x</span>, digits <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/Extremes.html'>max</a></span><span class='op'>(</span><span class='fl'>3</span>, <span class='fu'><a href='https://rdrr.io/r/base/options.html'>getOption</a></span><span class='op'>(</span><span class='st'>"digits"</span><span class='op'>)</span> <span class='op'>-</span> <span class='fl'>3</span><span class='op'>)</span>, <span class='va'>...</span><span class='op'>)</span> + <span class='fu'>saemix_model</span><span class='op'>(</span><span class='va'>object</span>, cores <span class='op'>=</span> <span class='fl'>1</span>, verbose <span class='op'>=</span> <span class='cn'>FALSE</span>, <span class='va'>...</span><span class='op'>)</span> <span class='fu'>saemix_data</span><span class='op'>(</span><span class='va'>object</span>, verbose <span class='op'>=</span> <span class='cn'>FALSE</span>, <span class='va'>...</span><span class='op'>)</span></pre> @@ -201,6 +204,14 @@ used.</p></td> <td><p>Should we suppress any plotting that is done by the saemix function?</p></td> </tr> + <tr> + <th>x</th> + <td><p>An saem.mmkin object to print</p></td> + </tr> + <tr> + <th>digits</th> + <td><p>Number of digits to use for printing</p></td> + </tr> </table> <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2> @@ -230,27 +241,27 @@ using <a href='mmkin.html'>mmkin</a>.</p> state.ini <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'>100</span><span class='op'>)</span>, fixed_initials <span class='op'>=</span> <span class='st'>"parent"</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> <span class='va'>f_saem_p0_fixed</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent_p0_fixed</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Mon Nov 9 17:18:28 2020" +#> [1] "Tue Nov 10 05:12:21 2020" #> .... #> Minimisation finished -#> [1] "Mon Nov 9 17:18:30 2020"</div><div class='input'> +#> [1] "Tue Nov 10 05:12:23 2020"</div><div class='input'> <span class='va'>f_mmkin_parent</span> <span class='op'><-</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/c.html'>c</a></span><span class='op'>(</span><span class='st'>"SFO"</span>, <span class='st'>"FOMC"</span>, <span class='st'>"DFOP"</span><span class='op'>)</span>, <span class='va'>ds</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> <span class='va'>f_saem_sfo</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"SFO"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Mon Nov 9 17:18:31 2020" +#> [1] "Tue Nov 10 05:12:24 2020" #> .... #> Minimisation finished -#> [1] "Mon Nov 9 17:18:33 2020"</div><div class='input'><span class='va'>f_saem_fomc</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"FOMC"</span>, <span class='op'>]</span><span class='op'>)</span> +#> [1] "Tue Nov 10 05:12:26 2020"</div><div class='input'><span class='va'>f_saem_fomc</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"FOMC"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Mon Nov 9 17:18:33 2020" +#> [1] "Tue Nov 10 05:12:26 2020" #> .... #> Minimisation finished -#> [1] "Mon Nov 9 17:18:35 2020"</div><div class='input'><span class='va'>f_saem_dfop</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"DFOP"</span>, <span class='op'>]</span><span class='op'>)</span> +#> [1] "Tue Nov 10 05:12:28 2020"</div><div class='input'><span class='va'>f_saem_dfop</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"DFOP"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Mon Nov 9 17:18:36 2020" +#> [1] "Tue Nov 10 05:12:29 2020" #> .... #> Minimisation finished -#> [1] "Mon Nov 9 17:18:39 2020"</div><div class='input'> +#> [1] "Tue Nov 10 05:12:32 2020"</div><div class='input'> <span class='co'># The returned saem.mmkin object contains an SaemixObject, therefore we can use</span> <span class='co'># functions from saemix</span> <span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'>saemix</span><span class='op'>)</span> @@ -296,10 +307,10 @@ using <a href='mmkin.html'>mmkin</a>.</p> <span class='va'>f_mmkin_parent_tc</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_mmkin_parent</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span><span class='op'>)</span> <span class='va'>f_saem_fomc_tc</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent_tc</span><span class='op'>[</span><span class='st'>"FOMC"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Mon Nov 9 17:18:41 2020" +#> [1] "Tue Nov 10 05:12:34 2020" #> .... #> Minimisation finished -#> [1] "Mon Nov 9 17:18:46 2020"</div><div class='input'><span class='fu'><a href='https://rdrr.io/pkg/saemix/man/compare.saemix.html'>compare.saemix</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='va'>f_saem_fomc</span><span class='op'>$</span><span class='va'>so</span>, <span class='va'>f_saem_fomc_tc</span><span class='op'>$</span><span class='va'>so</span><span class='op'>)</span><span class='op'>)</span> +#> [1] "Tue Nov 10 05:12:39 2020"</div><div class='input'><span class='fu'><a href='https://rdrr.io/pkg/saemix/man/compare.saemix.html'>compare.saemix</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='va'>f_saem_fomc</span><span class='op'>$</span><span class='va'>so</span>, <span class='va'>f_saem_fomc_tc</span><span class='op'>$</span><span class='va'>so</span><span class='op'>)</span><span class='op'>)</span> </div><div class='output co'>#> Likelihoods computed by importance sampling </div><div class='output co'>#> AIC BIC #> 1 467.7644 465.0305 #> 2 469.4862 466.3617</div><div class='input'> @@ -319,20 +330,20 @@ using <a href='mmkin.html'>mmkin</a>.</p> <span class='co'># solutions written for mkin this took around four minutes</span> <span class='va'>f_saem_sfo_sfo</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin</span><span class='op'>[</span><span class='st'>"SFO-SFO"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Mon Nov 9 17:18:48 2020" +#> [1] "Tue Nov 10 05:12:42 2020" #> .... #> Minimisation finished -#> [1] "Mon Nov 9 17:18:53 2020"</div><div class='input'><span class='va'>f_saem_dfop_sfo</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin</span><span class='op'>[</span><span class='st'>"DFOP-SFO"</span>, <span class='op'>]</span><span class='op'>)</span> +#> [1] "Tue Nov 10 05:12:47 2020"</div><div class='input'><span class='va'>f_saem_dfop_sfo</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin</span><span class='op'>[</span><span class='st'>"DFOP-SFO"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Mon Nov 9 17:18:54 2020" +#> [1] "Tue Nov 10 05:12:48 2020" #> .... #> Minimisation finished -#> [1] "Mon Nov 9 17:19:03 2020"</div><div class='input'><span class='fu'><a href='https://rdrr.io/pkg/saemix/man/summary-methods.html'>summary</a></span><span class='op'>(</span><span class='va'>f_saem_dfop_sfo</span>, data <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> +#> [1] "Tue Nov 10 05:12:57 2020"</div><div class='input'><span class='fu'><a href='https://rdrr.io/pkg/saemix/man/summary-methods.html'>summary</a></span><span class='op'>(</span><span class='va'>f_saem_dfop_sfo</span>, data <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> </div><div class='output co'>#> saemix version used for fitting: 3.1.9000 #> mkin version used for pre-fitting: 0.9.50.4 #> R version used for fitting: 4.0.3 -#> Date of fit: Mon Nov 9 17:19:04 2020 -#> Date of summary: Mon Nov 9 17:19:04 2020 +#> Date of fit: Tue Nov 10 05:12:58 2020 +#> Date of summary: Tue Nov 10 05:12:58 2020 #> #> Equations: #> d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 * @@ -347,7 +358,7 @@ using <a href='mmkin.html'>mmkin</a>.</p> #> #> Model predictions using solution type analytical #> -#> Fitted in 9.941 s using 300, 100 iterations +#> Fitted in 10.382 s using 300, 100 iterations #> #> Variance model: Constant variance #> @@ -363,17 +374,17 @@ using <a href='mmkin.html'>mmkin</a>.</p> #> Results: #> #> Likelihood computed by importance sampling -#> AIC BIC logLik -#> 841.3208 836.2435 -407.6604 +#> AIC BIC logLik +#> 841.3 836.2 -407.7 #> #> Optimised, transformed parameters with symmetric confidence intervals: -#> est. lower upper -#> parent_0 93.7514328489 91.113651 96.3892150 -#> log_k_A1 -6.1262333211 -8.432492 -3.8199749 -#> f_parent_qlogis -0.9739851652 -1.371984 -0.5759863 -#> log_k1 -2.4818388836 -3.746899 -1.2167788 -#> log_k2 -3.6138616567 -5.294149 -1.9335743 -#> g_qlogis -0.0004613666 -1.063179 1.0622564 +#> est. lower upper +#> parent_0 93.7514328 91.114 96.389 +#> log_k_A1 -6.1262333 -8.432 -3.820 +#> f_parent_qlogis -0.9739852 -1.372 -0.576 +#> log_k1 -2.4818389 -3.747 -1.217 +#> log_k2 -3.6138617 -5.294 -1.934 +#> g_qlogis -0.0004614 -1.063 1.062 #> #> Correlation: #> prnt_0 lg__A1 f_prn_ log_k1 log_k2 @@ -384,26 +395,26 @@ using <a href='mmkin.html'>mmkin</a>.</p> #> g_qlogis -0.068 -0.016 0.011 -0.181 -0.181 #> #> Random effects: -#> est. lower upper -#> SD.parent_0 2.7857084 0.7825105 4.7889063 -#> SD.log_k_A1 2.1412505 0.4425207 3.8399803 -#> SD.f_parent_qlogis 0.4463087 0.1609059 0.7317116 -#> SD.log_k1 1.4097204 0.5240566 2.2953842 -#> SD.log_k2 1.8739067 0.6979362 3.0498773 -#> SD.g_qlogis 0.4559301 -0.8149852 1.7268453 +#> est. lower upper +#> SD.parent_0 2.7857 0.7825 4.7889 +#> SD.log_k_A1 2.1413 0.4425 3.8400 +#> SD.f_parent_qlogis 0.4463 0.1609 0.7317 +#> SD.log_k1 1.4097 0.5241 2.2954 +#> SD.log_k2 1.8739 0.6979 3.0499 +#> SD.g_qlogis 0.4559 -0.8150 1.7268 #> #> Variance model: -#> est. lower upper -#> a.1 1.882757 1.665681 2.099832 +#> est. lower upper +#> a.1 1.883 1.666 2.1 #> #> Backtransformed parameters with asymmetric confidence intervals: -#> est. lower upper -#> parent_0 93.751432849 9.111365e+01 96.38921497 -#> k_A1 0.002184795 2.176784e-04 0.02192835 -#> f_parent_to_A1 0.274086887 2.022995e-01 0.35985666 -#> k1 0.083589373 2.359079e-02 0.29618269 -#> k2 0.026947583 5.020885e-03 0.14463032 -#> g 0.499884658 2.567024e-01 0.74312150 +#> est. lower upper +#> parent_0 93.751433 9.111e+01 96.38921 +#> k_A1 0.002185 2.177e-04 0.02193 +#> f_parent_to_A1 0.274087 2.023e-01 0.35986 +#> k1 0.083589 2.359e-02 0.29618 +#> k2 0.026948 5.021e-03 0.14463 +#> g 0.499885 2.567e-01 0.74312 #> #> Resulting formation fractions: #> ff diff --git a/man/nlme.mmkin.Rd b/man/nlme.mmkin.Rd index 9526a427..abcd0e81 100644 --- a/man/nlme.mmkin.Rd +++ b/man/nlme.mmkin.Rd @@ -23,7 +23,7 @@ verbose = FALSE ) -\method{print}{nlme.mmkin}(x, ...) +\method{print}{nlme.mmkin}(x, digits = max(3, getOption("digits") - 3), ...) \method{update}{nlme.mmkin}(object, ...) } @@ -61,6 +61,8 @@ parameters taken from the mmkin object are used} \item{x}{An nlme.mmkin object to print} +\item{digits}{Number of digits to use for printing} + \item{...}{Update specifications passed to update.nlme} \item{object}{An nlme.mmkin object to update} @@ -150,6 +152,5 @@ endpoints(f_nlme_dfop) } } \seealso{ -\code{\link[=nlme_function]{nlme_function()}}, \link{plot.mixed.mmkin}, \link{summary.nlme.mmkin}, -\link{parms.nlme.mmkin} +\code{\link[=nlme_function]{nlme_function()}}, \link{plot.mixed.mmkin}, \link{summary.nlme.mmkin} } diff --git a/man/saem.Rd b/man/saem.Rd index 17f777c4..f75470a9 100644 --- a/man/saem.Rd +++ b/man/saem.Rd @@ -3,6 +3,7 @@ \name{saem} \alias{saem} \alias{saem.mmkin} +\alias{print.saem.mmkin} \alias{saemix_model} \alias{saemix_data} \title{Fit nonlinear mixed models with SAEM} @@ -19,6 +20,8 @@ saem(object, control, ...) ... ) +\method{print}{saem.mmkin}(x, digits = max(3, getOption("digits") - 3), ...) + saemix_model(object, cores = 1, verbose = FALSE, ...) saemix_data(object, verbose = FALSE, ...) @@ -41,6 +44,10 @@ used.} \item{suppressPlot}{Should we suppress any plotting that is done by the saemix function?} + +\item{x}{An saem.mmkin object to print} + +\item{digits}{Number of digits to use for printing} } \value{ An S3 object of class 'saem.mmkin', containing the fitted |