From 31fd7412f46c9715962763d435cb0060ea420752 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 4 Nov 2019 17:21:04 +0100 Subject: Include fixed parameters in model names in lrtest --- R/confint.mkinfit.R | 8 ++++---- R/lrtest.mkinfit.R | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'R') diff --git a/R/confint.mkinfit.R b/R/confint.mkinfit.R index 84183808..78dda95d 100644 --- a/R/confint.mkinfit.R +++ b/R/confint.mkinfit.R @@ -4,10 +4,10 @@ #' the curvature of the likelihood function at the maximum likelihood parameter #' estimates. #' The alternative method 'profile' is based on the profile likelihood for each -#' parameter. The method uses two nested optimisations and can take a very long -#' time, even if parallelized by specifying 'cores' on unixoid platforms. The -#' speed of the method could likely be improved by using the method of Venzon -#' and Moolgavkar (1988). +#' parameter. The 'profile' method uses two nested optimisations and can take a +#' very long time, even if parallelized by specifying 'cores' on unixoid +#' platforms. The speed of the method could likely be improved by using the +#' method of Venzon and Moolgavkar (1988). #' #' @param object An \code{\link{mkinfit}} object #' @param parm A vector of names of the parameters which are to be given diff --git a/R/lrtest.mkinfit.R b/R/lrtest.mkinfit.R index 60b6c46a..a5689830 100644 --- a/R/lrtest.mkinfit.R +++ b/R/lrtest.mkinfit.R @@ -30,17 +30,27 @@ lmtest::lrtest #' dfop_fit <- mkinfit("DFOP", test_data, quiet = TRUE) #' lrtest(dfop_fit, sfo_fit) #' lrtest(sfo_fit, dfop_fit) -#' +#' #' # The following two examples are commented out as they fail during #' # generation of the static help pages by pkgdown -#' # lrtest(dfop_fit, error_model = "tc") -#' # lrtest(dfop_fit, fixed_parms = c(k2 = 0)) +#' #lrtest(dfop_fit, error_model = "tc") +#' #lrtest(dfop_fit, fixed_parms = c(k2 = 0)) +#' +#' # However, this equivalent syntax works for static help pages +#' lrtest(dfop_fit, update(dfop_fit, error_model = "tc")) +#' lrtest(dfop_fit, update(dfop_fit, fixed_parms = c(k2 = 0))) #' } #' @export lrtest.mkinfit <- function(object, object_2 = NULL, ...) { name_function <- function(x) { - paste(x$mkinmod$name, "with error model", x$err_mod) + object_name <- paste(x$mkinmod$name, "with error model", x$err_mod) + if (length(x$bparms.fixed) > 0) { + object_name <- paste(object_name, + "and fixed parameter(s)", + paste(names(x$bparms.fixed), collapse = ", ")) + } + return(object_name) } if (is.null(object_2)) { -- cgit v1.2.1