aboutsummaryrefslogtreecommitdiff
path: root/R/lrtest.mkinfit.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-11-12 15:16:28 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2019-11-12 15:16:28 +0100
commit6064a205d42220062506b11d6334b4f8e3217041 (patch)
treee031b6c2a4a6628b16845e6467ce99ce3c0fc66c /R/lrtest.mkinfit.R
parent20b9c584e7c43ecbb708459e531c24a1a4751e17 (diff)
lrtest method for mmkin columns with two fits
Diffstat (limited to 'R/lrtest.mkinfit.R')
-rw-r--r--R/lrtest.mkinfit.R9
1 files changed, 9 insertions, 0 deletions
diff --git a/R/lrtest.mkinfit.R b/R/lrtest.mkinfit.R
index a5689830..380cf3a5 100644
--- a/R/lrtest.mkinfit.R
+++ b/R/lrtest.mkinfit.R
@@ -18,6 +18,8 @@ lmtest::lrtest
#' parameters (alternative hypothesis) is listed first, then the model with the
#' lower number of fitted parameters (null hypothesis).
#'
+#' The method for mmkin objects only works for column objects with two members.
+#'
#' @importFrom stats logLik update
#' @param object An \code{\link{mkinfit}} object
#' @param object_2 Optionally, another mkinfit object fitted to the same data.
@@ -68,3 +70,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]])
+}

Contact - Imprint