diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2019-11-09 01:05:51 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2019-11-09 01:05:51 +0100 |
commit | 20b9c584e7c43ecbb708459e531c24a1a4751e17 (patch) | |
tree | a0dd523fc6cb60e33420b0eb9bf79307e5b2a2a4 /R/logLik.mkinfit.R | |
parent | ead1f286271923f57d83aed41cb34181a10773ef (diff) |
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
Diffstat (limited to 'R/logLik.mkinfit.R')
-rw-r--r-- | R/logLik.mkinfit.R | 11 |
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) } |