diff options
Diffstat (limited to 'R/lrtest.mkinfit.R')
-rw-r--r-- | R/lrtest.mkinfit.R | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/R/lrtest.mkinfit.R b/R/lrtest.mkinfit.R index a5689830..c3f4d38e 100644 --- a/R/lrtest.mkinfit.R +++ b/R/lrtest.mkinfit.R @@ -19,7 +19,8 @@ lmtest::lrtest #' lower number of fitted parameters (null hypothesis). #' #' @importFrom stats logLik update -#' @param object An \code{\link{mkinfit}} object +#' @param object An \code{\link{mkinfit}} object, or an \code{\link{mmkin}} column +#' object containing two fits to the same data. #' @param object_2 Optionally, another mkinfit object fitted to the same data. #' @param \dots Argument to \code{\link{mkinfit}}, passed to #' \code{\link{update.mkinfit}} for creating the alternative fitted object. @@ -36,7 +37,7 @@ lmtest::lrtest #' #lrtest(dfop_fit, error_model = "tc") #' #lrtest(dfop_fit, fixed_parms = c(k2 = 0)) #' -#' # However, this equivalent syntax works for static help pages +#' # However, this equivalent syntax also 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))) #' } @@ -68,3 +69,10 @@ lrtest.mkinfit <- function(object, object_2 = NULL, ...) { lmtest::lrtest.default(object_2, object, name = name_function) } } + +#' @rdname lrtest.mkinfit +#' @export +lrtest.mmkin <- function(object, ...) { + if (nrow(object) != 2 | ncol(object) > 1) stop("Only works for a column containing two mkinfit objects") + lrtest(object[[1, 1]], object[[2, 1]]) +} |