From 56415f3c0638725aaa77db2c02eeaf9d4983452b Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 8 Nov 2022 08:46:57 +0100 Subject: Show DFOP g equivalent of SFORB in summary, test --- R/endpoints.R | 6 ++++-- R/summary.mkinfit.R | 13 +++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'R') diff --git a/R/endpoints.R b/R/endpoints.R index 227671b5..4aec8aa8 100644 --- a/R/endpoints.R +++ b/R/endpoints.R @@ -162,6 +162,7 @@ endpoints <- function(fit) { sqrt_exp = sqrt(1/4 * (k_12 + k_21 + k_1output)^2 - k_1output * k_21) b1 = 0.5 * (k_12 + k_21 + k_1output) + sqrt_exp b2 = 0.5 * (k_12 + k_21 + k_1output) - sqrt_exp + g = (k_12 + k_21 - b1)/(b2 - b1) DT50_b1 = log(2)/b1 DT50_b2 = log(2)/b2 @@ -169,8 +170,7 @@ endpoints <- function(fit) { DT90_b2 = log(10)/b2 SFORB_fraction = function(t) { - ((k_12 + k_21 - b1)/(b2 - b1)) * exp(-b1 * t) + - ((k_12 + k_21 - b2)/(b1 - b2)) * exp(-b2 * t) + g * exp(-b1 * t) + (1 - g) * exp(-b2 * t) } f_50 <- function(log_t) (SFORB_fraction(exp(log_t)) - 0.5)^2 @@ -195,6 +195,8 @@ endpoints <- function(fit) { # Return the eigenvalues for comparison with DFOP rate constants ep$SFORB[[paste(obs_var, "b1", sep="_")]] = b1 ep$SFORB[[paste(obs_var, "b2", sep="_")]] = b2 + # Return g for comparison with DFOP + ep$SFORB[[paste(obs_var, "g", sep="_")]] = g ep$distimes[obs_var, c("DT50back")] = DT50_back ep$distimes[obs_var, c(paste("DT50", obs_var, "b1", sep = "_"))] = DT50_b1 diff --git a/R/summary.mkinfit.R b/R/summary.mkinfit.R index 4122873f..c25b836e 100644 --- a/R/summary.mkinfit.R +++ b/R/summary.mkinfit.R @@ -6,14 +6,14 @@ #' and optionally the data, consisting of observed, predicted and residual #' values. #' -#' @param object an object of class \code{\link{mkinfit}}. +#' @param object an object of class [mkinfit]. #' @param x an object of class \code{summary.mkinfit}. #' @param data logical, indicating whether the data should be included in the -#' summary. +#' summary. #' @param distimes logical, indicating whether DT50 and DT90 values should be -#' included. +#' included. #' @param alpha error level for confidence interval estimation from t -#' distribution +#' distribution #' @param digits Number of digits to use for printing #' @param \dots optional arguments passed to methods like \code{print}. #' @importFrom stats qt pt cov2cor @@ -37,7 +37,8 @@ #' \item{ff}{The estimated formation fractions derived from the fitted #' model.} #' \item{distimes}{The DT50 and DT90 values for each observed variable.} -#' \item{SFORB}{If applicable, eigenvalues of SFORB components of the model.} +#' \item{SFORB}{If applicable, eigenvalues and fractional eigenvector component +#' g of SFORB systems in the model.} #' The print method is called for its side effect, i.e. printing the summary. #' @author Johannes Ranke #' @references FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence @@ -264,7 +265,7 @@ print.summary.mkinfit <- function(x, digits = max(3, getOption("digits") - 3), . printSFORB <- !is.null(x$SFORB) if(printSFORB){ - cat("\nEstimated Eigenvalues of SFORB model(s):\n") + cat("\nEstimated Eigenvalues and DFOP g parameter of SFORB model(s):\n") print(x$SFORB, digits=digits,...) } -- cgit v1.2.1