aboutsummaryrefslogtreecommitdiff
path: root/R/logLik.mkinfit.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/logLik.mkinfit.R')
-rw-r--r--R/logLik.mkinfit.R11
1 files changed, 6 insertions, 5 deletions
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)
}

Contact - Imprint