From 20b9c584e7c43ecbb708459e531c24a1a4751e17 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 9 Nov 2019 01:05:51 +0100 Subject: Add a lack-of-fit test - Switch an example dataset in the test setup to a dataset with replicates, adapt tests - Skip the test for lrtest with an update specification as it does not only fail when pkgdown generates static help pages, but also in testthat --- R/logLik.mkinfit.R | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'R/logLik.mkinfit.R') diff --git a/R/logLik.mkinfit.R b/R/logLik.mkinfit.R index cadc0d0a..1c025893 100644 --- a/R/logLik.mkinfit.R +++ b/R/logLik.mkinfit.R @@ -1,15 +1,15 @@ #' Calculated the log-likelihood of a fitted mkinfit object -#' +#' #' This function returns the product of the likelihood densities of each #' observed value, as calculated as part of the fitting procedure using #' \code{\link{dnorm}}, i.e. assuming normal distribution, and with the means #' predicted by the degradation model, and the standard deviations predicted by #' the error model. -#' +#' #' The total number of estimated parameters returned with the value of the #' likelihood is calculated as the sum of fitted degradation model parameters #' and the fitted error model parameters. -#' +#' #' @param object An object of class \code{\link{mkinfit}}. #' @param \dots For compatibility with the generic method #' @return An object of class \code{\link{logLik}} with the number of estimated @@ -19,7 +19,7 @@ #' @seealso Compare the AIC of columns of \code{\link{mmkin}} objects using #' \code{\link{AIC.mmkin}}. #' @examples -#' +#' #' \dontrun{ #' sfo_sfo <- mkinmod( #' parent = mkinsub("SFO", to = "m1"), @@ -31,11 +31,12 @@ #' f_tc <- mkinfit(sfo_sfo, d_t, error_model = "tc", quiet = TRUE) #' AIC(f_nw, f_obs, f_tc) #' } -#' +#' #' @export logLik.mkinfit <- function(object, ...) { val <- object$logLik # Number of estimated parameters attr(val, "df") <- length(object$bparms.optim) + length(object$errparms) + class(val) <- "logLik" return(val) } -- cgit v1.2.1