| 1 |
skip_on_cran() |
| 2 |
|
| 3 |
skip_if_not_installed("modeltests") |
| 4 |
library(modeltests) |
| 5 |
|
| 6 |
skip_if_not_installed("MASS") |
| 7 |
suppressPackageStartupMessages(library(MASS)) |
| 8 |
|
| 9 |
fit <- rlm(stack.loss ~ ., stackloss) |
| 10 |
|
| 11 |
test_that("MASS::rlm tidier arguments", { |
| 12 |
check_arguments(tidy.rlm) |
| 13 |
check_arguments(glance.rlm) |
| 14 |
check_arguments(augment.rlm) |
| 15 |
}) |
| 16 |
|
| 17 |
test_that("tidy.rlm", { |
| 18 |
td2 <- tidy(fit, conf.int = TRUE) |
| 19 |
|
| 20 |
check_tidy_output(td2) |
| 21 |
|
| 22 |
# regression test for #380 |
| 23 |
expect_false(NA %in% td2$conf.low) |
| 24 |
expect_false(NA %in% td2$conf.high) |
| 25 |
}) |
| 26 |
|
| 27 |
test_that("glance.rlm", { |
| 28 |
gl <- glance(fit) |
| 29 |
check_glance_outputs(gl) |
| 30 |
check_dims(gl, 1, 7) |
| 31 |
}) |
| 32 |
|
| 33 |
test_that("augment.rlm", { |
| 34 |
skip_on_os("linux") |
| 35 |
|
| 36 |
check_augment_function( |
| 37 |
aug = augment.rlm, |
| 38 |
model = fit, |
| 39 |
data = stackloss, |
| 40 |
newdata = stackloss |
| 41 |
) |
| 42 |
}) |