1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#' @noRd
#' @noRd
#' @export
vcov.comparisons <- function(object, ...) {
# align J and V: This might be a problematic hack, but I have not found examples yet.
V <- components(object, "vcov_model")
J <- components(object, "jacobian")
aligned <- align_jacobian_vcov(J, V, object, ...)
aligned$J %*% aligned$V %*% t(aligned$J)
}
#' @noRd
#' @export
vcov.predictions <- vcov.comparisons
#' @noRd
#' @export
vcov.hypotheses <- vcov.comparisons
#' @noRd
#' @export
vcov.slopes <- vcov.comparisons
#' @export
#' @noRd
coef.comparisons <- function(object, ...) {
if (!is.null(object$estimate)) {
out <- object$estimate
if (is.null(names(out))) {
lab <- tryCatch(get_labels(object), error = function(e) NULL)
if (length(lab) == length(out)) {
out <- stats::setNames(out, lab)
}
}
return(out)
} else {
stop("The input object does not contain an 'estimate' element.")
}
}
#' @export
#' @noRd
coef.slopes <- coef.comparisons
#' @export
#' @noRd
coef.predictions <- coef.comparisons
#' @export
#' @noRd
coef.hypotheses <- coef.comparisons
#' @export
#' @noRd
df.residual.comparisons <- function(object, ...) {
out <- tryCatch(
stats::df.residual(components(object, "model")),
error = function(e) NULL
)
if (is.null(out)) out <- Inf
return(out)
}
#' @export
#' @noRd
df.residual.predictions <- df.residual.comparisons
#' @export
#' @noRd
df.residual.slopes <- df.residual.comparisons
|