diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-03-27 11:47:48 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-03-27 11:47:48 +0100 |
commit | 20ece4e0bcbeceb90a940e04a858f4ffb6d6b5e4 (patch) | |
tree | 7595dbb6e129332a6ad0c273ecd3fbd92643e0d5 /R/lrtest.mkinfit.R | |
parent | 731dd9450f08868140f90af7a305133ec9342994 (diff) | |
parent | 68eed166cbe10a5ee79f5b1139261dea98234b22 (diff) |
Merge branch 'master' into mxkin
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]]) +} |